diff options
| author | Dan Aloni <alonid@gmail.com> | 2020-09-02 10:40:56 +0300 |
|---|---|---|
| committer | Dan Aloni <alonid@gmail.com> | 2020-09-02 22:26:37 +0300 |
| commit | 07e7823c01be1733df2480de19fbbe6b8e9384cf (patch) | |
| tree | 9e4ff1075680201f9c72b58bf780638ef1fcede3 /src/test/ui/resolve | |
| parent | 7b2deb562822112cc30d23958e7459564e2c6ef9 (diff) | |
| download | rust-07e7823c01be1733df2480de19fbbe6b8e9384cf.tar.gz rust-07e7823c01be1733df2480de19fbbe6b8e9384cf.zip | |
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.
Diffstat (limited to 'src/test/ui/resolve')
4 files changed, 16 insertions, 16 deletions
diff --git a/src/test/ui/resolve/issue-5035-2.stderr b/src/test/ui/resolve/issue-5035-2.stderr index 4ed93ad3279..5078ffbec73 100644 --- a/src/test/ui/resolve/issue-5035-2.stderr +++ b/src/test/ui/resolve/issue-5035-2.stderr @@ -4,7 +4,7 @@ error[E0277]: the size for values of type `(dyn I + 'static)` cannot be known at LL | fn foo(_x: K) {} | ^^ doesn't have a size known at compile-time | - = help: the trait `std::marker::Sized` is not implemented for `(dyn I + 'static)` + = help: the trait `Sized` is not implemented for `(dyn I + 'static)` = help: unsized locals are gated as an unstable feature help: function arguments must have a statically known size, borrowed types always have a known size | diff --git a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr index a324d04d394..9b59e415011 100644 --- a/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr +++ b/src/test/ui/resolve/issue-70736-async-fn-no-body-def-collector.stderr @@ -57,7 +57,7 @@ LL | async fn associated(); | expected `()`, found opaque type | = note: expected fn pointer `fn()` - found fn pointer `fn() -> impl std::future::Future` + found fn pointer `fn() -> impl Future` error: aborting due to 6 previous errors diff --git a/src/test/ui/resolve/name-clash-nullary.stderr b/src/test/ui/resolve/name-clash-nullary.stderr index 2de0b6a4969..76c4b5914c1 100644 --- a/src/test/ui/resolve/name-clash-nullary.stderr +++ b/src/test/ui/resolve/name-clash-nullary.stderr @@ -4,10 +4,10 @@ error[E0308]: mismatched types LL | let None: isize = 42; | ^^^^ ----- expected due to this | | - | expected `isize`, found enum `std::option::Option` + | expected `isize`, found enum `Option` | = note: expected type `isize` - found enum `std::option::Option<_>` + found enum `Option<_>` error: aborting due to previous error diff --git a/src/test/ui/resolve/privacy-enum-ctor.stderr b/src/test/ui/resolve/privacy-enum-ctor.stderr index f1ed7aaa867..32eff151196 100644 --- a/src/test/ui/resolve/privacy-enum-ctor.stderr +++ b/src/test/ui/resolve/privacy-enum-ctor.stderr @@ -260,15 +260,15 @@ error[E0308]: mismatched types --> $DIR/privacy-enum-ctor.rs:27:20 | LL | Fn(u8), - | ------ fn(u8) -> m::n::Z {m::n::Z::Fn} defined here + | ------ fn(u8) -> Z {Z::Fn} defined here ... LL | let _: Z = Z::Fn; - | - ^^^^^ expected enum `m::n::Z`, found fn item + | - ^^^^^ expected enum `Z`, found fn item | | | expected due to this | - = note: expected enum `m::n::Z` - found fn item `fn(u8) -> m::n::Z {m::n::Z::Fn}` + = note: expected enum `Z` + found fn item `fn(u8) -> Z {Z::Fn}` help: use parentheses to instantiate this tuple variant | LL | let _: Z = Z::Fn(_); @@ -294,15 +294,15 @@ error[E0308]: mismatched types --> $DIR/privacy-enum-ctor.rs:43:16 | LL | Fn(u8), - | ------ fn(u8) -> m::E {m::E::Fn} defined here + | ------ fn(u8) -> E {E::Fn} defined here ... LL | let _: E = m::E::Fn; - | - ^^^^^^^^ expected enum `m::E`, found fn item + | - ^^^^^^^^ expected enum `E`, found fn item | | | expected due to this | - = note: expected enum `m::E` - found fn item `fn(u8) -> m::E {m::E::Fn}` + = note: expected enum `E` + found fn item `fn(u8) -> E {E::Fn}` help: use parentheses to instantiate this tuple variant | LL | let _: E = m::E::Fn(_); @@ -328,15 +328,15 @@ error[E0308]: mismatched types --> $DIR/privacy-enum-ctor.rs:51:16 | LL | Fn(u8), - | ------ fn(u8) -> m::E {m::E::Fn} defined here + | ------ fn(u8) -> E {E::Fn} defined here ... LL | let _: E = E::Fn; - | - ^^^^^ expected enum `m::E`, found fn item + | - ^^^^^ expected enum `E`, found fn item | | | expected due to this | - = note: expected enum `m::E` - found fn item `fn(u8) -> m::E {m::E::Fn}` + = note: expected enum `E` + found fn item `fn(u8) -> E {E::Fn}` help: use parentheses to instantiate this tuple variant | LL | let _: E = E::Fn(_); |
