8bb094dac5
When encountering code where type inference fails, add more actionable information: ``` fn main() { let foo = Vec::new(); } ``` ``` error[E0282]: type annotations needed for `std::vec::Vec<_>` --> $DIR/vector-no-ann.rs:2:16 | LL | let foo = Vec::new(); | --- ^^^^^^^^ cannot infer type for `T` | | | consider giving `foo` the type `std::vec::Vec<_>` with the type parameter `T` specified ``` We still need to modify type printing to optionally accept a `TypeVariableTable` in order to properly print `std::vec::Vec<T>`. CC #25633.
9 lines
116 B
Rust
9 lines
116 B
Rust
fn new<'r, T>() -> &'r T {
|
|
panic!()
|
|
}
|
|
|
|
fn main() {
|
|
let &v = new();
|
|
//~^ ERROR type annotations needed
|
|
}
|