diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2022-08-03 09:29:29 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2022-08-03 09:29:29 -0700 |
| commit | 939c2b63137e4b4f8c35d7cdc2b2d8bbb491e2dd (patch) | |
| tree | 2fed9e24903051eae60f8453b2cc0cb8a4ee1cef /src | |
| parent | 7308c22c6a8d77e82187e290e1f7459870e48d12 (diff) | |
| download | rust-939c2b63137e4b4f8c35d7cdc2b2d8bbb491e2dd.tar.gz rust-939c2b63137e4b4f8c35d7cdc2b2d8bbb491e2dd.zip | |
Provide suggestion on missing `let` in binding statement
Fix #78907.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/type/missing-let-in-binding.fixed | 5 | ||||
| -rw-r--r-- | src/test/ui/type/missing-let-in-binding.rs | 5 | ||||
| -rw-r--r-- | src/test/ui/type/missing-let-in-binding.stderr | 16 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/test/ui/type/missing-let-in-binding.fixed b/src/test/ui/type/missing-let-in-binding.fixed new file mode 100644 index 00000000000..d1787688950 --- /dev/null +++ b/src/test/ui/type/missing-let-in-binding.fixed @@ -0,0 +1,5 @@ +// run-rustfix +fn main() { + let mut _foo: i32 = 1; + let _foo: i32 = 4; //~ ERROR type ascription is experimental +} diff --git a/src/test/ui/type/missing-let-in-binding.rs b/src/test/ui/type/missing-let-in-binding.rs new file mode 100644 index 00000000000..ca42f2e6eac --- /dev/null +++ b/src/test/ui/type/missing-let-in-binding.rs @@ -0,0 +1,5 @@ +// run-rustfix +fn main() { + let mut _foo: i32 = 1; + _foo: i32 = 4; //~ ERROR type ascription is experimental +} diff --git a/src/test/ui/type/missing-let-in-binding.stderr b/src/test/ui/type/missing-let-in-binding.stderr new file mode 100644 index 00000000000..12759c5096e --- /dev/null +++ b/src/test/ui/type/missing-let-in-binding.stderr @@ -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`. |
