about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/example/std_example.rs
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-02-26 19:03:55 +0100
committerGitHub <noreply@github.com>2025-02-26 19:03:55 +0100
commit5da5c373878a1cd505ee23bf07079eb9684dcf6a (patch)
tree08213176acfb14af5b2c010bb9975e785cfae08a /compiler/rustc_codegen_gcc/example/std_example.rs
parentf3a445bf7546327c0ef6584e046013f8490e7629 (diff)
parentc550bee64148a8f702f5fd18d4da75b93832c4df (diff)
downloadrust-5da5c373878a1cd505ee23bf07079eb9684dcf6a.tar.gz
rust-5da5c373878a1cd505ee23bf07079eb9684dcf6a.zip
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``
Diffstat (limited to 'compiler/rustc_codegen_gcc/example/std_example.rs')
0 files changed, 0 insertions, 0 deletions