rust/src/test/ui/bound-suggestions.stderr
Dan Aloni 07e7823c01 pretty: trim paths of unique symbols
If a symbol name can only be imported from one place for a type, and
as long as it was not glob-imported anywhere in the current crate, we
can trim its printed path and print only the name.

This has wide implications on error messages with types, for example,
shortening `std::vec::Vec` to just `Vec`, as long as there is no other
`Vec` importable anywhere.

This adds a new '-Z trim-diagnostic-paths=false' option to control this
feature.

On the good path, with no diagnosis printed, we should try to avoid
issuing this query, so we need to prevent trimmed_def_paths query on
several cases.

This change also relies on a previous commit that differentiates
between `Debug` and `Display` on various rustc types, where the latter
is trimmed and presented to the user and the former is not.
2020-09-02 22:26:37 +03:00

82 lines
3.3 KiB
Plaintext

error[E0277]: `impl Sized` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:9:22
|
LL | println!("{:?}", t);
| ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
LL | fn test_impl(t: impl Sized + Debug) {
| ^^^^^^^
error[E0277]: `T` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:15:22
|
LL | println!("{:?}", t);
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `T`
|
LL | fn test_no_bounds<T: Debug>(t: T) {
| ^^^^^^^
error[E0277]: `T` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:21:22
|
LL | println!("{:?}", t);
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
LL | fn test_one_bound<T: Sized + Debug>(t: T) {
| ^^^^^^^
error[E0277]: `Y` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:27:30
|
LL | println!("{:?} {:?}", x, y);
| ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `Y`
|
LL | fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: Debug {
| ^^^^^^^^^^
error[E0277]: `X` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:33:22
|
LL | println!("{:?}", x);
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting this bound
|
LL | fn test_one_bound_where<X>(x: X) where X: Sized + Debug {
| ^^^^^^^
error[E0277]: `X` doesn't implement `Debug`
--> $DIR/bound-suggestions.rs:39:22
|
LL | println!("{:?}", x);
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
= note: required by `std::fmt::Debug::fmt`
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider further restricting type parameter `X`
|
LL | fn test_many_bounds_where<X>(x: X) where X: Sized, X: Sized, X: Debug {
| ^^^^^^^^^^
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0277`.