about summary refs log tree commit diff
path: root/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs')
-rw-r--r--tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs
new file mode 100644
index 00000000000..c1826f8caae
--- /dev/null
+++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.rs
@@ -0,0 +1,21 @@
+fn main() {
+    auto n = 0;//~ ERROR invalid variable declaration
+    //~^ HELP write `let` instead of `auto` to introduce a new variable
+    auto m;//~ ERROR invalid variable declaration
+    //~^ HELP write `let` instead of `auto` to introduce a new variable
+    m = 0;
+
+    var n = 0;//~ ERROR invalid variable declaration
+    //~^ HELP write `let` instead of `var` to introduce a new variable
+    var m;//~ ERROR invalid variable declaration
+    //~^ HELP write `let` instead of `var` to introduce a new variable
+    m = 0;
+
+    mut n = 0;//~ ERROR invalid variable declaration
+    //~^ HELP missing keyword
+    mut var;//~ ERROR invalid variable declaration
+    //~^ HELP missing keyword
+    var = 0;
+
+    let _recovery_witness: () = 0; //~ ERROR mismatched types
+}