diff options
Diffstat (limited to 'tests')
51 files changed, 452 insertions, 126 deletions
diff --git a/tests/ui/associated-item/associated-item-enum.stderr b/tests/ui/associated-item/associated-item-enum.stderr index ebf3c5499a6..3b00588f1d1 100644 --- a/tests/ui/associated-item/associated-item-enum.stderr +++ b/tests/ui/associated-item/associated-item-enum.stderr @@ -5,10 +5,12 @@ LL | enum Enum { Variant } | --------- variant or associated item `mispellable` not found for this enum ... LL | Enum::mispellable(); - | ^^^^^^^^^^^ - | | - | variant or associated item not found in `Enum` - | help: there is an associated function with a similar name: `misspellable` + | ^^^^^^^^^^^ variant or associated item not found in `Enum` + | +help: there is an associated function `misspellable` with a similar name + | +LL | Enum::misspellable(); + | ~~~~~~~~~~~~ error[E0599]: no variant or associated item named `mispellable_trait` found for enum `Enum` in the current scope --> $DIR/associated-item-enum.rs:18:11 @@ -17,10 +19,12 @@ LL | enum Enum { Variant } | --------- variant or associated item `mispellable_trait` not found for this enum ... LL | Enum::mispellable_trait(); - | ^^^^^^^^^^^^^^^^^ - | | - | variant or associated item not found in `Enum` - | help: there is an associated function with a similar name: `misspellable` + | ^^^^^^^^^^^^^^^^^ variant or associated item not found in `Enum` + | +help: there is an associated function `misspellable_trait` with a similar name + | +LL | Enum::misspellable_trait(); + | ~~~~~~~~~~~~~~~~~~ error[E0599]: no variant or associated item named `MISPELLABLE` found for enum `Enum` in the current scope --> $DIR/associated-item-enum.rs:19:11 @@ -29,10 +33,12 @@ LL | enum Enum { Variant } | --------- variant or associated item `MISPELLABLE` not found for this enum ... LL | Enum::MISPELLABLE; - | ^^^^^^^^^^^ - | | - | variant or associated item not found in `Enum` - | help: there is an associated constant with a similar name: `MISSPELLABLE` + | ^^^^^^^^^^^ variant or associated item not found in `Enum` + | +help: there is an associated constant `MISSPELLABLE` with a similar name + | +LL | Enum::MISSPELLABLE; + | ~~~~~~~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr index b7336485eb8..3d82f572a1a 100644 --- a/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr +++ b/tests/ui/async-await/in-trait/dont-project-to-specializable-projection.stderr @@ -30,7 +30,7 @@ LL | match fut.as_mut().poll(ctx) { = note: the method is available for `Pin<&mut impl Future<Output = ()>>` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Future` which provides `poll` is implemented but not in scope; perhaps you want to import it | LL + use std::future::Future; | diff --git a/tests/ui/atomic-from-mut-not-available.stderr b/tests/ui/atomic-from-mut-not-available.stderr index a3edf189356..a4514524f48 100644 --- a/tests/ui/atomic-from-mut-not-available.stderr +++ b/tests/ui/atomic-from-mut-not-available.stderr @@ -7,6 +7,10 @@ LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64); note: if you're trying to build a new `AtomicU64`, consider using `AtomicU64::new` which returns `AtomicU64` --> $SRC_DIR/core/src/sync/atomic.rs:LL:COL = note: this error originates in the macro `atomic_int` (in Nightly builds, run with -Z macro-backtrace for more info) +help: there is an associated function `from` with a similar name + | +LL | core::sync::atomic::AtomicU64::from(&mut 0u64); + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/attributes/rustc_confusables.rs b/tests/ui/attributes/rustc_confusables.rs index a88432ead75..93d9a7d572c 100644 --- a/tests/ui/attributes/rustc_confusables.rs +++ b/tests/ui/attributes/rustc_confusables.rs @@ -11,7 +11,7 @@ fn main() { let x = BTreeSet {}; x.inser(); //~^ ERROR no method named - //~| HELP there is a method with a similar name + //~| HELP there is a method `insert` with a similar name x.foo(); //~^ ERROR no method named x.push(); @@ -21,7 +21,7 @@ fn main() { //~^ ERROR no method named x.pulled(); //~^ ERROR no method named - //~| HELP there is a method with a similar name + //~| HELP you might have meant to use `pull` } struct Bar; diff --git a/tests/ui/attributes/rustc_confusables.stderr b/tests/ui/attributes/rustc_confusables.stderr index 9fd4470cdbb..9e37d5f5083 100644 --- a/tests/ui/attributes/rustc_confusables.stderr +++ b/tests/ui/attributes/rustc_confusables.stderr @@ -31,7 +31,12 @@ error[E0599]: no method named `inser` found for struct `rustc_confusables_across --> $DIR/rustc_confusables.rs:12:7 | LL | x.inser(); - | ^^^^^ help: there is a method with a similar name: `insert` + | ^^^^^ + | +help: there is a method `insert` with a similar name + | +LL | x.insert(); + | ~~~~~~ error[E0599]: no method named `foo` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope --> $DIR/rustc_confusables.rs:15:7 @@ -60,7 +65,12 @@ error[E0599]: no method named `pulled` found for struct `rustc_confusables_acros --> $DIR/rustc_confusables.rs:22:7 | LL | x.pulled(); - | ^^^^^^ help: there is a method with a similar name: `pull` + | ^^^^^^ + | +help: you might have meant to use `pull` + | +LL | x.pull(); + | ~~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/attributes/rustc_confusables_std_cases.rs b/tests/ui/attributes/rustc_confusables_std_cases.rs new file mode 100644 index 00000000000..d9121695950 --- /dev/null +++ b/tests/ui/attributes/rustc_confusables_std_cases.rs @@ -0,0 +1,26 @@ +use std::collections::BTreeSet; +use std::collections::VecDeque; + +fn main() { + let mut x = BTreeSet::new(); + x.push(1); //~ ERROR E0599 + //~^ HELP you might have meant to use `insert` + let mut x = Vec::new(); + x.push_back(1); //~ ERROR E0599 + //~^ HELP you might have meant to use `push` + let mut x = VecDeque::new(); + x.push(1); //~ ERROR E0599 + //~^ HELP you might have meant to use `push_back` + let mut x = vec![1, 2, 3]; + x.length(); //~ ERROR E0599 + //~^ HELP you might have meant to use `len` + x.size(); //~ ERROR E0599 + //~^ HELP you might have meant to use `len` + //~| HELP there is a method `resize` with a similar name + x.append(42); //~ ERROR E0308 + //~^ HELP you might have meant to use `push` + String::new().push(""); //~ ERROR E0308 + //~^ HELP you might have meant to use `push_str` + String::new().append(""); //~ ERROR E0599 + //~^ HELP you might have meant to use `push_str` +} diff --git a/tests/ui/attributes/rustc_confusables_std_cases.stderr b/tests/ui/attributes/rustc_confusables_std_cases.stderr new file mode 100644 index 00000000000..45d571f435c --- /dev/null +++ b/tests/ui/attributes/rustc_confusables_std_cases.stderr @@ -0,0 +1,104 @@ +error[E0599]: no method named `push` found for struct `BTreeSet` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:6:7 + | +LL | x.push(1); + | ^^^^ method not found in `BTreeSet<_>` + | +help: you might have meant to use `insert` + | +LL | x.insert(1); + | ~~~~~~ + +error[E0599]: no method named `push_back` found for struct `Vec<_>` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:9:7 + | +LL | x.push_back(1); + | ^^^^^^^^^ method not found in `Vec<_>` + | +help: you might have meant to use `push` + | +LL | x.push(1); + | ~~~~ + +error[E0599]: no method named `push` found for struct `VecDeque` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:12:7 + | +LL | x.push(1); + | ^^^^ method not found in `VecDeque<_>` + | +help: you might have meant to use `push_back` + | +LL | x.push_back(1); + | ~~~~~~~~~ + +error[E0599]: no method named `length` found for struct `Vec<{integer}>` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:15:7 + | +LL | x.length(); + | ^^^^^^ + | +help: you might have meant to use `len` + | +LL | x.len(); + | ~~~ + +error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:17:7 + | +LL | x.size(); + | ^^^^ + | +help: there is a method `resize` with a similar name, but with different arguments + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +help: you might have meant to use `len` + | +LL | x.len(); + | ~~~ + +error[E0308]: mismatched types + --> $DIR/rustc_confusables_std_cases.rs:20:14 + | +LL | x.append(42); + | ------ ^^ expected `&mut Vec<{integer}>`, found integer + | | + | arguments to this method are incorrect + | + = note: expected mutable reference `&mut Vec<{integer}>` + found type `{integer}` +note: method defined here + --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +help: you might have meant to use `push` + | +LL | x.push(42); + | ~~~~ + +error[E0308]: mismatched types + --> $DIR/rustc_confusables_std_cases.rs:22:24 + | +LL | String::new().push(""); + | ---- ^^ expected `char`, found `&str` + | | + | arguments to this method are incorrect + | +note: method defined here + --> $SRC_DIR/alloc/src/string.rs:LL:COL +help: you might have meant to use `push_str` + | +LL | String::new().push_str(""); + | ~~~~~~~~ + +error[E0599]: no method named `append` found for struct `String` in the current scope + --> $DIR/rustc_confusables_std_cases.rs:24:19 + | +LL | String::new().append(""); + | ^^^^^^ method not found in `String` + | +help: you might have meant to use `push_str` + | +LL | String::new().push_str(""); + | ~~~~~~~~ + +error: aborting due to 8 previous errors + +Some errors have detailed explanations: E0308, E0599. +For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/auto-ref-slice-plus-ref.stderr b/tests/ui/auto-ref-slice-plus-ref.stderr index e2883050720..806c1ee064f 100644 --- a/tests/ui/auto-ref-slice-plus-ref.stderr +++ b/tests/ui/auto-ref-slice-plus-ref.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `test_mut` found for struct `Vec<{integer}>` in th --> $DIR/auto-ref-slice-plus-ref.rs:7:7 | LL | a.test_mut(); - | ^^^^^^^^ help: there is a method with a similar name: `get_mut` + | ^^^^^^^^ | = 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 @@ -10,6 +10,8 @@ note: `MyIter` defines an item `test_mut`, perhaps you need to implement it | LL | trait MyIter { | ^^^^^^^^^^^^ +help: there is a method `get_mut` with a similar name, but with different arguments + --> $SRC_DIR/core/src/slice/mod.rs:LL:COL error[E0599]: no method named `test` found for struct `Vec<{integer}>` in the current scope --> $DIR/auto-ref-slice-plus-ref.rs:8:7 diff --git a/tests/ui/block-result/issue-3563.stderr b/tests/ui/block-result/issue-3563.stderr index c473a84413e..22606a52f85 100644 --- a/tests/ui/block-result/issue-3563.stderr +++ b/tests/ui/block-result/issue-3563.stderr @@ -2,7 +2,12 @@ error[E0599]: no method named `b` found for reference `&Self` in the current sco --> $DIR/issue-3563.rs:3:17 | LL | || self.b() - | ^ help: there is a method with a similar name: `a` + | ^ + | +help: there is a method `a` with a similar name + | +LL | || self.a() + | ~ error: aborting due to 1 previous error diff --git a/tests/ui/coherence/coherence_inherent.stderr b/tests/ui/coherence/coherence_inherent.stderr index da8c03847ed..17b49279de7 100644 --- a/tests/ui/coherence/coherence_inherent.stderr +++ b/tests/ui/coherence/coherence_inherent.stderr @@ -5,7 +5,7 @@ LL | s.the_fn(); | ^^^^^^ method not found in `&TheStruct` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `TheTrait` which provides `the_fn` is implemented but not in scope; perhaps you want to import it | LL + use Lib::TheTrait; | diff --git a/tests/ui/coherence/coherence_inherent_cc.stderr b/tests/ui/coherence/coherence_inherent_cc.stderr index d34f6fa213b..b3c1125d63e 100644 --- a/tests/ui/coherence/coherence_inherent_cc.stderr +++ b/tests/ui/coherence/coherence_inherent_cc.stderr @@ -5,7 +5,7 @@ LL | s.the_fn(); | ^^^^^^ method not found in `&TheStruct` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `TheTrait` which provides `the_fn` is implemented but not in scope; perhaps you want to import it | LL + use coherence_inherent_cc_lib::TheTrait; | diff --git a/tests/ui/confuse-field-and-method/issue-33784.stderr b/tests/ui/confuse-field-and-method/issue-33784.stderr index aaf953a66d5..8acd1f8ff1e 100644 --- a/tests/ui/confuse-field-and-method/issue-33784.stderr +++ b/tests/ui/confuse-field-and-method/issue-33784.stderr @@ -8,6 +8,10 @@ help: to call the function stored in `closure`, surround the field access with p | LL | (p.closure)(); | + + +help: there is a method `clone` with a similar name + | +LL | p.clone(); + | ~~~~~ error[E0599]: no method named `fn_ptr` found for reference `&&Obj<{closure@$DIR/issue-33784.rs:25:43: 25:45}>` in the current scope --> $DIR/issue-33784.rs:29:7 diff --git a/tests/ui/hygiene/no_implicit_prelude.stderr b/tests/ui/hygiene/no_implicit_prelude.stderr index 96187b1c501..5de6e3db327 100644 --- a/tests/ui/hygiene/no_implicit_prelude.stderr +++ b/tests/ui/hygiene/no_implicit_prelude.stderr @@ -20,11 +20,13 @@ LL | fn f() { ::bar::m!(); } | ----------- in this macro invocation ... LL | ().clone() - | ^^^^^ method not found in `()` + | ^^^^^ | = help: items from traits can only be used if the trait is in scope +help: there is a method `clone_from` with a similar name, but with different arguments + --> $SRC_DIR/core/src/clone.rs:LL:COL = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info) -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Clone` which provides `clone` is implemented but not in scope; perhaps you want to import it | LL + use std::clone::Clone; | diff --git a/tests/ui/hygiene/trait_items.stderr b/tests/ui/hygiene/trait_items.stderr index 016ee8f71f9..0e276bf69d6 100644 --- a/tests/ui/hygiene/trait_items.stderr +++ b/tests/ui/hygiene/trait_items.stderr @@ -12,7 +12,7 @@ LL | pub macro m() { ().f() } | = help: items from traits can only be used if the trait is in scope = note: this error originates in the macro `::baz::m` (in Nightly builds, run with -Z macro-backtrace for more info) -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `T` which provides `f` is implemented but not in scope; perhaps you want to import it | LL + use foo::T; | diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index 160cc044078..7a4dc366618 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -2,10 +2,10 @@ error[E0599]: no method named `method` found for type `u32` in the current scope --> $DIR/no-method-suggested-traits.rs:23:10 | LL | 1u32.method(); - | ^^^^^^ method not found in `u32` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: +help: the following traits which provide `method` are implemented but not in scope; perhaps you want to import one of them | LL + use foo::Bar; | @@ -15,15 +15,19 @@ LL + use no_method_suggested_traits::foo::PubPub; | LL + use no_method_suggested_traits::qux::PrivPub; | +help: there is a method `method2` with a similar name + | +LL | 1u32.method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:26:44 | LL | std::rc::Rc::new(&mut Box::new(&1u32)).method(); - | ^^^^^^ method not found in `Rc<&mut Box<&u32>>` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: +help: the following traits which provide `method` are implemented but not in scope; perhaps you want to import one of them | LL + use foo::Bar; | @@ -33,6 +37,10 @@ LL + use no_method_suggested_traits::foo::PubPub; | LL + use no_method_suggested_traits::qux::PrivPub; | +help: there is a method `method2` with a similar name + | +LL | std::rc::Rc::new(&mut Box::new(&1u32)).method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for type `char` in the current scope --> $DIR/no-method-suggested-traits.rs:30:9 @@ -41,31 +49,39 @@ LL | fn method(&self) {} | ------ the method is available for `char` here ... LL | 'a'.method(); - | ^^^^^^ method not found in `char` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Bar` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use foo::Bar; | +help: there is a method `method2` with a similar name + | +LL | 'a'.method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope --> $DIR/no-method-suggested-traits.rs:32:43 | LL | std::rc::Rc::new(&mut Box::new(&'a')).method(); - | ^^^^^^ method not found in `Rc<&mut Box<&char>>` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Bar` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use foo::Bar; | +help: there is a method `method2` with a similar name + | +LL | std::rc::Rc::new(&mut Box::new(&'a')).method2(); + | ~~~~~~~ error[E0599]: no method named `method` found for type `i32` in the current scope --> $DIR/no-method-suggested-traits.rs:35:10 | LL | 1i32.method(); - | ^^^^^^ method not found in `i32` + | ^^^^^^ | ::: $DIR/auxiliary/no_method_suggested_traits.rs:8:12 | @@ -73,22 +89,30 @@ LL | fn method(&self) {} | ------ the method is available for `i32` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `PubPub` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use no_method_suggested_traits::foo::PubPub; | +help: there is a method `method3` with a similar name + | +LL | 1i32.method3(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope --> $DIR/no-method-suggested-traits.rs:37:44 | LL | std::rc::Rc::new(&mut Box::new(&1i32)).method(); - | ^^^^^^ method not found in `Rc<&mut Box<&i32>>` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `PubPub` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use no_method_suggested_traits::foo::PubPub; | +help: there is a method `method3` with a similar name + | +LL | std::rc::Rc::new(&mut Box::new(&1i32)).method3(); + | ~~~~~~~ error[E0599]: no method named `method` found for struct `Foo` in the current scope --> $DIR/no-method-suggested-traits.rs:40:9 diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr index f203f4cabc8..c4bdd484fdb 100644 --- a/tests/ui/impl-trait/where-allowed.stderr +++ b/tests/ui/impl-trait/where-allowed.stderr @@ -395,6 +395,8 @@ error[E0599]: no function or associated item named `into_vec` found for slice `[ LL | vec![vec![0; 10], vec![12; 7], vec![8; 3]] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `[_]` | +help: there is an associated function `to_vec` with a similar name + --> $SRC_DIR/alloc/src/slice.rs:LL:COL = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0053]: method `in_trait_impl_return` has an incompatible type for trait diff --git a/tests/ui/imports/overlapping_pub_trait.rs b/tests/ui/imports/overlapping_pub_trait.rs index cde9f7d8edb..9a56b96adbf 100644 --- a/tests/ui/imports/overlapping_pub_trait.rs +++ b/tests/ui/imports/overlapping_pub_trait.rs @@ -4,7 +4,7 @@ * This crate declares two public paths, `m::Tr` and `prelude::_`. Make sure we prefer the former. */ extern crate overlapping_pub_trait_source; -//~^ HELP the following trait is implemented but not in scope; perhaps add a `use` for it: +//~^ HELP trait `Tr` which provides `method` is implemented but not in scope; perhaps you want to import it //~| SUGGESTION overlapping_pub_trait_source::m::Tr fn main() { diff --git a/tests/ui/imports/overlapping_pub_trait.stderr b/tests/ui/imports/overlapping_pub_trait.stderr index a82a4101ce0..51a8bec85b7 100644 --- a/tests/ui/imports/overlapping_pub_trait.stderr +++ b/tests/ui/imports/overlapping_pub_trait.stderr @@ -10,7 +10,7 @@ LL | pub trait Tr { fn method(&self); } | ------ the method is available for `S` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Tr` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use overlapping_pub_trait_source::m::Tr; | diff --git a/tests/ui/imports/unnamed_pub_trait.rs b/tests/ui/imports/unnamed_pub_trait.rs index 09a01643c5e..1527dfef147 100644 --- a/tests/ui/imports/unnamed_pub_trait.rs +++ b/tests/ui/imports/unnamed_pub_trait.rs @@ -5,7 +5,7 @@ * importing it by name, and instead we suggest importing it by glob. */ extern crate unnamed_pub_trait_source; -//~^ HELP the following trait is implemented but not in scope; perhaps add a `use` for it: +//~^ HELP trait `Tr` which provides `method` is implemented but not in scope; perhaps you want to import it //~| SUGGESTION unnamed_pub_trait_source::prelude::*; // trait Tr fn main() { diff --git a/tests/ui/imports/unnamed_pub_trait.stderr b/tests/ui/imports/unnamed_pub_trait.stderr index 41772b8e694..7d6b7742981 100644 --- a/tests/ui/imports/unnamed_pub_trait.stderr +++ b/tests/ui/imports/unnamed_pub_trait.stderr @@ -10,7 +10,7 @@ LL | pub trait Tr { fn method(&self); } | ------ the method is available for `S` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Tr` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use unnamed_pub_trait_source::prelude::*; // trait Tr | diff --git a/tests/ui/issues/issue-10465.stderr b/tests/ui/issues/issue-10465.stderr index c6bc0786af1..0f46ebe505a 100644 --- a/tests/ui/issues/issue-10465.stderr +++ b/tests/ui/issues/issue-10465.stderr @@ -5,7 +5,7 @@ LL | b.foo(); | ^^^ method not found in `&B` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `A` which provides `foo` is implemented but not in scope; perhaps you want to import it | LL + use a::A; | diff --git a/tests/ui/issues/issue-28344.stderr b/tests/ui/issues/issue-28344.stderr index 8b427b692a7..ddc1027c16b 100644 --- a/tests/ui/issues/issue-28344.stderr +++ b/tests/ui/issues/issue-28344.stderr @@ -22,10 +22,10 @@ error[E0599]: no function or associated item named `bitor` found for trait objec --> $DIR/issue-28344.rs:4:25 | LL | let x: u8 = BitXor::bitor(0 as u8, 0 as u8); - | ^^^^^ - | | - | function or associated item not found in `dyn BitXor<_>` - | help: there is a method with a similar name: `bitxor` + | ^^^^^ function or associated item not found in `dyn BitXor<_>` + | +help: there is a method `bitxor` with a similar name, but with different arguments + --> $SRC_DIR/core/src/ops/bit.rs:LL:COL warning: trait objects without an explicit `dyn` are deprecated --> $DIR/issue-28344.rs:10:13 @@ -50,10 +50,10 @@ error[E0599]: no function or associated item named `bitor` found for trait objec --> $DIR/issue-28344.rs:10:21 | LL | let g = BitXor::bitor; - | ^^^^^ - | | - | function or associated item not found in `dyn BitXor<_>` - | help: there is a method with a similar name: `bitxor` + | ^^^^^ function or associated item not found in `dyn BitXor<_>` + | +help: there is a method `bitxor` with a similar name, but with different arguments + --> $SRC_DIR/core/src/ops/bit.rs:LL:COL error: aborting due to 4 previous errors; 2 warnings emitted diff --git a/tests/ui/issues/issue-39175.stderr b/tests/ui/issues/issue-39175.stderr index 1bc11dab327..bbe8badb652 100644 --- a/tests/ui/issues/issue-39175.stderr +++ b/tests/ui/issues/issue-39175.stderr @@ -2,10 +2,12 @@ error[E0599]: no method named `exec` found for mutable reference `&mut Command` --> $DIR/issue-39175.rs:14:39 | LL | Command::new("echo").arg("hello").exec(); - | ^^^^ method not found in `&mut Command` + | ^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: there is a method `pre_exec` with a similar name, but with different arguments + --> $SRC_DIR/std/src/os/unix/process.rs:LL:COL +help: trait `CommandExt` which provides `exec` is implemented but not in scope; perhaps you want to import it | LL + use std::os::unix::process::CommandExt; | diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index 1ddee1f4895..6ed35c3a3d3 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `trait_method` found for struct `FooStruct` in the --> $DIR/issue-56175.rs:5:33 | LL | reexported_trait::FooStruct.trait_method(); - | ^^^^^^^^^^^^ method not found in `FooStruct` + | ^^^^^^^^^^^^ | ::: $DIR/auxiliary/reexported-trait.rs:3:12 | @@ -10,16 +10,20 @@ LL | fn trait_method(&self) { | ------------ the method is available for `FooStruct` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Trait` which provides `trait_method` is implemented but not in scope; perhaps you want to import it | LL + use reexported_trait::Trait; | +help: there is a method `trait_method_b` with a similar name + | +LL | reexported_trait::FooStruct.trait_method_b(); + | ~~~~~~~~~~~~~~ error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope --> $DIR/issue-56175.rs:7:33 | LL | reexported_trait::FooStruct.trait_method_b(); - | ^^^^^^^^^^^^^^ method not found in `FooStruct` + | ^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/reexported-trait.rs:7:12 | @@ -27,10 +31,14 @@ LL | fn trait_method_b(&self) { | -------------- the method is available for `FooStruct` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `TraitB` which provides `trait_method_b` is implemented but not in scope; perhaps you want to import it | LL + use reexported_trait::TraitBRename; | +help: there is a method `trait_method` with a similar name + | +LL | reexported_trait::FooStruct.trait_method(); + | ~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/methods/issues/issue-105732.stderr b/tests/ui/methods/issues/issue-105732.stderr index 19ccd2de685..a4924b3e663 100644 --- a/tests/ui/methods/issues/issue-105732.stderr +++ b/tests/ui/methods/issues/issue-105732.stderr @@ -10,7 +10,12 @@ error[E0599]: no method named `g` found for reference `&Self` in the current sco --> $DIR/issue-105732.rs:10:14 | LL | self.g(); - | ^ help: there is a method with a similar name: `f` + | ^ + | +help: there is a method `f` with a similar name + | +LL | self.f(); + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/methods/method-not-found-but-doc-alias.stderr b/tests/ui/methods/method-not-found-but-doc-alias.stderr index 9746c404013..c49ffa8971f 100644 --- a/tests/ui/methods/method-not-found-but-doc-alias.stderr +++ b/tests/ui/methods/method-not-found-but-doc-alias.stderr @@ -5,7 +5,12 @@ LL | struct Foo; | ---------- method `quux` not found for this struct ... LL | Foo.quux(); - | ^^^^ help: there is a method with a similar name: `bar` + | ^^^^ + | +help: there is a method `bar` with a similar name + | +LL | Foo.bar(); + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 2c8df3b616f..7d915ebdab6 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -5,7 +5,12 @@ LL | fn owned(self: Box<Self>); | --------- the method might not be found because of this arbitrary self type ... LL | x.owned(); - | ^^^^^ method not found in `&dyn Foo` + | ^^^^^ + | +help: there is a method `to_owned` with a similar name + | +LL | x.to_owned(); + | ~~~~~~~~ error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr index 1fc561d32c6..536afc53f0c 100644 --- a/tests/ui/parser/emoji-identifiers.stderr +++ b/tests/ui/parser/emoji-identifiers.stderr @@ -71,16 +71,17 @@ LL | struct ๐; | --------- function or associated item `full_ofโจ` not found for this struct ... LL | ๐::full_ofโจ() - | ^^^^^^^^^ - | | - | function or associated item not found in `๐` - | help: there is an associated function with a similar name: `full_of_โจ` + | ^^^^^^^^^ function or associated item not found in `๐` | note: if you're trying to build a new `๐`, consider using `๐::full_of_โจ` which returns `๐` --> $DIR/emoji-identifiers.rs:4:5 | LL | fn full_of_โจ() -> ๐ { | ^^^^^^^^^^^^^^^^^^^^^ +help: there is an associated function `full_of_โจ` with a similar name + | +LL | ๐::full_of_โจ() + | ~~~~~~~~~~ error[E0425]: cannot find function `i_like_to_๐_a_lot` in this scope --> $DIR/emoji-identifiers.rs:13:13 diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index 89b69e14099..f4fb7fd955f 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -14,10 +14,12 @@ LL | struct Struct; | ------------- function or associated item `fob` not found for this struct ... LL | Struct::fob(); - | ^^^ - | | - | function or associated item not found in `Struct` - | help: there is an associated function with a similar name: `foo` + | ^^^ function or associated item not found in `Struct` + | +help: there is an associated function `foo` with a similar name + | +LL | Struct::foo(); + | ~~~ error[E0433]: failed to resolve: use of undeclared type `Struc` --> $DIR/typo-suggestion-mistyped-in-path.rs:27:5 diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 325c5976e7c..85262888579 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -5,13 +5,17 @@ LL | fn foobar(&self) { } | ------ the method is available for `u32` here ... LL | x.foobar(); - | ^^^^^^ method not found in `u32` + | ^^^^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Foobar` which provides `foobar` is implemented but not in scope; perhaps you want to import it | LL + use crate::foo::foobar::Foobar; | +help: there is a method `bar` with a similar name + | +LL | x.bar(); + | ~~~ error[E0599]: no method named `bar` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:28:7 @@ -20,19 +24,28 @@ LL | fn bar(&self) { } | --- the method is available for `u32` here ... LL | x.bar(); - | ^^^ method not found in `u32` + | ^^^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Bar` which provides `bar` is implemented but not in scope; perhaps you want to import it | LL + use crate::foo::Bar; | +help: there is a method `foobar` with a similar name + | +LL | x.foobar(); + | ~~~~~~ error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 | LL | x.baz(); - | ^^^ method not found in `u32` + | ^^^ + | +help: there is a method `bar` with a similar name + | +LL | x.bar(); + | ~~~ error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:30:18 @@ -41,14 +54,14 @@ LL | let y = u32::from_str("33"); | ^^^^^^^^ function or associated item not found in `u32` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `FromStr` which provides `from_str` is implemented but not in scope; perhaps you want to import it | LL + use std::str::FromStr; | -help: there is an associated function with a similar name +help: there is an associated function `from` with a similar name | -LL | let y = u32::from_str_radix("33"); - | ~~~~~~~~~~~~~~ +LL | let y = u32::from("33"); + | ~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr index 4a874a834bb..3e6fc3ff2a5 100644 --- a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr +++ b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr @@ -8,7 +8,7 @@ LL | A::deserialize(); | ^^^^^^^^^^^ function or associated item not found in `A` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Deserialize` which provides `deserialize` is implemented but not in scope; perhaps you want to import it | LL + use <crate::A as issue_87932_a::Deserialize>::deserialize::_a::Deserialize; | diff --git a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr index d2b2e5b2fd7..d9c0fa47eca 100644 --- a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr @@ -2,16 +2,20 @@ error[E0599]: no method named `try_into` found for type `u8` in the current scop --> $DIR/future-prelude-collision-shadow.rs:27:26 | LL | let _: u32 = 3u8.try_into().unwrap(); - | ^^^^^^^^ method not found in `u8` + | ^^^^^^^^ | = help: items from traits can only be used if the trait is in scope = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 -help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: +help: the following traits which provide `try_into` are implemented but not in scope; perhaps you want to import one of them | LL + use crate::m::TryIntoU32; | LL + use std::convert::TryInto; | +help: there is a method `into` with a similar name + | +LL | let _: u32 = 3u8.into().unwrap(); + | ~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/self/arbitrary_self_type_mut_difference.stderr b/tests/ui/self/arbitrary_self_type_mut_difference.stderr index a56d58694aa..ffc61ee0d78 100644 --- a/tests/ui/self/arbitrary_self_type_mut_difference.stderr +++ b/tests/ui/self/arbitrary_self_type_mut_difference.stderr @@ -2,25 +2,33 @@ error[E0599]: no method named `x` found for struct `Pin<&S>` in the current scop --> $DIR/arbitrary_self_type_mut_difference.rs:11:18 | LL | Pin::new(&S).x(); - | ^ help: there is a method with a similar name: `y` + | ^ | note: method is available for `Pin<&mut S>` --> $DIR/arbitrary_self_type_mut_difference.rs:6:5 | LL | fn x(self: Pin<&mut Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: there is a method `y` with a similar name + | +LL | Pin::new(&S).y(); + | ~ error[E0599]: no method named `y` found for struct `Pin<&mut S>` in the current scope --> $DIR/arbitrary_self_type_mut_difference.rs:12:22 | LL | Pin::new(&mut S).y(); - | ^ help: there is a method with a similar name: `x` + | ^ | note: method is available for `Pin<&S>` --> $DIR/arbitrary_self_type_mut_difference.rs:7:5 | LL | fn y(self: Pin<&Self>) {} | ^^^^^^^^^^^^^^^^^^^^^^ +help: there is a method `x` with a similar name + | +LL | Pin::new(&mut S).x(); + | ~ error: aborting due to 2 previous errors diff --git a/tests/ui/shadowed/shadowed-trait-methods.stderr b/tests/ui/shadowed/shadowed-trait-methods.stderr index 0bcf32790bc..2c990fababf 100644 --- a/tests/ui/shadowed/shadowed-trait-methods.stderr +++ b/tests/ui/shadowed/shadowed-trait-methods.stderr @@ -8,7 +8,7 @@ LL | ().f() | ^ method not found in `()` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `T` which provides `f` is implemented but not in scope; perhaps you want to import it | LL + use foo::T; | diff --git a/tests/ui/suggestions/dont-suggest-pin-array-dot-set.stderr b/tests/ui/suggestions/dont-suggest-pin-array-dot-set.stderr index 8f738465d38..b1a618e7176 100644 --- a/tests/ui/suggestions/dont-suggest-pin-array-dot-set.stderr +++ b/tests/ui/suggestions/dont-suggest-pin-array-dot-set.stderr @@ -2,7 +2,10 @@ error[E0599]: no method named `set` found for array `[u8; 1]` in the current sco --> $DIR/dont-suggest-pin-array-dot-set.rs:14:7 | LL | a.set(0, 3); - | ^^^ help: there is a method with a similar name: `get` + | ^^^ + | +help: there is a method `get` with a similar name, but with different arguments + --> $SRC_DIR/core/src/slice/mod.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.rs b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.rs index baa2128eb8e..06aed9ac98f 100644 --- a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.rs +++ b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.rs @@ -1,5 +1,5 @@ mod banana { - //~^ HELP the following traits are implemented but not in scope + //~^ HELP the following traits which provide `pick` are implemented but not in scope pub struct Chaenomeles; pub trait Apple { diff --git a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr index 974aedd13cf..41ca7d0f8ea 100644 --- a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr +++ b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr @@ -8,7 +8,7 @@ LL | banana::Chaenomeles.pick() | ^^^^ method not found in `Chaenomeles` | = help: items from traits can only be used if the trait is in scope -help: the following traits are implemented but not in scope; perhaps add a `use` for one of them: +help: the following traits which provide `pick` are implemented but not in scope; perhaps you want to import one of them | LL + use banana::Apple; | diff --git a/tests/ui/suggestions/import-trait-for-method-call.stderr b/tests/ui/suggestions/import-trait-for-method-call.stderr index 3f54daf136f..58b07fe7a42 100644 --- a/tests/ui/suggestions/import-trait-for-method-call.stderr +++ b/tests/ui/suggestions/import-trait-for-method-call.stderr @@ -8,7 +8,7 @@ LL | h.finish() = note: the method is available for `DefaultHasher` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Hasher` which provides `finish` is implemented but not in scope; perhaps you want to import it | LL + use std::hash::Hasher; | diff --git a/tests/ui/suggestions/issue-109291.stderr b/tests/ui/suggestions/issue-109291.stderr index c787be4de7c..a173bbbb490 100644 --- a/tests/ui/suggestions/issue-109291.stderr +++ b/tests/ui/suggestions/issue-109291.stderr @@ -2,10 +2,7 @@ error[E0599]: no function or associated item named `forced_capture` found for st --> $DIR/issue-109291.rs:2:65 | LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture()); - | ^^^^^^^^^^^^^^ - | | - | function or associated item not found in `Backtrace` - | help: there is an associated function with a similar name: `force_capture` + | ^^^^^^^^^^^^^^ function or associated item not found in `Backtrace` | note: if you're trying to build a new `Backtrace` consider using one of the following associated functions: Backtrace::capture @@ -13,6 +10,10 @@ note: if you're trying to build a new `Backtrace` consider using one of the foll Backtrace::disabled Backtrace::create --> $SRC_DIR/std/src/backtrace.rs:LL:COL +help: there is an associated function `force_capture` with a similar name + | +LL | println!("Custom backtrace: {}", std::backtrace::Backtrace::force_capture()); + | ~~~~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/suggest-methods.rs b/tests/ui/suggestions/suggest-methods.rs index f40b9ed99b8..f8095795447 100644 --- a/tests/ui/suggestions/suggest-methods.rs +++ b/tests/ui/suggestions/suggest-methods.rs @@ -7,6 +7,7 @@ impl Foo { trait FooT { fn bag(&self); + //~^ HELP there is a method } impl FooT for Foo { @@ -19,12 +20,14 @@ fn main() { let s = "foo".to_string(); let _ = s.is_emtpy(); //~ ERROR no method named + //~^ HELP there is a method // Generates a warning for `count_zeros()`. `count_ones()` is also a close // match, but the former is closer. let _ = 63u32.count_eos(); //~ ERROR no method named + //~^ HELP there is a method - // Does not generate a warning let _ = 63u32.count_o(); //~ ERROR no method named + //~^ HELP there is a method } diff --git a/tests/ui/suggestions/suggest-methods.stderr b/tests/ui/suggestions/suggest-methods.stderr index 03cb9c77922..5bacad8c6e8 100644 --- a/tests/ui/suggestions/suggest-methods.stderr +++ b/tests/ui/suggestions/suggest-methods.stderr @@ -1,29 +1,50 @@ error[E0599]: no method named `bat` found for struct `Foo` in the current scope - --> $DIR/suggest-methods.rs:18:7 + --> $DIR/suggest-methods.rs:19:7 | LL | struct Foo; | ---------- method `bat` not found for this struct ... LL | f.bat(1.0); - | ^^^ help: there is a method with a similar name: `bar` + | ^^^ + | +help: there is a method `bag` with a similar name, but with different arguments + --> $DIR/suggest-methods.rs:9:5 + | +LL | fn bag(&self); + | ^^^^^^^^^^^^^^ error[E0599]: no method named `is_emtpy` found for struct `String` in the current scope - --> $DIR/suggest-methods.rs:21:15 + --> $DIR/suggest-methods.rs:22:15 | LL | let _ = s.is_emtpy(); - | ^^^^^^^^ help: there is a method with a similar name: `is_empty` + | ^^^^^^^^ + | +help: there is a method `is_empty` with a similar name + | +LL | let _ = s.is_empty(); + | ~~~~~~~~ error[E0599]: no method named `count_eos` found for type `u32` in the current scope - --> $DIR/suggest-methods.rs:25:19 + --> $DIR/suggest-methods.rs:27:19 | LL | let _ = 63u32.count_eos(); - | ^^^^^^^^^ help: there is a method with a similar name: `count_zeros` + | ^^^^^^^^^ + | +help: there is a method `count_zeros` with a similar name + | +LL | let _ = 63u32.count_zeros(); + | ~~~~~~~~~~~ error[E0599]: no method named `count_o` found for type `u32` in the current scope - --> $DIR/suggest-methods.rs:28:19 + --> $DIR/suggest-methods.rs:30:19 | LL | let _ = 63u32.count_o(); - | ^^^^^^^ help: there is a method with a similar name: `count_ones` + | ^^^^^^^ + | +help: there is a method `count_ones` with a similar name + | +LL | let _ = 63u32.count_ones(); + | ~~~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.rs b/tests/ui/suggestions/suggest-tryinto-edition-change.rs index c4a24ffee93..37321774874 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.rs +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.rs @@ -5,7 +5,6 @@ fn test() { let _i: i16 = 0_i32.try_into().unwrap(); //~^ ERROR no method named `try_into` found for type `i32` in the current scope - //~| NOTE method not found in `i32` //~| NOTE 'std::convert::TryInto' is included in the prelude starting in Edition 2021 let _i: i16 = TryFrom::try_from(0_i32).unwrap(); diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 057e37dbe10..db7c40101cd 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -1,5 +1,5 @@ error[E0433]: failed to resolve: use of undeclared type `TryFrom` - --> $DIR/suggest-tryinto-edition-change.rs:11:19 + --> $DIR/suggest-tryinto-edition-change.rs:10:19 | LL | let _i: i16 = TryFrom::try_from(0_i32).unwrap(); | ^^^^^^^ use of undeclared type `TryFrom` @@ -14,7 +14,7 @@ LL + use std::convert::TryFrom; | error[E0433]: failed to resolve: use of undeclared type `TryInto` - --> $DIR/suggest-tryinto-edition-change.rs:17:19 + --> $DIR/suggest-tryinto-edition-change.rs:16:19 | LL | let _i: i16 = TryInto::try_into(0_i32).unwrap(); | ^^^^^^^ use of undeclared type `TryInto` @@ -29,7 +29,7 @@ LL + use std::convert::TryInto; | error[E0433]: failed to resolve: use of undeclared type `FromIterator` - --> $DIR/suggest-tryinto-edition-change.rs:23:22 + --> $DIR/suggest-tryinto-edition-change.rs:22:22 | LL | let _v: Vec<_> = FromIterator::from_iter(&[1]); | ^^^^^^^^^^^^ use of undeclared type `FromIterator` @@ -51,17 +51,21 @@ error[E0599]: no method named `try_into` found for type `i32` in the current sco --> $DIR/suggest-tryinto-edition-change.rs:6:25 | LL | let _i: i16 = 0_i32.try_into().unwrap(); - | ^^^^^^^^ method not found in `i32` + | ^^^^^^^^ --> $SRC_DIR/core/src/convert/mod.rs:LL:COL | = note: the method is available for `i32` here | = help: items from traits can only be used if the trait is in scope = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021 -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `TryInto` which provides `try_into` is implemented but not in scope; perhaps you want to import it | LL + use std::convert::TryInto; | +help: there is a method `into` with a similar name + | +LL | let _i: i16 = 0_i32.into().unwrap(); + | ~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/use-placement-typeck.stderr b/tests/ui/suggestions/use-placement-typeck.stderr index d8f2d58a248..dc2bd96bb21 100644 --- a/tests/ui/suggestions/use-placement-typeck.stderr +++ b/tests/ui/suggestions/use-placement-typeck.stderr @@ -11,7 +11,7 @@ LL | pub struct S; | ------------ method `abc` not found for this struct | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Foo` which provides `abc` is implemented but not in scope; perhaps you want to import it | LL + use m::Foo; | diff --git a/tests/ui/traits/issue-117794.stderr b/tests/ui/traits/issue-117794.stderr index af63b47f07d..66561ffa4ce 100644 --- a/tests/ui/traits/issue-117794.stderr +++ b/tests/ui/traits/issue-117794.stderr @@ -2,7 +2,13 @@ error[E0599]: no method named `b` found for reference `&Self` in the current sco --> $DIR/issue-117794.rs:5:14 | LL | self.b(|| 0) - | ^ help: there is a method with a similar name: `a` + | ^ + | +help: there is a method `a` with a similar name, but with different arguments + --> $DIR/issue-117794.rs:4:5 + | +LL | fn a(&self) -> impl Foo { + | ^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index 244cc2fc592..d08bb4745bf 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -5,13 +5,17 @@ LL | struct S; | -------- method `a` not found for this struct ... LL | S.a(); - | ^ method not found in `S` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `A` which provides `a` is implemented but not in scope; perhaps you want to import it | LL + use method::A; | +help: there is a method `b` with a similar name + | +LL | S.b(); + | ~ error[E0599]: no method named `b` found for struct `S` in the current scope --> $DIR/item-privacy.rs:68:7 @@ -23,13 +27,17 @@ LL | fn b(&self) { } | - the method is available for `S` here ... LL | S.b(); - | ^ method not found in `S` + | ^ | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `B` which provides `b` is implemented but not in scope; perhaps you want to import it | LL + use method::B; | +help: there is a method `c` with a similar name + | +LL | S.c(); + | ~ error[E0624]: method `a` is private --> $DIR/item-privacy.rs:72:7 @@ -50,7 +58,12 @@ 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 -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: there is an associated constant `B` with a similar name + --> $DIR/item-privacy.rs:29:9 + | +LL | const B: u8 = 0; + | ^^^^^^^^^^^ +help: trait `A` which provides `a` is implemented but not in scope; perhaps you want to import it | LL + use method::A; | @@ -65,7 +78,12 @@ LL | S::b(&S); | ^ function or associated item not found in `S` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: there is an associated constant `B` with a similar name + --> $DIR/item-privacy.rs:29:9 + | +LL | const B: u8 = 0; + | ^^^^^^^^^^^ +help: trait `B` which provides `b` is implemented but not in scope; perhaps you want to import it | LL + use method::B; | @@ -89,10 +107,14 @@ 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 -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `A` which provides `A` is implemented but not in scope; perhaps you want to import it | LL + use assoc_const::A; | +help: there is an associated constant `B` with a similar name + | +LL | S::B; + | ~ error[E0599]: no associated item named `B` found for struct `S` in the current scope --> $DIR/item-privacy.rs:98:8 @@ -104,10 +126,14 @@ LL | S::B; | ^ associated item not found in `S` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `B` which provides `B` is implemented but not in scope; perhaps you want to import it | LL + use assoc_const::B; | +help: there is a method `b` with a similar name + | +LL | S::b; + | ~ error[E0624]: associated constant `A` is private --> $DIR/item-privacy.rs:101:14 diff --git a/tests/ui/traits/method-private.stderr b/tests/ui/traits/method-private.stderr index d19f0bc086b..274767331bd 100644 --- a/tests/ui/traits/method-private.stderr +++ b/tests/ui/traits/method-private.stderr @@ -8,7 +8,7 @@ LL | foo.method(); | ^^^^^^ private method | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Bar` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use inner::Bar; | diff --git a/tests/ui/traits/trait-upcasting/subtrait-method.stderr b/tests/ui/traits/trait-upcasting/subtrait-method.stderr index 918159e845b..0408be6986b 100644 --- a/tests/ui/traits/trait-upcasting/subtrait-method.stderr +++ b/tests/ui/traits/trait-upcasting/subtrait-method.stderr @@ -2,7 +2,7 @@ error[E0599]: no method named `c` found for reference `&dyn Bar` in the current --> $DIR/subtrait-method.rs:55:9 | LL | bar.c(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it @@ -10,12 +10,16 @@ note: `Baz` defines an item `c`, perhaps you need to implement it | LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | bar.a(); + | ~ error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:59:9 | LL | foo.b(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Bar` defines an item `b`, perhaps you need to implement it @@ -23,12 +27,16 @@ note: `Bar` defines an item `b`, perhaps you need to implement it | LL | trait Bar: Foo { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | foo.a(); + | ~ error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:61:9 | LL | foo.c(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it @@ -36,12 +44,16 @@ note: `Baz` defines an item `c`, perhaps you need to implement it | LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | foo.a(); + | ~ error[E0599]: no method named `b` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:65:9 | LL | foo.b(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Bar` defines an item `b`, perhaps you need to implement it @@ -49,12 +61,16 @@ note: `Bar` defines an item `b`, perhaps you need to implement it | LL | trait Bar: Foo { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | foo.a(); + | ~ error[E0599]: no method named `c` found for reference `&dyn Foo` in the current scope --> $DIR/subtrait-method.rs:67:9 | LL | foo.c(); - | ^ help: there is a method with a similar name: `a` + | ^ | = help: items from traits can only be used if the trait is implemented and in scope note: `Baz` defines an item `c`, perhaps you need to implement it @@ -62,6 +78,10 @@ note: `Baz` defines an item `c`, perhaps you need to implement it | LL | trait Baz: Bar { | ^^^^^^^^^^^^^^ +help: there is a method `a` with a similar name + | +LL | foo.a(); + | ~ error: aborting due to 5 previous errors diff --git a/tests/ui/typeck/issue-43189.stderr b/tests/ui/typeck/issue-43189.stderr index 2e12651699d..8432cbeca2a 100644 --- a/tests/ui/typeck/issue-43189.stderr +++ b/tests/ui/typeck/issue-43189.stderr @@ -10,7 +10,7 @@ LL | fn a(&self) {} | - the method is available for `()` here | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `A` which provides `a` is implemented but not in scope; perhaps you want to import it | LL + use xcrate_issue_43189_b::xcrate_issue_43189_a::A; | diff --git a/tests/ui/ufcs/bad-builder.stderr b/tests/ui/ufcs/bad-builder.stderr index 7fa47c82de2..e1c5e45b3eb 100644 --- a/tests/ui/ufcs/bad-builder.stderr +++ b/tests/ui/ufcs/bad-builder.stderr @@ -2,10 +2,7 @@ error[E0599]: no function or associated item named `mew` found for struct `Vec<Q --> $DIR/bad-builder.rs:2:15 | LL | Vec::<Q>::mew() - | ^^^ - | | - | function or associated item not found in `Vec<Q>` - | help: there is an associated function with a similar name: `new` + | ^^^ function or associated item not found in `Vec<Q>` | note: if you're trying to build a new `Vec<Q>` consider using one of the following associated functions: Vec::<T>::new @@ -14,6 +11,10 @@ note: if you're trying to build a new `Vec<Q>` consider using one of the followi Vec::<T, A>::new_in and 2 others --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL +help: there is an associated function `new` with a similar name + | +LL | Vec::<Q>::new() + | ~~~ error: aborting due to 1 previous error diff --git a/tests/ui/underscore-imports/shadow.stderr b/tests/ui/underscore-imports/shadow.stderr index da263163892..4743d14dfb9 100644 --- a/tests/ui/underscore-imports/shadow.stderr +++ b/tests/ui/underscore-imports/shadow.stderr @@ -5,7 +5,7 @@ LL | x.deref(); | ^^^^^ method not found in `&()` | = help: items from traits can only be used if the trait is in scope -help: the following trait is implemented but not in scope; perhaps add a `use` for it: +help: trait `Deref` which provides `deref` is implemented but not in scope; perhaps you want to import it | LL + use std::ops::Deref; | |
