mirror of https://github.com/rust-lang/rust.git
![]() 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); | ++++++++++++++ ``` |
||
---|---|---|
.. | ||
generalize-subtyped-variables.rs | ||
issue-30225.rs | ||
issue-30225.stderr | ||
issue-113283-alllocator-trait-eq.rs | ||
or_else-multiple-type-params.rs | ||
or_else-multiple-type-params.stderr | ||
sort_by_key.rs | ||
sort_by_key.stderr | ||
unbounded-associated-type.rs | ||
unbounded-associated-type.stderr | ||
unbounded-type-param-in-fn-with-assoc-type.rs | ||
unbounded-type-param-in-fn-with-assoc-type.stderr | ||
unbounded-type-param-in-fn.rs | ||
unbounded-type-param-in-fn.stderr |