-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
On name resolution error in parameter list, suggest possible const typo and avoid unnecessary second error
#149753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)?
Fix #149660.