item_name,
source,
out_of_scope_traits,
+ &unsatisfied_predicates,
);
}
item_name: ast::Ident,
source: SelfSource<'b>,
valid_out_of_scope_traits: Vec<DefId>,
+ unsatisfied_predicates: &[(ty::Predicate<'tcx>, Option<ty::Predicate<'tcx>>)],
) {
if self.suggest_valid_traits(err, valid_out_of_scope_traits) {
return;
// this isn't perfect (that is, there are cases when
// implementing a trait would be legal but is rejected
// here).
- (type_is_local || info.def_id.is_local())
+ !unsatisfied_predicates.iter().any(|(p, _)| match p {
+ // Hide traits if they are present in predicates as they can be fixed without
+ // having to implement them.
+ ty::Predicate::Trait(t, _) => t.def_id() != info.def_id,
+ ty::Predicate::Projection(p) => p.item_def_id() != info.def_id,
+ _ => true,
+ }) && (type_is_local || info.def_id.is_local())
&& self
.associated_item(info.def_id, item_name, Namespace::ValueNS)
.filter(|item| {
`Foo: std::iter::Iterator`
which is required by `&mut Foo: std::iter::Iterator`
= help: items from traits can only be used if the trait is implemented and in scope
- = note: the following traits define an item `take`, perhaps you need to implement one of them:
- candidate #1: `std::io::Read`
- candidate #2: `std::iter::Iterator`
+ = note: the following trait defines an item `take`, perhaps you need to implement it:
+ candidate #1: `std::iter::Iterator`
error[E0061]: this function takes 3 arguments but 0 arguments were supplied
--> $DIR/method-call-err-msg.rs:21:7
= note: the method `clone` exists but the following trait bounds were not satisfied:
`CloneNoCopy: std::marker::Copy`
which is required by `U5<CloneNoCopy>: std::clone::Clone`
- = help: items from traits can only be used if the trait is implemented and in scope
- = note: the following trait defines an item `clone`, perhaps you need to implement it:
- candidate #1: `std::clone::Clone`
error: aborting due to 2 previous errors
which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone`
`dyn Foo: std::clone::Clone`
which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone`
- = help: items from traits can only be used if the trait is implemented and in scope
- = note: the following trait defines an item `clone`, perhaps you need to implement it:
- candidate #1: `std::clone::Clone`
error: aborting due to previous error