rust/compiler/rustc_resolve/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
..
late Fix binding mode problems 2025-02-22 00:13:19 +00:00
build_reduced_graph.rs convert all_macro_rules from hashmap to hashset 2025-02-21 15:29:17 +03:00
check_unused.rs Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
def_collector.rs lower attr spans and inline some functions to hopefully mitigate perf regressions 2025-02-24 14:37:58 +01:00
diagnostics.rs Rollup merge of #137529 - klensy:unused3, r=lcnr 2025-02-26 04:15:04 +01:00
effective_visibilities.rs rustc_resolve: reduce rightwards drift with let..else 👉💨 2025-01-21 13:42:32 +00:00
errors.rs Use identifiers in diagnostics more often 2025-01-27 01:23:34 +00:00
ident.rs Rustfmt 2025-02-08 22:12:13 +00:00
imports.rs Rollup merge of #137529 - klensy:unused3, r=lcnr 2025-02-26 04:15:04 +01:00
late.rs Teach structured errors to display short Ty 2025-02-25 16:56:03 +00:00
lib.rs stabilize extract_if 2025-02-23 21:11:12 +07:00
macros.rs Introduce new-style attribute parsers for several attributes 2025-02-24 14:31:17 +01:00
rustdoc.rs rustdoc: improve refdef handling in the unresolved link lint 2025-02-15 12:21:35 -07:00