diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/typeck/dont-suggest-private-dependencies.rs | 7 | ||||
| -rw-r--r-- | tests/ui/typeck/dont-suggest-private-dependencies.stderr | 30 |
2 files changed, 14 insertions, 23 deletions
diff --git a/tests/ui/typeck/dont-suggest-private-dependencies.rs b/tests/ui/typeck/dont-suggest-private-dependencies.rs index afac00c5213..ee5224e2d82 100644 --- a/tests/ui/typeck/dont-suggest-private-dependencies.rs +++ b/tests/ui/typeck/dont-suggest-private-dependencies.rs @@ -10,6 +10,13 @@ //@ compile-flags: -Zunstable-options //@ forbid-output: private_dep +// By default, the `read` diagnostic suggests `std::os::unix::fs::FileExt::read_at`. Add +// something more likely to be recommended to make the diagnostic cross-platform. +trait DecoyRead { + fn read1(&self) {} +} +impl<T> DecoyRead for Vec<T> {} + struct VecReader(Vec<u8>); impl std::io::Read for VecReader { diff --git a/tests/ui/typeck/dont-suggest-private-dependencies.stderr b/tests/ui/typeck/dont-suggest-private-dependencies.stderr index 18848a2c08d..b7b14ee6b9b 100644 --- a/tests/ui/typeck/dont-suggest-private-dependencies.stderr +++ b/tests/ui/typeck/dont-suggest-private-dependencies.stderr @@ -1,42 +1,26 @@ error[E0599]: no method named `read` found for struct `Vec<u8>` in the current scope - --> $DIR/dont-suggest-private-dependencies.rs:17:16 + --> $DIR/dont-suggest-private-dependencies.rs:24:16 | LL | self.0.read(buf) | ^^^^ | - = help: items from traits can only be used if the trait is in scope -help: trait `ReadRef` which provides `read` is implemented but not in scope; perhaps you want to import it +help: there is a method `read1` with a similar name, but with different arguments + --> $DIR/dont-suggest-private-dependencies.rs:16:5 | -LL + use object::read::read_ref::ReadRef; - | -help: there is a method `read_at` with a similar name - | -LL | self.0.read_at(buf) - | +++ +LL | fn read1(&self) {} + | ^^^^^^^^^^^^^^^ error[E0599]: no function or associated item named `cast_from_lossy` found for type `u8` in the current scope - --> $DIR/dont-suggest-private-dependencies.rs:26:17 + --> $DIR/dont-suggest-private-dependencies.rs:33:17 | LL | let _ = u8::cast_from_lossy(9); | ^^^^^^^^^^^^^^^ function or associated item not found in `u8` - | - = help: items from traits can only be used if the trait is in scope -help: trait `CastFrom` which provides `cast_from_lossy` is implemented but not in scope; perhaps you want to import it - | -LL + use compiler_builtins::math::libm_math::support::int_traits::CastFrom; - | error[E0599]: no function or associated item named `foo` found for struct `B` in the current scope - --> $DIR/dont-suggest-private-dependencies.rs:28:16 + --> $DIR/dont-suggest-private-dependencies.rs:35:16 | LL | let _ = B::foo(); | ^^^ function or associated item not found in `B` - | - = help: items from traits can only be used if the trait is in scope -help: trait `A` which provides `foo` is implemented but not in scope; perhaps you want to import it - | -LL + use private_dep::A; - | error: aborting due to 3 previous errors |
