mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-05 13:49:50 +00:00
Method errors have an extra check that force trim paths whenever the normal string is longer than 10 characters, which can be quite unhelpful when multiple items have the same name (for example an `Error`). A user reported this force trimming as being quite unhelpful when they had a method error where the precise path of the `Error` mattered. The code uses `tcx.short_string` already to get the normal path, which tries to be clever around trimming paths if necessary, so there is no reason for this extra force trimming.
309 lines
13 KiB
Plaintext
309 lines
13 KiB
Plaintext
error[E0599]: no method named `method` found for type `u32` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:25:10
|
|
|
|
|
LL | 1u32.method();
|
|
| ^^^^^^
|
|
|
|
|
= help: items from traits can only be used if the trait is in scope
|
|
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;
|
|
|
|
|
LL + use no_method_suggested_traits::Reexported;
|
|
|
|
|
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:28:44
|
|
|
|
|
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 which provide `method` are implemented but not in scope; perhaps you want to import one of them
|
|
|
|
|
LL + use foo::Bar;
|
|
|
|
|
LL + use no_method_suggested_traits::Reexported;
|
|
|
|
|
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:32:9
|
|
|
|
|
LL | fn method(&self) {}
|
|
| ------ the method is available for `char` here
|
|
...
|
|
LL | 'a'.method();
|
|
| ^^^^^^
|
|
|
|
|
= help: items from traits can only be used if the trait is in scope
|
|
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:34:43
|
|
|
|
|
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: 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:37:10
|
|
|
|
|
LL | 1i32.method();
|
|
| ^^^^^^
|
|
|
|
|
::: $DIR/auxiliary/no_method_suggested_traits.rs:8:12
|
|
|
|
|
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: 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:39:44
|
|
|
|
|
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: 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:42:9
|
|
|
|
|
LL | struct Foo;
|
|
| ---------- method `method` not found for this struct
|
|
...
|
|
LL | Foo.method();
|
|
| ^^^^^^ method not found in `Foo`
|
|
|
|
|
= help: items from traits can only be used if the trait is implemented and in scope
|
|
= note: the following traits define an item `method`, perhaps you need to implement one of them:
|
|
candidate #1: `foo::Bar`
|
|
candidate #2: `PubPub`
|
|
candidate #3: `Reexported`
|
|
candidate #4: `no_method_suggested_traits::qux::PrivPub`
|
|
|
|
error[E0599]: no method named `method` found for struct `Rc<&mut Box<&Foo>>` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:44:43
|
|
|
|
|
LL | std::rc::Rc::new(&mut Box::new(&Foo)).method();
|
|
| ^^^^^^ method not found in `Rc<&mut Box<&Foo>>`
|
|
|
|
|
= help: items from traits can only be used if the trait is implemented and in scope
|
|
= note: the following traits define an item `method`, perhaps you need to implement one of them:
|
|
candidate #1: `foo::Bar`
|
|
candidate #2: `PubPub`
|
|
candidate #3: `Reexported`
|
|
candidate #4: `no_method_suggested_traits::qux::PrivPub`
|
|
|
|
error[E0599]: no method named `method2` found for type `u64` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:47:10
|
|
|
|
|
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:10:5
|
|
|
|
|
LL | pub trait Bar {
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error[E0599]: no method named `method2` found for struct `Rc<&mut Box<&u64>>` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:49:44
|
|
|
|
|
LL | std::rc::Rc::new(&mut Box::new(&1u64)).method2();
|
|
| ^^^^^^^ method not found in `Rc<&mut 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:10: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:52:37
|
|
|
|
|
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:10:5
|
|
|
|
|
LL | pub trait Bar {
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error[E0599]: no method named `method2` found for struct `Rc<&mut Box<&no_method_suggested_traits::Foo>>` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:54:71
|
|
|
|
|
LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method2();
|
|
| ^^^^^^^ method not found in `Rc<&mut 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:10: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:56:40
|
|
|
|
|
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:10:5
|
|
|
|
|
LL | pub trait Bar {
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error[E0599]: no method named `method2` found for struct `Rc<&mut Box<&no_method_suggested_traits::Bar>>` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:58:74
|
|
|
|
|
LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method2();
|
|
| ^^^^^^^ method not found in `Rc<&mut 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:10: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:61:9
|
|
|
|
|
LL | struct Foo;
|
|
| ---------- method `method3` not found for this struct
|
|
...
|
|
LL | Foo.method3();
|
|
| ^^^^^^^ method not found in `Foo`
|
|
|
|
|
= help: items from traits can only be used if the trait is implemented and in scope
|
|
= note: the following trait defines an item `method3`, perhaps you need to implement it:
|
|
candidate #1: `PubPub`
|
|
|
|
error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&Foo>>` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:63:43
|
|
|
|
|
LL | std::rc::Rc::new(&mut Box::new(&Foo)).method3();
|
|
| ^^^^^^^ method not found in `Rc<&mut Box<&Foo>>`
|
|
|
|
|
= help: items from traits can only be used if the trait is implemented and in scope
|
|
= note: the following trait defines an item `method3`, perhaps you need to implement it:
|
|
candidate #1: `PubPub`
|
|
|
|
error[E0599]: no method named `method3` found for enum `Bar` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:65:12
|
|
|
|
|
LL | enum Bar { X }
|
|
| -------- method `method3` not found for this enum
|
|
...
|
|
LL | Bar::X.method3();
|
|
| ^^^^^^^ method not found in `Bar`
|
|
|
|
|
= help: items from traits can only be used if the trait is implemented and in scope
|
|
= note: the following trait defines an item `method3`, perhaps you need to implement it:
|
|
candidate #1: `PubPub`
|
|
|
|
error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&Bar>>` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:67:46
|
|
|
|
|
LL | std::rc::Rc::new(&mut Box::new(&Bar::X)).method3();
|
|
| ^^^^^^^ method not found in `Rc<&mut Box<&Bar>>`
|
|
|
|
|
= help: items from traits can only be used if the trait is implemented and in scope
|
|
= note: the following trait defines an item `method3`, perhaps you need to implement it:
|
|
candidate #1: `PubPub`
|
|
|
|
error[E0599]: no method named `method3` found for type `usize` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:71:13
|
|
|
|
|
LL | 1_usize.method3();
|
|
| ^^^^^^^ method not found in `usize`
|
|
|
|
error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&usize>>` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:72:47
|
|
|
|
|
LL | std::rc::Rc::new(&mut Box::new(&1_usize)).method3();
|
|
| ^^^^^^^ method not found in `Rc<&mut Box<&usize>>`
|
|
|
|
error[E0599]: no method named `method3` found for struct `no_method_suggested_traits::Foo` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:73:37
|
|
|
|
|
LL | no_method_suggested_traits::Foo.method3();
|
|
| ^^^^^^^ method not found in `no_method_suggested_traits::Foo`
|
|
|
|
error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&no_method_suggested_traits::Foo>>` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:74:71
|
|
|
|
|
LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Foo)).method3();
|
|
| ^^^^^^^ method not found in `Rc<&mut Box<&no_method_suggested_traits::Foo>>`
|
|
|
|
error[E0599]: no method named `method3` found for enum `no_method_suggested_traits::Bar` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:76:40
|
|
|
|
|
LL | no_method_suggested_traits::Bar::X.method3();
|
|
| ^^^^^^^ method not found in `no_method_suggested_traits::Bar`
|
|
|
|
error[E0599]: no method named `method3` found for struct `Rc<&mut Box<&no_method_suggested_traits::Bar>>` in the current scope
|
|
--> $DIR/no-method-suggested-traits.rs:77:74
|
|
|
|
|
LL | std::rc::Rc::new(&mut Box::new(&no_method_suggested_traits::Bar::X)).method3();
|
|
| ^^^^^^^ method not found in `Rc<&mut Box<&no_method_suggested_traits::Bar>>`
|
|
|
|
error: aborting due to 24 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0599`.
|