about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2017-05-30 14:23:02 -0700
committerManish Goregaokar <manishsmail@gmail.com>2017-05-31 11:26:19 -0700
commit22c4ee365c3b921859e0a325a559b3d41f49c4bb (patch)
tree6178f205f1b3147003dacadff2d344aef8b9acff /src/libsyntax/parse
parentf89d8d184490ecb3cf91f7b6bb7296d649f931ba (diff)
downloadrust-22c4ee365c3b921859e0a325a559b3d41f49c4bb.tar.gz
rust-22c4ee365c3b921859e0a325a559b3d41f49c4bb.zip
Improve error message for const extern fn
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 8d7c8c5248b..d0b6a8b9fed 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5981,6 +5981,10 @@ impl<'a> Parser<'a> {
             return Ok(Some(self.parse_item_foreign_fn(visibility, lo, attrs)?));
         }
 
+        if self.check_keyword(keywords::Const) {
+            return Err(self.span_fatal(self.span, "extern items cannot be `const`"));
+        }
+
         // FIXME #5668: this will occur for a macro invocation:
         match self.parse_macro_use_or_failure(attrs, true, false, lo, visibility)? {
             Some(item) => {