1
Fork 0
rust/compiler/rustc_session/src
Esteban Küber d12ecaed55 Teach structured errors to display short Ty
Make it so that every structured error annotated with `#[derive(Diagnostic)]` that has a field of type `Ty<'_>`, the printing of that value into a `String` will look at the thread-local storage `TyCtxt` in order to shorten to a length appropriate with the terminal width. When this happen, the resulting error will have a note with the file where the full type name was written to.

```
error[E0618]: expected function, found `((..., ..., ..., ...), ..., ..., ...)``
 --> long.rs:7:5
  |
6 | fn foo(x: D) { //~ `x` has type `(...
  |        - `x` has type `((..., ..., ..., ...), ..., ..., ...)`
7 |     x(); //~ ERROR expected function, found `(...
  |     ^--
  |     |
  |     call expression requires function
  |
  = note: the full name for the type has been written to 'long.long-type-14182675702747116984.txt'
  = note: consider using `--verbose` to print the full type name to the console
```
2025-02-25 16:56:03 +00:00
..
config Rollup merge of #137072 - Urgau:check-cfg-load-builtins-at-once, r=Noratrieb 2025-02-16 17:14:04 +01:00
code_stats.rs Remove print_vtable_sizes 2025-01-30 15:30:04 +00:00
config.rs Teach structured errors to display short Ty 2025-02-25 16:56:03 +00:00
cstore.rs Update comments 2024-12-19 15:30:32 +00:00
errors.rs Reject macro calls inside of #![crate_name] 2025-02-15 16:47:30 +01:00
filesearch.rs bumpt compiler and tools to windows 0.59 2025-01-21 16:48:44 +03:00
lib.rs Rollup merge of #136152 - Urgau:stabilize-map_many_mut, r=joshtriplett 2025-02-06 21:56:26 +01:00
options.rs Auto merge of #137420 - matthiaskrgr:rollup-rr0q37f, r=matthiaskrgr 2025-02-22 13:32:44 +00:00
output.rs Reject macro calls inside of #![crate_name] 2025-02-15 16:47:30 +01:00
parse.rs Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
search_paths.rs Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
session.rs Teach structured errors to display short Ty 2025-02-25 16:56:03 +00:00
utils.rs remove a couple of redundant String to String conversion 2024-10-12 22:07:46 +02:00