Emit a nicer error on impl Self {#103609
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.
| 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.
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.
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
Selfis 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