Provide suggestion on missing let in binding statement

Fix #78907.
This commit is contained in:
Esteban Küber 2022-08-03 09:29:29 -07:00
parent 7308c22c6a
commit 939c2b6313
4 changed files with 53 additions and 3 deletions

View file

@ -0,0 +1,5 @@
// run-rustfix
fn main() {
let mut _foo: i32 = 1;
let _foo: i32 = 4; //~ ERROR type ascription is experimental
}

View file

@ -0,0 +1,5 @@
// run-rustfix
fn main() {
let mut _foo: i32 = 1;
_foo: i32 = 4; //~ ERROR type ascription is experimental
}

View file

@ -0,0 +1,16 @@
error[E0658]: type ascription is experimental
--> $DIR/missing-let-in-binding.rs:4:5
|
LL | _foo: i32 = 4;
| ^^^^^^^^^
|
= note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
= help: add `#![feature(type_ascription)]` to the crate attributes to enable
help: you might have meant to introduce a new binding
|
LL | let _foo: i32 = 4;
| +++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.