-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Consider:
use std::iter::FromIterator;
struct X;
impl FromIterator<()> for X {
}
which causes the following error on stable and nightly:
error[E0046]: not all trait items implemented, missing: `from_iter`
--> src/main.rs:3:1
|
3 | impl FromIterator<()> for X {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `from_iter` in implementation
|
= note: `from_iter` from trait: `fn(T) -> Self`
It would be super helpful to print the other relevant bounds for this method:
pub trait FromIterator<A> {
fn from_iter<T>(iter: T) -> Self
where
T: IntoIterator<Item = A>;
}
Just trying to add a partial definition fn from_iter<I>(i: I) -> Self { Self }
will be accepted without any bound on I
. Of course you can't really do anything with it yet. Thus it would be pleasant to remind the user what bound they probably need.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
estebank commentedon Jan 30, 2020
Current output, no real change other than using a copy/paste-able signature:
estebank commentedon Jan 31, 2020
The output from #68689 is not perfect because it uses incorrect syntax, but gets us closer to the correct output:
Auto merge of #68689 - estebank:where-clause-sugg-missing-fn, r=varkor
estebank commentedon Oct 17, 2023
Current output: