-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Emit a nicer error on impl Self {
#103609
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
☔ The latest upstream changes (presumably #103623) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me, with a rebase, a squash, and either the nitpick for the more specific span addressed or a ticket to follow up on that.
@@ -137,3 +137,5 @@ hir_analysis_expected_used_symbol = expected `used`, `used(compiler)` or `used(l | |||
hir_analysis_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty_str}` | |||
|
|||
hir_analysis_add_missing_parentheses_in_range = you must surround the range in parentheses to call its `{$func_name}` function | |||
|
|||
hir_analysis_self_in_impl_self = `Self` is not valid at this location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hir_analysis_self_in_impl_self = `Self` is not valid at this location | |
hir_analysis_self_in_impl_self = `Self` is not valid in the `impl` type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a span label pointing at the Self
on its own with the text "not valid at this location"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we cant since #[note] spans: MultiSpan
is an error, I think the errors are also relatively clear as to what the problematic location is even without that span being there so its not a huge loss. 🤔
pls squash as well |
23ef6f9
to
c00ff9c
Compare
r=me after amending the last commit with a newline on the ftl file |
Im not sure im supposed to r=you this since i also resolved your review about splitting the visitor instead a separate fn and you didnt mention r+ing this after doing that 😆 |
impl Self {
impl Self {
…piler-errors Emit a nicer error on `impl Self {` currently it emits a "cycle detected error" but this PR makes it emit a more user friendly error specifically saying that `Self` is disallowed in that position. this is a pretty hacky fix so i dont expect this to be merged (I basically only made this PR because i wanted to see if CI passes) r? `@compiler-errors`
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#103585 (Migrate source line numbers CSS to CSS variables) - rust-lang#103608 (Remap early bound lifetimes in return-position `impl Trait` in traits too) - rust-lang#103609 (Emit a nicer error on `impl Self {`) - rust-lang#103631 (Add test for issue 36007) - rust-lang#103643 (rustdoc: stop hiding focus outlines on non-rustdoc-toggle details tags) - rust-lang#103645 (Update cargo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
currently it emits a "cycle detected error" but this PR makes it emit a more user friendly error specifically saying that
Self
is disallowed in that position. this is a pretty hacky fix so i dont expect this to be merged (I basically only made this PR because i wanted to see if CI passes)r? @compiler-errors