diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2017-06-02 09:10:43 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-02 09:10:43 -0600 |
| commit | 85e5e20363cb4e37db4459a74ff66100834f817a (patch) | |
| tree | 20d4651721f117e951189f29b32a16216def04c5 /src/libsyntax/parse | |
| parent | 1316281f2d9ee2ae0aa635741a418e32b59dcc26 (diff) | |
| parent | 22c4ee365c3b921859e0a325a559b3d41f49c4bb (diff) | |
| download | rust-85e5e20363cb4e37db4459a74ff66100834f817a.tar.gz rust-85e5e20363cb4e37db4459a74ff66100834f817a.zip | |
Rollup merge of #42319 - Manishearth:const-extern, r=nikomatsakis
Improve error message for const extern fn It's currently ``error: unmatched visibility `pub` ``, which is a nonsensical error in this context.
Diffstat (limited to 'src/libsyntax/parse')
| -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) => { |
