From caa216d2451e669a8efd1e2ef19b57fb010fde75 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Tue, 13 Feb 2024 23:05:23 +0000 Subject: Tweak wording of "implemented trait isn't imported" suggestion --- .../in-trait/dont-project-to-specializable-projection.stderr | 2 +- tests/ui/coherence/coherence_inherent.stderr | 2 +- tests/ui/coherence/coherence_inherent_cc.stderr | 2 +- tests/ui/hygiene/no_implicit_prelude.stderr | 2 +- tests/ui/hygiene/trait_items.stderr | 2 +- tests/ui/impl-trait/no-method-suggested-traits.stderr | 12 ++++++------ tests/ui/imports/overlapping_pub_trait.rs | 2 +- tests/ui/imports/overlapping_pub_trait.stderr | 2 +- tests/ui/imports/unnamed_pub_trait.rs | 2 +- tests/ui/imports/unnamed_pub_trait.stderr | 2 +- tests/ui/issues/issue-10465.stderr | 2 +- tests/ui/issues/issue-39175.stderr | 2 +- tests/ui/issues/issue-56175.stderr | 4 ++-- tests/ui/rust-2018/trait-import-suggestions.stderr | 6 +++--- tests/ui/rust-2018/uniform-paths/issue-87932.stderr | 2 +- tests/ui/rust-2021/future-prelude-collision-shadow.stderr | 2 +- tests/ui/shadowed/shadowed-trait-methods.stderr | 2 +- tests/ui/suggestions/dont-wrap-ambiguous-receivers.rs | 2 +- tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr | 2 +- tests/ui/suggestions/import-trait-for-method-call.stderr | 2 +- tests/ui/suggestions/suggest-tryinto-edition-change.stderr | 2 +- tests/ui/suggestions/use-placement-typeck.stderr | 2 +- tests/ui/traits/item-privacy.stderr | 12 ++++++------ tests/ui/traits/method-private.stderr | 2 +- tests/ui/typeck/issue-43189.stderr | 2 +- tests/ui/underscore-imports/shadow.stderr | 2 +- 26 files changed, 39 insertions(+), 39 deletions(-) (limited to 'tests') 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>` 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/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/hygiene/no_implicit_prelude.stderr b/tests/ui/hygiene/no_implicit_prelude.stderr index 646863a884c..5de6e3db327 100644 --- a/tests/ui/hygiene/no_implicit_prelude.stderr +++ b/tests/ui/hygiene/no_implicit_prelude.stderr @@ -26,7 +26,7 @@ LL | ().clone() 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 cf1bf59ab20..b9a6a281b84 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -5,7 +5,7 @@ LL | 1u32.method(); | ^^^^^^ | = 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; | @@ -27,7 +27,7 @@ LL | std::rc::Rc::new(&mut Box::new(&1u32)).method(); | ^^^^^^ | = 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; | @@ -52,7 +52,7 @@ LL | 'a'.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 foo::Bar; | @@ -68,7 +68,7 @@ LL | std::rc::Rc::new(&mut Box::new(&'a')).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 foo::Bar; | @@ -89,7 +89,7 @@ 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; | @@ -105,7 +105,7 @@ LL | std::rc::Rc::new(&mut Box::new(&1i32)).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 `PubPub` which provides `method` is implemented but not in scope; perhaps you want to import it | LL + use no_method_suggested_traits::foo::PubPub; | 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-39175.stderr b/tests/ui/issues/issue-39175.stderr index bdc9e422e86..bbe8badb652 100644 --- a/tests/ui/issues/issue-39175.stderr +++ b/tests/ui/issues/issue-39175.stderr @@ -7,7 +7,7 @@ LL | Command::new("echo").arg("hello").exec(); = help: items from traits can only be used if the trait is in scope 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: the following trait is implemented but not in scope; perhaps add a `use` for it: +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 d8c757c1583..882d4e99327 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -10,7 +10,7 @@ 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; | @@ -31,7 +31,7 @@ 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; | diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 36cce0aab51..9d7b68041e2 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -8,7 +8,7 @@ LL | x.foobar(); | ^^^^^^ | = 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; | @@ -27,7 +27,7 @@ LL | x.bar(); | ^^^ | = 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; | @@ -54,7 +54,7 @@ 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; | 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 ::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 1ca5708e753..a8fcf43cd63 100644 --- a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr @@ -6,7 +6,7 @@ LL | let _: u32 = 3u8.try_into().unwrap(); | = 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; | 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-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/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 01fabbadbff..a25a3f44ad2 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -58,7 +58,7 @@ LL | let _i: i16 = 0_i32.try_into().unwrap(); | = 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; | 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/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index a9469952976..00d75b14227 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -8,7 +8,7 @@ LL | S.a(); | ^ | = 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; | @@ -30,7 +30,7 @@ LL | S.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 `B` which provides `b` is implemented but not in scope; perhaps you want to import it | LL + use method::B; | @@ -63,7 +63,7 @@ help: there is an associated constant `B` with a similar name | LL | const B: u8 = 0; | ^^^^^^^^^^^ -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; | @@ -83,7 +83,7 @@ help: there is an associated constant `B` with a similar name | LL | const B: u8 = 0; | ^^^^^^^^^^^ -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; | @@ -107,7 +107,7 @@ 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; | @@ -126,7 +126,7 @@ 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; | 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/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/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; | -- cgit 1.4.1-3-g733a5