When suggesting associated fn with type parameters, include in the structured suggestion#68689
Conversation
|
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
This should be
fn from_iter<T>(_: T) -> Self where T: std::iter::IntoIterator<Item = A> { unimplemented!() }
|
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
varkor
left a comment
There was a problem hiding this comment.
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::Projections as we need to resugarT: Trait, Trait::Assoc = K→T: Trait<Assoc = K>.