diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2020-02-24 18:55:51 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2020-02-28 11:37:59 -0800 |
| commit | c764a82310fe5dcec5586d5a6afb87a8a29f62c0 (patch) | |
| tree | c681e1a4e5a6effcb87a3fe3e7c7bbdbfbfd5e54 | |
| parent | 7c29441ef2efcd47512402d5558b41a235648841 (diff) | |
| download | rust-c764a82310fe5dcec5586d5a6afb87a8a29f62c0.tar.gz rust-c764a82310fe5dcec5586d5a6afb87a8a29f62c0.zip | |
keep predicate order and tweak output
19 files changed, 129 insertions, 79 deletions
diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 9fcb1c75fae..f9b5ff8e2ab 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -644,7 +644,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }, }) }) - .collect::<Vec<String>>(); + .enumerate() + .collect::<Vec<(usize, String)>>(); for ((span, empty_where), obligations) in type_params.into_iter() { err.span_suggestion_verbose( span, @@ -662,15 +663,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); } - bound_list.sort(); - bound_list.dedup(); // #35677 + bound_list.sort_by(|(_, a), (_, b)| a.cmp(&b)); // Sort alphabetically. + bound_list.dedup_by(|(_, a), (_, b)| a == b); // #35677 + bound_list.sort_by_key(|(pos, _)| *pos); // Keep the original predicate order. bound_spans.sort(); bound_spans.dedup(); for (span, msg) in bound_spans.into_iter() { err.span_label(span, &msg); } if !bound_list.is_empty() { - let bound_list = bound_list.join("\n"); + let bound_list = bound_list + .into_iter() + .map(|(_, path)| path) + .collect::<Vec<_>>() + .join("\n"); err.note(&format!( "the method `{}` exists but the following trait bounds were not \ satisfied:\n{}", @@ -1095,7 +1101,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let mut use_note = true; if let [trait_info] = &candidates[..] { if let Some(span) = self.tcx.hir().span_if_local(trait_info.def_id) { - err.span_label( + err.span_note( self.tcx.sess.source_map().def_span(span), &format!( "`{}` defines an item `{}`, perhaps you need to {} it", diff --git a/src/test/ui/associated-const/associated-const-no-item.stderr b/src/test/ui/associated-const/associated-const-no-item.stderr index c3339e453e8..fe27da5ac64 100644 --- a/src/test/ui/associated-const/associated-const-no-item.stderr +++ b/src/test/ui/associated-const/associated-const-no-item.stderr @@ -1,13 +1,15 @@ error[E0599]: no associated item named `ID` found for type `i32` in the current scope --> $DIR/associated-const-no-item.rs:5:23 | -LL | trait Foo { - | --------- `Foo` defines an item `ID`, perhaps you need to implement it -... LL | const X: i32 = <i32>::ID; | ^^ associated item not found in `i32` | = help: items from traits can only be used if the trait is implemented and in scope +note: `Foo` defines an item `ID`, perhaps you need to implement it + --> $DIR/associated-const-no-item.rs:1:1 + | +LL | trait Foo { + | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/auto-ref-slice-plus-ref.stderr b/src/test/ui/auto-ref-slice-plus-ref.stderr index 3500cef6c39..50ca5cad4bc 100644 --- a/src/test/ui/auto-ref-slice-plus-ref.stderr +++ b/src/test/ui/auto-ref-slice-plus-ref.stderr @@ -3,44 +3,52 @@ error[E0599]: no method named `test_mut` found for struct `std::vec::Vec<{intege | LL | a.test_mut(); | ^^^^^^^^ help: there is a method with a similar name: `get_mut` -... -LL | trait MyIter { - | ------------ `MyIter` defines an item `test_mut`, perhaps you need to implement it | = help: items from traits can only be used if the trait is implemented and in scope +note: `MyIter` defines an item `test_mut`, perhaps you need to implement it + --> $DIR/auto-ref-slice-plus-ref.rs:14:1 + | +LL | trait MyIter { + | ^^^^^^^^^^^^ error[E0599]: no method named `test` found for struct `std::vec::Vec<{integer}>` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:8:7 | LL | a.test(); | ^^^^ method not found in `std::vec::Vec<{integer}>` -... -LL | trait MyIter { - | ------------ `MyIter` defines an item `test`, perhaps you need to implement it | = help: items from traits can only be used if the trait is implemented and in scope +note: `MyIter` defines an item `test`, perhaps you need to implement it + --> $DIR/auto-ref-slice-plus-ref.rs:14:1 + | +LL | trait MyIter { + | ^^^^^^^^^^^^ error[E0599]: no method named `test` found for array `[{integer}; 1]` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:10:11 | LL | ([1]).test(); | ^^^^ method not found in `[{integer}; 1]` -... -LL | trait MyIter { - | ------------ `MyIter` defines an item `test`, perhaps you need to implement it | = help: items from traits can only be used if the trait is implemented and in scope +note: `MyIter` defines an item `test`, perhaps you need to implement it + --> $DIR/auto-ref-slice-plus-ref.rs:14:1 + | +LL | trait MyIter { + | ^^^^^^^^^^^^ error[E0599]: no method named `test` found for reference `&[{integer}; 1]` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:11:12 | LL | (&[1]).test(); | ^^^^ method not found in `&[{integer}; 1]` -... -LL | trait MyIter { - | ------------ `MyIter` defines an item `test`, perhaps you need to implement it | = help: items from traits can only be used if the trait is implemented and in scope +note: `MyIter` defines an item `test`, perhaps you need to implement it + --> $DIR/auto-ref-slice-plus-ref.rs:14:1 + | +LL | trait MyIter { + | ^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/impl-trait/issues/issue-21659-show-relevant-trait-impls-3.stderr b/src/test/ui/impl-trait/issues/issue-21659-show-relevant-trait-impls-3.stderr index 75a2e9a99a9..64cce056a26 100644 --- a/src/test/ui/impl-trait/issues/issue-21659-show-relevant-trait-impls-3.stderr +++ b/src/test/ui/impl-trait/issues/issue-21659-show-relevant-trait-impls-3.stderr @@ -1,9 +1,6 @@ error[E0599]: no method named `foo` found for struct `Bar` in the current scope --> $DIR/issue-21659-show-relevant-trait-impls-3.rs:20:8 | -LL | trait Foo<A> { - | ------------ `Foo` defines an item `foo`, perhaps you need to implement it -... LL | struct Bar; | ----------- method `foo` not found for this ... @@ -11,6 +8,11 @@ LL | f1.foo(1usize); | ^^^ method not found in `Bar` | = help: items from traits can only be used if the trait is implemented and in scope +note: `Foo` defines an item `foo`, perhaps you need to implement it + --> $DIR/issue-21659-show-relevant-trait-impls-3.rs:1:1 + | +LL | trait Foo<A> { + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/impl-trait/no-method-suggested-traits.stderr b/src/test/ui/impl-trait/no-method-suggested-traits.stderr index c6017a5fea1..c0ca341385d 100644 --- a/src/test/ui/impl-trait/no-method-suggested-traits.stderr +++ b/src/test/ui/impl-trait/no-method-suggested-traits.stderr @@ -122,68 +122,80 @@ LL | std::rc::Rc::new(&mut Box::new(&Foo)).method(); error[E0599]: no method named `method2` found for type `u64` in the current scope --> $DIR/no-method-suggested-traits.rs:45:10 | -LL | pub trait Bar { - | ------------- `foo::Bar` defines an item `method2`, perhaps you need to implement it -... LL | 1u64.method2(); | ^^^^^^^ method not found in `u64` | = help: items from traits can only be used if the trait is implemented and in scope +note: `foo::Bar` defines an item `method2`, perhaps you need to implement it + --> $DIR/no-method-suggested-traits.rs:8:5 + | +LL | pub trait Bar { + | ^^^^^^^^^^^^^ error[E0599]: no method named `method2` found for struct `std::rc::Rc<&mut std::boxed::Box<&u64>>` in the current scope --> $DIR/no-method-suggested-traits.rs:47:44 | -LL | pub trait Bar { - | ------------- `foo::Bar` defines an item `method2`, perhaps you need to implement it -... LL | std::rc::Rc::new(&mut Box::new(&1u64)).method2(); | ^^^^^^^ method not found in `std::rc::Rc<&mut std::boxed::Box<&u64>>` | = help: items from traits can only be used if the trait is implemented and in scope +note: `foo::Bar` defines an item `method2`, perhaps you need to implement it + --> $DIR/no-method-suggested-traits.rs:8:5 + | +LL | pub trait Bar { + | ^^^^^^^^^^^^^ error[E0599]: no method named `method2` found for struct `no_method_suggested_traits::Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:50:37 | -LL | pub trait Bar { - | ------------- `foo::Bar` defines an item `method2`, perhaps you need to implement it -... LL | no_method_suggested_traits::Foo.method2(); | ^^^^^^^ method not found in `no_method_suggested_traits::Foo` | = help: items from traits can only be used if the trait is implemented and in scope +note: `foo::Bar` defines an item `method2`, perhaps you need to implement it + --> $DIR/no-method-suggested-traits.rs:8:5 + | +LL | pub trait Bar { + | ^^^^^^^^^^^^^ error[E0599]: no method named `method2` found for struct `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` in the current scope --> $DIR/no-method-suggested-traits.rs:52:71 | -LL | pub trait Bar { - | ------------- `foo::Bar` defines an item `method2`, perhaps you need to implement it -... LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2(); | ^^^^^^^ method not found in `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Foo>>` | = help: items from traits can only be used if the trait is implemented and in scope +note: `foo::Bar` defines an item `method2`, perhaps you need to implement it + --> $DIR/no-method-suggested-traits.rs:8:5 + | +LL | pub trait Bar { + | ^^^^^^^^^^^^^ error[E0599]: no method named `method2` found for enum `no_method_suggested_traits::Bar` in the current scope --> $DIR/no-method-suggested-traits.rs:54:40 | -LL | pub trait Bar { - | ------------- `foo::Bar` defines an item `method2`, perhaps you need to implement it -... LL | no_method_suggested_traits::Bar::X.method2(); | ^^^^^^^ method not found in `no_method_suggested_traits::Bar` | = help: items from traits can only be used if the trait is implemented and in scope +note: `foo::Bar` defines an item `method2`, perhaps you need to implement it + --> $DIR/no-method-suggested-traits.rs:8:5 + | +LL | pub trait Bar { + | ^^^^^^^^^^^^^ error[E0599]: no method named `method2` found for struct `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` in the current scope --> $DIR/no-method-suggested-traits.rs:56:74 | -LL | pub trait Bar { - | ------------- `foo::Bar` defines an item `method2`, perhaps you need to implement it -... LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2(); | ^^^^^^^ method not found in `std::rc::Rc<&mut std::boxed::Box<&no_method_suggested_traits::Bar>>` | = help: items from traits can only be used if the trait is implemented and in scope +note: `foo::Bar` defines an item `method2`, perhaps you need to implement it + --> $DIR/no-method-suggested-traits.rs:8:5 + | +LL | pub trait Bar { + | ^^^^^^^^^^^^^ error[E0599]: no method named `method3` found for struct `Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:59:9 diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr index 63359be56bf..5db521536a8 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref.stderr @@ -5,8 +5,8 @@ LL | let _result = &Some(42).as_deref(); | ^^^^^^^^ help: there is a method with a similar name: `as_ref` | = note: the method `as_deref` exists but the following trait bounds were not satisfied: - `<{integer} as std::ops::Deref>::Target = _` `{integer}: std::ops::Deref` + `<{integer} as std::ops::Deref>::Target = _` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr index b01b3448e17..f2133c8c84d 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option-as_deref_mut.stderr @@ -5,8 +5,8 @@ LL | let _result = &mut Some(42).as_deref_mut(); | ^^^^^^^^^^^^ method not found in `std::option::Option<{integer}>` | = note: the method `as_deref_mut` exists but the following trait bounds were not satisfied: - `<{integer} as std::ops::Deref>::Target = _` `{integer}: std::ops::DerefMut` + `<{integer} as std::ops::Deref>::Target = _` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr index 75482841987..2dfc6d53750 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref.stderr @@ -5,8 +5,8 @@ LL | let _result = &Ok(42).as_deref(); | ^^^^^^^^ help: there is a method with a similar name: `as_ref` | = note: the method `as_deref` exists but the following trait bounds were not satisfied: - `<{integer} as std::ops::Deref>::Target = _` `{integer}: std::ops::Deref` + `<{integer} as std::ops::Deref>::Target = _` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr index cf31bc4b56b..1d65c57e5e9 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_err.stderr @@ -5,8 +5,8 @@ LL | let _result = &Err(41).as_deref_err(); | ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut` | = note: the method `as_deref_err` exists but the following trait bounds were not satisfied: - `<{integer} as std::ops::Deref>::Target = _` `{integer}: std::ops::Deref` + `<{integer} as std::ops::Deref>::Target = _` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr index 586b3555455..2f4bf0c94b5 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut.stderr @@ -5,8 +5,8 @@ LL | let _result = &mut Ok(42).as_deref_mut(); | ^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_err` | = note: the method `as_deref_mut` exists but the following trait bounds were not satisfied: - `<{integer} as std::ops::Deref>::Target = _` `{integer}: std::ops::DerefMut` + `<{integer} as std::ops::Deref>::Target = _` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr index fd0e43d7dbc..b76d36c804e 100644 --- a/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr +++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result-as_deref_mut_err.stderr @@ -5,8 +5,8 @@ LL | let _result = &mut Err(41).as_deref_mut_err(); | ^^^^^^^^^^^^^^^^ help: there is a method with a similar name: `as_deref_mut` | = note: the method `as_deref_mut_err` exists but the following trait bounds were not satisfied: - `<{integer} as std::ops::Deref>::Target = _` `{integer}: std::ops::DerefMut` + `<{integer} as std::ops::Deref>::Target = _` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-57362-1.stderr b/src/test/ui/issues/issue-57362-1.stderr index c48f51e2b2a..5c611cd43d3 100644 --- a/src/test/ui/issues/issue-57362-1.stderr +++ b/src/test/ui/issues/issue-57362-1.stderr @@ -1,14 +1,16 @@ error[E0599]: no method named `f` found for fn pointer `fn(&u8)` in the current scope --> $DIR/issue-57362-1.rs:20:7 | -LL | trait Trait { - | ----------- `Trait` defines an item `f`, perhaps you need to implement it -... LL | a.f(); | ^ method not found in `fn(&u8)` | = note: `a` is a function, perhaps you wish to call it = help: items from traits can only be used if the trait is implemented and in scope +note: `Trait` defines an item `f`, perhaps you need to implement it + --> $DIR/issue-57362-1.rs:8:1 + | +LL | trait Trait { + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-57362-2.stderr b/src/test/ui/issues/issue-57362-2.stderr index b3b30dbd1c8..2edc0097464 100644 --- a/src/test/ui/issues/issue-57362-2.stderr +++ b/src/test/ui/issues/issue-57362-2.stderr @@ -1,13 +1,15 @@ error[E0599]: no function or associated item named `make_g` found for fn pointer `for<'r> fn(&'r ())` in the current scope --> $DIR/issue-57362-2.rs:22:25 | -LL | trait X { - | ------- `X` defines an item `make_g`, perhaps you need to implement it -... LL | let x = <fn (&())>::make_g(); | ^^^^^^ function or associated item not found in `for<'r> fn(&'r ())` | = help: items from traits can only be used if the trait is implemented and in scope +note: `X` defines an item `make_g`, perhaps you need to implement it + --> $DIR/issue-57362-2.rs:8:1 + | +LL | trait X { + | ^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/never_type/issue-2149.stderr b/src/test/ui/never_type/issue-2149.stderr index 74512619966..3cdd6372ec1 100644 --- a/src/test/ui/never_type/issue-2149.stderr +++ b/src/test/ui/never_type/issue-2149.stderr @@ -9,13 +9,15 @@ LL | for elt in self { r = r + f(*elt); } error[E0599]: no method named `bind` found for array `[&str; 1]` in the current scope --> $DIR/issue-2149.rs:13:12 | -LL | trait VecMonad<A> { - | ----------------- `VecMonad` defines an item `bind`, perhaps you need to implement it -... LL | ["hi"].bind(|x| [x] ); | ^^^^ method not found in `[&str; 1]` | = help: items from traits can only be used if the trait is implemented and in scope +note: `VecMonad` defines an item `bind`, perhaps you need to implement it + --> $DIR/issue-2149.rs:1:1 + | +LL | trait VecMonad<A> { + | ^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr index f4d29e61cc1..a55d79ee035 100644 --- a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr +++ b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr @@ -1,9 +1,6 @@ error[E0599]: no method named `foo_one` found for struct `MyStruct` in the current scope --> $DIR/specialization-trait-not-implemented.rs:22:29 | -LL | trait Foo { - | --------- `Foo` defines an item `foo_one`, perhaps you need to implement it -... LL | struct MyStruct; | ---------------- | | @@ -16,6 +13,11 @@ LL | println!("{}", MyStruct.foo_one()); = note: the method `foo_one` exists but the following trait bounds were not satisfied: `MyStruct: Foo` = help: items from traits can only be used if the trait is implemented and in scope +note: `Foo` defines an item `foo_one`, perhaps you need to implement it + --> $DIR/specialization-trait-not-implemented.rs:7:1 + | +LL | trait Foo { + | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr b/src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr index 4f6620b47c2..1692af351f9 100644 --- a/src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr +++ b/src/test/ui/suggestions/missing-trait-bounds-for-method-call.stderr @@ -4,9 +4,6 @@ error[E0599]: no method named `foo` found for reference `&Foo<T>` in the current LL | struct Foo<T> { | ------------- doesn't satisfy `Foo<T>: Bar` ... -LL | trait Bar { - | --------- `Bar` defines an item `foo`, perhaps you need to implement it -... LL | self.foo(); | ^^^ method not found in `&Foo<T>` | @@ -16,6 +13,11 @@ LL | self.foo(); `T: std::default::Default` which is required by `Foo<T>: Bar` = help: items from traits can only be used if the trait is implemented and in scope +note: `Bar` defines an item `foo`, perhaps you need to implement it + --> $DIR/missing-trait-bounds-for-method-call.rs:6:1 + | +LL | trait Bar { + | ^^^^^^^^^ help: consider restricting the type parameters to satisfy the obligations | LL | struct Foo<T> where T: Bar, T: std::default::Default { @@ -24,9 +26,6 @@ LL | struct Foo<T> where T: Bar, T: std::default::Default { error[E0599]: no method named `foo` found for reference `&Fin<T>` in the current scope --> $DIR/missing-trait-bounds-for-method-call.rs:27:14 | -LL | trait Bar { - | --------- `Bar` defines an item `foo`, perhaps you need to implement it -... LL | struct Fin<T> where T: Bar { | -------------------------- doesn't satisfy `Fin<T>: Bar` ... @@ -37,6 +36,11 @@ LL | self.foo(); `T: std::default::Default` which is required by `Fin<T>: Bar` = help: items from traits can only be used if the trait is implemented and in scope +note: `Bar` defines an item `foo`, perhaps you need to implement it + --> $DIR/missing-trait-bounds-for-method-call.rs:6:1 + | +LL | trait Bar { + | ^^^^^^^^^ help: consider restricting the type parameter to satisfy the obligation | LL | struct Fin<T> where T: Bar, T: std::default::Default { diff --git a/src/test/ui/traits/trait-item-privacy.stderr b/src/test/ui/traits/trait-item-privacy.stderr index f893456a17c..2c0591c95f6 100644 --- a/src/test/ui/traits/trait-item-privacy.stderr +++ b/src/test/ui/traits/trait-item-privacy.stderr @@ -4,13 +4,15 @@ error[E0599]: no method named `a` found for struct `S` in the current scope LL | struct S; | --------- method `a` not found for this ... -LL | trait A { - | ------- `method::A` defines an item `a`, perhaps you need to implement it -... LL | S.a(); | ^ method not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope +note: `method::A` defines an item `a`, perhaps you need to implement it + --> $DIR/trait-item-privacy.rs:6:5 + | +LL | trait A { + | ^^^^^^^ error[E0599]: no method named `b` found for struct `S` in the current scope --> $DIR/trait-item-privacy.rs:68:7 @@ -46,13 +48,15 @@ error[E0599]: no function or associated item named `a` found for struct `S` in t LL | struct S; | --------- function or associated item `a` not found for this ... -LL | trait A { - | ------- `method::A` defines an item `a`, perhaps you need to implement it -... LL | S::a(&S); | ^ function or associated item not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope +note: `method::A` defines an item `a`, perhaps you need to implement it + --> $DIR/trait-item-privacy.rs:6:5 + | +LL | trait A { + | ^^^^^^^ error[E0599]: no function or associated item named `b` found for struct `S` in the current scope --> $DIR/trait-item-privacy.rs:80:8 @@ -81,13 +85,15 @@ error[E0599]: no associated item named `A` found for struct `S` in the current s LL | struct S; | --------- associated item `A` not found for this ... -LL | trait A { - | ------- `assoc_const::A` defines an item `A`, perhaps you need to implement it -... LL | S::A; | ^ associated item not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope +note: `assoc_const::A` defines an item `A`, perhaps you need to implement it + --> $DIR/trait-item-privacy.rs:24:5 + | +LL | trait A { + | ^^^^^^^ error[E0599]: no associated item named `B` found for struct `S` in the current scope --> $DIR/trait-item-privacy.rs:98:8 diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr index ef41c0e5fa0..4e153081d9f 100644 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr +++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr @@ -11,13 +11,15 @@ LL | fn cant_return_str() -> str { error[E0599]: no method named `test` found for type `i32` in the current scope --> $DIR/trivial-bounds-leak.rs:24:10 | -LL | pub trait Foo { - | ------------- `Foo` defines an item `test`, perhaps you need to implement it -... LL | 3i32.test(); | ^^^^ method not found in `i32` | = help: items from traits can only be used if the trait is implemented and in scope +note: `Foo` defines an item `test`, perhaps you need to implement it + --> $DIR/trivial-bounds-leak.rs:4:1 + | +LL | pub trait Foo { + | ^^^^^^^^^^^^^ error[E0277]: the trait bound `i32: Foo` is not satisfied --> $DIR/trivial-bounds-leak.rs:25:15 diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr index 6a0a6c87079..1c5fed2c33b 100644 --- a/src/test/ui/unique-object-noncopyable.stderr +++ b/src/test/ui/unique-object-noncopyable.stderr @@ -16,10 +16,10 @@ LL | pub struct Box<T: ?Sized>(Unique<T>); | ------------------------------------- doesn't satisfy `std::boxed::Box<dyn Foo>: std::clone::Clone` | = note: the method `clone` exists but the following trait bounds were not satisfied: - `dyn Foo: std::clone::Clone` - which is required by `std::boxed::Box<dyn Foo>: std::clone::Clone` `dyn Foo: std::marker::Sized` 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` |
