diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-08-03 22:30:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-03 22:30:49 +0200 |
| commit | d4bd4ae27a50866a948d751b0c94ad2281f0e3cb (patch) | |
| tree | fd5bab56213854b3d8d827e80850bd5eae332206 /src/test/ui | |
| parent | 551224019b657828193ff7968eee228bed2c1897 (diff) | |
| parent | 939c2b63137e4b4f8c35d7cdc2b2d8bbb491e2dd (diff) | |
Rollup merge of #100111 - estebank:missing-let, r=compiler-errors
Provide suggestion on missing `let` in binding statement Fix #78907. Fallout from the type ascription syntax.
Diffstat (limited to 'src/test/ui')
| -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`. |
