rust/compiler/rustc_codegen_ssa/src
León Orell Valerian Liehr 5da5c37387
Rollup merge of #137201 - estebank:structured-errors-long-ty, r=oli-obk
Teach structured errors to display short `Ty<'_>`

Make it so that in 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
```

Follow up to and response to the comments on #136898.

r? ``@oli-obk``
2025-02-26 19:03:55 +01:00
..
back Rollup merge of #136576 - usamoi:pass-more-llbc, r=fmease 2025-02-26 04:15:01 +01:00
debuginfo Move hashes from rustc_data_structure to rustc_hashes so they can be shared with rust-analyzer 2025-02-16 16:18:30 -05:00
mir ssa/mono: deduplicate type_has_metadata 2025-02-24 08:08:23 +00:00
traits ssa/mono: deduplicate type_has_metadata 2025-02-24 08:08:23 +00:00
assert_module_sources.rs Teach structured errors to display short Ty 2025-02-25 16:56:03 +00:00
base.rs Introduce new-style attribute parsers for several attributes 2025-02-24 14:31:17 +01:00
codegen_attrs.rs Introduce new-style attribute parsers for several attributes 2025-02-24 14:31:17 +01:00
common.rs Test fixing raw-dylib 2024-09-24 10:10:31 -07:00
errors.rs Teach structured errors to display short Ty 2025-02-25 16:56:03 +00:00
lib.rs Persist target features used for codegen beyond tcx 2025-02-16 21:57:03 +01:00
meth.rs More assertions, tests, and miri coverage 2025-01-30 17:44:28 +00:00
mono_item.rs Make a fake body to store typeck results for global_asm 2025-02-22 00:12:07 +00:00
size_of_val.rs Set both nuw and nsw in slice size calculation 2025-02-13 21:26:48 -08:00
target_features.rs add dedicated type for ABI target feature constraints 2025-01-05 10:46:30 +01:00