mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 18:27:37 +00:00

`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`. We add support for shortening the path of "trait path only". Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem). When we don't actually print out a shortened type we don't need the "use `--verbose`" note. On E0599 show type identity to avoid expanding the receiver's generic parameters. Unify wording on `long_ty_path` everywhere.
105 lines
4.1 KiB
Plaintext
105 lines
4.1 KiB
Plaintext
error[E0599]: no method named `distance` found for struct `Point<i32>` in the current scope
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:82:23
|
|
|
|
|
LL | struct Point<T> {
|
|
| --------------- method `distance` not found for this struct
|
|
...
|
|
LL | let d = point_i32.distance();
|
|
| ^^^^^^^^ method not found in `Point<i32>`
|
|
|
|
|
= note: the method was found for
|
|
- `Point<f64>`
|
|
|
|
error[E0599]: no method named `other` found for struct `Point<T>` in the current scope
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:84:23
|
|
|
|
|
LL | struct Point<T> {
|
|
| --------------- method `other` not found for this struct
|
|
...
|
|
LL | let d = point_i32.other();
|
|
| ^^^^^ method not found in `Point<i32>`
|
|
|
|
error[E0599]: no method named `extend` found for struct `Map<I, F>` in the current scope
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:87:67
|
|
|
|
|
LL | v.iter().map(Box::new(|x| x * x) as Box<dyn Fn(&i32) -> i32>).extend(std::iter::once(100));
|
|
| ^^^^^^ method not found in `Map<std::slice::Iter<'_, i32>, Box<dyn for<'a> Fn(&'a i32) -> i32>>`
|
|
|
|
error[E0599]: no method named `method` found for struct `Wrapper<bool>` in the current scope
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:90:13
|
|
|
|
|
LL | struct Wrapper<T>(T);
|
|
| ----------------- method `method` not found for this struct
|
|
...
|
|
LL | wrapper.method();
|
|
| ^^^^^^ method not found in `Wrapper<bool>`
|
|
|
|
|
= note: the method was found for
|
|
- `Wrapper<i16>`
|
|
- `Wrapper<i32>`
|
|
- `Wrapper<i64>`
|
|
- `Wrapper<i8>`
|
|
and 2 more types
|
|
|
|
error[E0599]: no method named `other` found for struct `Wrapper<T>` in the current scope
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:92:13
|
|
|
|
|
LL | struct Wrapper<T>(T);
|
|
| ----------------- method `other` not found for this struct
|
|
...
|
|
LL | wrapper.other();
|
|
| ^^^^^ method not found in `Wrapper<bool>`
|
|
|
|
error[E0599]: no method named `method` found for struct `Wrapper2<'_, bool, 3>` in the current scope
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:96:13
|
|
|
|
|
LL | struct Wrapper2<'a, T, const C: usize> {
|
|
| -------------------------------------- method `method` not found for this struct
|
|
...
|
|
LL | wrapper.method();
|
|
| ^^^^^^ method not found in `Wrapper2<'_, bool, 3>`
|
|
|
|
|
= note: the method was found for
|
|
- `Wrapper2<'a, i16, C>`
|
|
- `Wrapper2<'a, i32, C>`
|
|
- `Wrapper2<'a, i8, C>`
|
|
|
|
error[E0599]: no method named `other` found for struct `Wrapper2<'a, T, C>` in the current scope
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:98:13
|
|
|
|
|
LL | struct Wrapper2<'a, T, const C: usize> {
|
|
| -------------------------------------- method `other` not found for this struct
|
|
...
|
|
LL | wrapper.other();
|
|
| ^^^^^ method not found in `Wrapper2<'_, bool, 3>`
|
|
|
|
error[E0599]: no method named `not_found` found for struct `Vec<{integer}>` in the current scope
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:101:7
|
|
|
|
|
LL | a.not_found();
|
|
| ^^^^^^^^^ method not found in `Vec<{integer}>`
|
|
|
|
error[E0599]: the method `method` exists for struct `Struct<f64>`, but its trait bounds were not satisfied
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:104:7
|
|
|
|
|
LL | struct Struct<T> {
|
|
| ---------------- method `method` not found for this struct
|
|
...
|
|
LL | s.method();
|
|
| ^^^^^^ method cannot be called on `Struct<f64>` due to unsatisfied trait bounds
|
|
|
|
|
note: the following trait bounds were not satisfied:
|
|
`f64: Eq`
|
|
`f64: Ord`
|
|
--> $DIR/method-not-found-generic-arg-elision.rs:74:36
|
|
|
|
|
LL | impl<T: Clone + Copy + PartialEq + Eq + PartialOrd + Ord> Struct<T> {
|
|
| ^^ ^^^ ---------
|
|
| | |
|
|
| | unsatisfied trait bound introduced here
|
|
| unsatisfied trait bound introduced here
|
|
|
|
error: aborting due to 9 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0599`.
|