Commit Graph

4556 Commits

Author SHA1 Message Date
LeSeulArtichaut
3e14b684dd Change ty.kind to a method 2020-09-04 17:47:51 +02:00
Dan Aloni
51742be6d8 specialization_graph: avoid trimmed paths for OverlapError 2020-09-03 14:09:50 +03: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
Dan Aloni
75a042e74b Fix some unwanted uses of Debug formatting on user-facing messages
While formatting for user diagnostics used `Display` for all most cases,
some small amount of cases used `Debug` instead.  Until now, `Display`
and `Debug` yielded the same output for many types. However, with path
trimming, we want to show a shorter path for the user, these cases need
fixing.
2020-09-02 10:40:10 +03:00
kadmin
8894b366fd Remove error message in specific case
In the case that a trait is not implemented for an ADT with type errors, cancel the error.
2020-08-30 19:39:51 +00:00
mark
9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00