-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait system
Description
E.g.
fn main() {
1us.is_empty();
}
<anon>:2:9: 2:19 error: type `usize` does not implement any method in scope named `is_empty`
<anon>:2 1us.is_empty();
^~~~~~~~~~
<anon>:2:19: 2:19 help: methods from traits can only be called if the trait is implemented and in scope; the following traits define a method `is_empty`, perhaps you need to implement one of them:
<anon>:2:19: 2:19 help: candidate #1: `core::slice::SliceExt`
<anon>:2:19: 2:19 help: candidate #2: `core::slice::SliceExt`
<anon>:2:19: 2:19 help: candidate #3: `core::str::StrExt`
<anon>:2:19: 2:19 help: candidate #4: `core::str::StrExt`
<anon>:2:19: 2:19 help: candidate #5: `collections::slice::SliceExt`
<anon>:2:19: 2:19 help: candidate #6: `collections::slice::SliceExt`
<anon>:2:19: 2:19 help: candidate #7: `collections::slice::SliceExt`
<anon>:2:19: 2:19 help: candidate #8: `collections::str::StrExt`
<anon>:2:19: 2:19 help: candidate #9: `collections::str::StrExt`
<anon>:2:19: 2:19 help: candidate #10: `collections::str::StrExt`
(The repetition is #21405.)
However, all of these are useless: because one cannot implement them for usize
anyway, it would be better to just filter them out, e.g. reject external traits when the self type itself is external.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemArea: Trait system