On name resolution error in parameter list, suggest possible const typo and avoid unnecessary second error#149753
On name resolution error in parameter list, suggest possible const typo and avoid unnecessary second error#149753estebank wants to merge 2 commits intorust-lang:mainfrom
const typo and avoid unnecessary second error#149753Conversation
| error[E0747]: unresolved item provided when a constant was expected | ||
| --> $DIR/const-argument-typo.rs:8:11 | ||
| | | ||
| LL | foo::<CONS>(); | ||
| | ^^^^ | ||
| | | ||
| help: if this generic argument was intended as a const parameter, surround it with braces | ||
| | | ||
| LL | foo::<{ CONS }>(); | ||
| | + + |
There was a problem hiding this comment.
This shouldn't be shown. When naively silencing it, an inference error is displayed instead, which is just as bad.
There was a problem hiding this comment.
Second commit addresses this.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2745644 to
1ec76fe
Compare
const typoconst typo and avoid unnecessary second error
There was a problem hiding this comment.
I'm unfamiliar with how delayed errors and PathSource works, so I'm probably not the right reviewer for determining if this is the correct solution.
The test changes look correct though, so feel free to either reassign, or just r=me if you don't think this is controversial.
| if self.diag_metadata.currently_processing_generic_args | ||
| && matches!(source, PathSource::Type) | ||
| { | ||
| source = PathSource::TypeParam; | ||
| } | ||
|
|
There was a problem hiding this comment.
It's not clear to me why we're overriding this only here, and not at a "higher" level (such as in smart_resolve_report_errors)?
|
☔ The latest upstream changes (presumably #152321) made this pull request unmergeable. Please resolve the merge conflicts. |
Fix #149660.