about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-03-08 14:27:23 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-03-17 22:08:07 +0300
commit5d06c890fececc6f6779cd65ca83cef4647b8fdd (patch)
tree7ffd581b7c7b9ac7294ecb6f28994b1afe753659 /src/test
parent61b6bf54fdf56195baf9a8ee7383551b0d468c81 (diff)
downloadrust-5d06c890fececc6f6779cd65ca83cef4647b8fdd.tar.gz
rust-5d06c890fececc6f6779cd65ca83cef4647b8fdd.zip
syntax: Make `_` an identifier
Diffstat (limited to 'src/test')
-rw-r--r--src/test/parse-fail/issue-32501.rs4
-rw-r--r--src/test/parse-fail/recover-enum2.rs2
-rw-r--r--src/test/parse-fail/underscore-suffix-for-float.rs3
-rw-r--r--src/test/run-pass/macro-pat.rs2
-rw-r--r--src/test/ui/cross-file-errors/main.stderr2
5 files changed, 7 insertions, 6 deletions
diff --git a/src/test/parse-fail/issue-32501.rs b/src/test/parse-fail/issue-32501.rs
index f29c1fa2794..21db2f50517 100644
--- a/src/test/parse-fail/issue-32501.rs
+++ b/src/test/parse-fail/issue-32501.rs
@@ -16,7 +16,5 @@ fn main() {
     let _ = 0;
     let mut b = 0;
     let mut _b = 0;
-    let mut _ = 0; //~ ERROR expected identifier, found `_`
-    //~^ NOTE `_` is a wildcard pattern, not an identifier
-    //~| NOTE expected identifier
+    let mut _ = 0; //~ ERROR expected identifier, found reserved identifier `_`
 }
diff --git a/src/test/parse-fail/recover-enum2.rs b/src/test/parse-fail/recover-enum2.rs
index 49380a03e15..6fd32f842f1 100644
--- a/src/test/parse-fail/recover-enum2.rs
+++ b/src/test/parse-fail/recover-enum2.rs
@@ -39,5 +39,5 @@ fn main() {
         }
     }
     // still recover later
-    let bad_syntax = _; //~ ERROR: found `_`
+    let bad_syntax = _; //~ ERROR: expected expression, found reserved identifier `_`
 }
diff --git a/src/test/parse-fail/underscore-suffix-for-float.rs b/src/test/parse-fail/underscore-suffix-for-float.rs
index df7d9aa374d..8327217e6f2 100644
--- a/src/test/parse-fail/underscore-suffix-for-float.rs
+++ b/src/test/parse-fail/underscore-suffix-for-float.rs
@@ -9,5 +9,6 @@
 // except according to those terms.
 
 fn main() {
-    let a = 42._; //~ ERROR unexpected token: `_`
+    let a = 42._; //~ ERROR expected identifier, found reserved identifier `_`
+                  //~^ ERROR `{integer}` is a primitive type and therefore doesn't have fields
 }
diff --git a/src/test/run-pass/macro-pat.rs b/src/test/run-pass/macro-pat.rs
index 48e521de57e..8de3996245f 100644
--- a/src/test/run-pass/macro-pat.rs
+++ b/src/test/run-pass/macro-pat.rs
@@ -71,4 +71,6 @@ pub fn main() {
         let ident_pat!(x) = 2;
         x+1
     });
+
+    let ident_pat!(_) = 2; // OK
 }
diff --git a/src/test/ui/cross-file-errors/main.stderr b/src/test/ui/cross-file-errors/main.stderr
index a9db5214e6a..41a2172d295 100644
--- a/src/test/ui/cross-file-errors/main.stderr
+++ b/src/test/ui/cross-file-errors/main.stderr
@@ -1,4 +1,4 @@
-error: expected expression, found `_`
+error: expected expression, found reserved identifier `_`
   --> $DIR/underscore.rs:18:9
    |
 LL |         _