rust/src/test/ui/pattern/usefulness
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
..
always-inhabited-union-ref.rs
always-inhabited-union-ref.stderr
exhaustive_integer_patterns.rs
exhaustive_integer_patterns.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
guards-not-exhaustive.rs
irrefutable-exhaustive-integer-binding.rs
irrefutable-unit.rs
issue-35609.rs
issue-35609.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
issue-43253.rs
issue-43253.stderr
issue-53820-slice-pattern-large-array.rs
issue-65413-constants-and-slices-exhaustiveness.rs
issue-71930-type-of-match-scrutinee.rs
issue-72476-associated-type.rs
match-arm-statics-2.rs
match-arm-statics-2.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
match-arm-statics.rs
match-arm-statics.stderr
match-byte-array-patterns-2.rs
match-byte-array-patterns-2.stderr
match-byte-array-patterns.rs
match-byte-array-patterns.stderr
match-empty-exhaustive_patterns.rs
match-empty-exhaustive_patterns.stderr
match-empty.rs
match-empty.stderr
match-non-exhaustive.rs
match-non-exhaustive.stderr
match-privately-empty.rs
match-privately-empty.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
match-range-fail-dominate.rs
match-range-fail-dominate.stderr
match-ref-ice.rs
match-ref-ice.stderr
match-slice-patterns.rs
match-slice-patterns.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
match-vec-fixed.rs
match-vec-fixed.stderr
match-vec-unreachable.rs
match-vec-unreachable.stderr
nested-exhaustive-match.rs
non-exhaustive-defined-here.rs
non-exhaustive-defined-here.stderr
non-exhaustive-float-range-match.rs
non-exhaustive-float-range-match.stderr
non-exhaustive-match-nested.rs
non-exhaustive-match-nested.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
non-exhaustive-match.rs
non-exhaustive-match.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
non-exhaustive-pattern-pointer-size-int.rs Address code reviews 2020-07-05 03:43:43 +09:00
non-exhaustive-pattern-pointer-size-int.stderr Address code reviews 2020-07-05 03:43:43 +09:00
non-exhaustive-pattern-witness.rs
non-exhaustive-pattern-witness.stderr
refutable-pattern-errors.rs
refutable-pattern-errors.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
refutable-pattern-in-fn-arg.rs
refutable-pattern-in-fn-arg.stderr
slice-pattern-const-2.rs
slice-pattern-const-2.stderr
slice-pattern-const-3.rs
slice-pattern-const-3.stderr
slice-pattern-const.rs
slice-pattern-const.stderr
slice-patterns-exhaustiveness.rs
slice-patterns-exhaustiveness.stderr
slice-patterns-irrefutable.rs
slice-patterns-reachability.rs
slice-patterns-reachability.stderr
struct-like-enum-nonexhaustive.rs
struct-like-enum-nonexhaustive.stderr
struct-pattern-match-useless.rs
struct-pattern-match-useless.stderr
top-level-alternation.rs
top-level-alternation.stderr
tuple-struct-nonexhaustive.rs
tuple-struct-nonexhaustive.stderr