-
Notifications
You must be signed in to change notification settings - Fork 13.3k
When suggesting associated fn with type parameters, include in the structured suggestion #68689
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
Conversation
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
LL | impl FromIterator<()> for X { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_iter` in implementation | ||
| | ||
= help: implement the missing item: `fn from_iter<T>(_: T) -> Self where T: std::iter::IntoIterator, std::iter::IntoIterator::Item = A { unimplemented!() }` |
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 should be
fn from_iter<T>(_: T) -> Self where T: std::iter::IntoIterator<Item = A> { unimplemented!() }
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.
Filed #68982 to track this
cc @rust-lang/compiler in order for this suggestion to be accurate we would need a way to resugar |
@estebank There's some code like that in |
Definitely.
It's categorically not a good idea, but we might need to do it anyways. |
For reference for future me, |
…ructured suggestion
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 after fixing the comment.
cb4c7cd
to
3cdd7ae
Compare
@bors r=varkor |
📌 Commit 3cdd7ae has been approved by |
When suggesting associated fn with type parameters, include in the structured suggestion Address #50734. ``` error[E0046]: not all trait items implemented, missing: `foo`, `bar`, `baz` --> file.rs:14:1 | 14 | impl TraitA<()> for S { | ^^^^^^^^^^^^^^^^^^^^^ missing `foo`, `bar`, `baz` in implementation | = help: implement the missing item: `fn foo<T>(_: T) -> Self where T: TraitB, TraitB::Item = A { unimplemented!() }` = help: implement the missing item: `fn bar<T>(_: T) -> Self { unimplemented!() }` = help: implement the missing item: `fn baz<T>(_: T) -> Self where T: TraitB, <T as TraitB>::Item: std::marker::Copy { unimplemented!() }` ``` It doesn't work well for associated types with `ty::Predicate::Projection`s as we need to resugar `T: Trait, Trait::Assoc = K` → `T: Trait<Assoc = K>`.
☀️ Test successful - checks-azure |
Address #50734.
It doesn't work well for associated types with
ty::Predicate::Projection
s as we need to resugarT: Trait, Trait::Assoc = K
→T: Trait<Assoc = K>
.