Commit Graph

14 Commits

Author SHA1 Message Date
Yiming Lei
54d35e71a6 distinguish the method and associated function diagnostic information
Methods are defined within the context of a struct and their first parameter is always self
Associated functions don’t take self as a parameter
	modified:   compiler/rustc_typeck/src/check/method/suggest.rs
	modified:   src/test/ui/auto-ref-slice-plus-ref.stderr
	modified:   src/test/ui/block-result/issue-3563.stderr
	modified:   src/test/ui/issues/issue-28344.stderr
	modified:   src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr
	modified:   src/test/ui/suggestions/suggest-methods.stderr
	modified:   src/test/ui/traits/trait-upcasting/subtrait-method.stderr
2022-07-08 17:23:36 -07:00
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
Mark Mansi
b6518f0f66 update tests 2020-03-12 15:47:36 -05:00
Esteban Küber
c764a82310 keep predicate order and tweak output 2020-02-28 11:37:59 -08:00
Esteban Küber
1e7bcc733a Tweak wording 2020-02-28 11:37:59 -08:00
Esteban Küber
0387f0d19b Mention the full path of the implementing trait 2020-02-28 11:37:59 -08:00
Esteban Küber
8993b99ae2 On single local candidate, use span label 2020-02-28 11:37:58 -08:00
Esteban Küber
2c5766f2d4 Unify output of "variant not found" errors 2020-01-08 08:05:31 -08:00
Esteban Küber
5799fb419c Give method not found a primary span label 2019-09-08 18:27:02 -07:00
Andy Russell
757ef38431 improve unknown enum variant errors 2019-04-09 14:19:20 -04:00
Vadim Petrochenkov
fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Esteban Küber
45a95b512c Use structured suggestion in stead of notes 2019-01-20 21:41:25 -08:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
David Wood
3fc7ab2373 Merged migrated compile-fail tests and ui tests. Fixes #46841. 2018-08-14 11:12:09 +02:00