about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-12 06:07:36 +0100
committerGitHub <noreply@github.com>2025-02-12 06:07:36 +0100
commit5ebacd1b3c70bd5481009dc283b9f9d723cbc303 (patch)
tree28850851d1daf710c33f745b92ec98efeb431647 /compiler/rustc_codegen_llvm/src
parent9e89feefb9ce0309cc7fdba91b4e42c4bfe7bbb8 (diff)
parent576db131a38ccb53f9fbbe314e6bce37503c0050 (diff)
downloadrust-5ebacd1b3c70bd5481009dc283b9f9d723cbc303.tar.gz
rust-5ebacd1b3c70bd5481009dc283b9f9d723cbc303.zip
Rollup merge of #135965 - estebank:shorten-ty-sugg, r=lcnr
In "specify type" suggestion, skip type params that are already known

When we suggest specifying a type for an expression or pattern, like in a `let` binding, we previously would print the entire type as the type system knew it. We now look at the params that have *no* inference variables, so they are fully known to the type system which means that they don't need to be specified.

This helps in suggestions for types that are really long, because we can usually skip most of the type params and make the annotation as short as possible:

```
error[E0282]: type annotations needed for `Result<_, ((..., ..., ..., ...), ..., ..., ...)>`
  --> $DIR/really-long-type-in-let-binding-without-sufficient-type-info.rs:7:9
   |
LL |     let y = Err(x);
   |         ^   ------ type must be known at this point
   |
help: consider giving `y` an explicit type, where the type for type parameter `T` is specified
   |
LL |     let y: Result<T, _> = Err(x);
   |          ++++++++++++++
```

Fix #135919.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions