Change:
} } <del> fn suggest_traits_to_import<'b>(&self, err: &mut DiagnosticBuilder<'_>, span: Span, rcvr_ty: Ty<'tcx>, item_name: ast::Ident, source: SelfSource<'b>, valid_out_of_scope_traits: Vec<DefId>) { </del> <ins> fn suggest_traits_to_import<'b>( &self, err: &mut DiagnosticBuilder<'_>, span: Span, rcvr_ty: Ty<'tcx>, item_name: ast::Ident, source: SelfSource<'b>, valid_out_of_scope_traits: Vec<DefId>, ) { </ins> if self.suggest_valid_traits(err, valid_out_of_scope_traits) { return; }

Discussion:
I am working through this and is with such a challenge: So I tried it. : note: the method exists but the following trait bounds were not satisfied: help: items from traits can only be used if the trait is implemented and in scope; the following traits define an item , perhaps you need to implement one of them: help: candidate : help: candidate : help: candidate : The minimal code that produces the error message is The error message tells me that I need to implement a trait. Since I have already implemented it, I would be confused by the error message, and misled by it from the actual reason, failure to declare it in the signature. I think it would be better if the message is changed to note: the method exists but the following trait bounds were not satisfied: help: items from traits can only be used if the trait is implemented and in scope; the following traits define an item , perhaps you need to declare one of them for : help: candidate : help: candidate : help: candidate : On the other hand, if I actually drop the block , but declare in the signature, the error message is label: the trait is not implemented for note: required by which is straightforward enough.
Today, we suggest that the method exists, but we somehow fail to see that it exists on Minimum in the first note and then latter note it in the second note.
It still doesn't help a lot IMO... since the problem is the bound isn't declared in the signature, and nothing regarding declaration is mentioned. maybe change to
I think that can be easily fixed by checking if is not empty and using a different message in that case Do you have suggestion how the error should look like? Does that sound ok?
I don't think your error message communicates much more than the current one. I also think the error message is already straightforward enough. From my perspective, I think the problem is one of asymmetry in the help section. It mentioned "items from traits can only be used if the trait is implemented and in scope", but then went on to only suggest "perhaps you need to implement one of them". Excuse me for being insistent on this, but I believe the best way is to remind that to bring function into scope the trait bound needs to be declared as well as implemented.
LOL this is actually a duplicate of . There's even a .

I think we're talking about different cases (which may be another reason to split or reword the message). For methods the message says "method not found", but adds a note saying "the method exists", which I really don't like, because it's very easy to miss the nuance and interpret the message as nonsense "the method does not exist" "but it exists". I've explained more here:
With the output will be: