diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 936a2e8b2e1..d9cb2b4ab7d 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5985,6 +5985,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) => { |
