-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Suggest defining type parameter when appropriate #68447
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
I believe all the points have been addressed. |
@@ -1573,7 +1583,9 @@ impl<'a, 'b> LateResolutionVisitor<'a, '_> { | |||
let def_id = this.parent_scope.module.normal_ancestor_id; | |||
let node_id = this.r.definitions.as_local_node_id(def_id).unwrap(); | |||
let better = res.is_some(); | |||
this.r.use_injections.push(UseError { err, candidates, node_id, better }); | |||
let suggestion = | |||
if res.is_none() { this.report_missing_type_error(path) } else { None }; |
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.
Aha, it's now in smart_resolve_path
, I like it much better.
This is what I though about in #68447 (comment) basically, except the reporting condition is different.
As long as it's contained inside diagnostics.rs
I don't care too much about the precise conditions though.
#68447 (comment) still needs resolving. |
85fd305
to
310dfa5
Compare
r=me after removing the |
``` error[E0412]: cannot find type `T` in this scope --> file.rs:3:12 | 3 | impl Trait<T> for Struct {} | - ^ not found in this scope | | | help: you might be missing a type parameter: `<T>` ``` Fix rust-lang#64298.
310dfa5
to
697fdc5
Compare
@bors r=petrochenkov |
📌 Commit 697fdc5 has been approved by |
Suggest defining type parameter when appropriate ``` error[E0412]: cannot find type `T` in this scope --> file.rs:3:12 | 3 | impl Trait<T> for Struct {} | - ^ not found in this scope | | | help: you might be missing a type parameter: `<T>` ``` Fix #64298.
☀️ Test successful - checks-azure |
📣 Toolstate changed by #68447! Tested on commit 320ada6. 💔 rustc-guide on linux: test-pass → test-fail (cc @JohnTitor @amanjeev @spastorino @mark-i-m, @rust-lang/infra). |
Tested on commit rust-lang/rust@320ada6. Direct link to PR: <rust-lang/rust#68447> 💔 rustc-guide on linux: test-pass → test-fail (cc @JohnTitor @amanjeev @spastorino @mark-i-m, @rust-lang/infra).
Fix #64298.