about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMasaki Hara <ackie.h.gmai@gmail.com>2017-05-31 16:43:47 +0900
committerMasaki Hara <ackie.h.gmai@gmail.com>2017-05-31 16:43:47 +0900
commit0b8c3de678065b82ae955b65192b7927b467f7a6 (patch)
tree3594d2f84de0ff55093dc4094775b12d16900623 /src/libsyntax/parse
parented6c6c9a11f7deddbd1f209c5e7de12bc420c550 (diff)
downloadrust-0b8c3de678065b82ae955b65192b7927b467f7a6.tar.gz
rust-0b8c3de678065b82ae955b65192b7927b467f7a6.zip
Add warning cycle #42326.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 480049f845c..e8fbc00d36f 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -479,7 +479,20 @@ impl<'a> StringReader<'a> {
         }
 
         self.with_str_from(start, |string| {
-            Some(Symbol::intern(string))
+            if string == "_" {
+                self.sess.span_diagnostic
+                    .struct_span_warn(mk_sp(start, self.pos),
+                                      "underscore literal suffix is not allowed")
+                    .warn("this was previously accepted by the compiler but is \
+                          being phased out; it will become a hard error in \
+                          a future release!")
+                    .note("for more information, see issue #42326 \
+                          <https://github.com/rust-lang/rust/issues/42326>")
+                    .emit();
+                None
+            } else {
+                Some(Symbol::intern(string))
+            }
         })
     }