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.
This commit is contained in:
commit
85e5e20363
@ -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) => {
|
||||
|
@ -12,5 +12,5 @@
|
||||
|
||||
extern {
|
||||
const i: isize;
|
||||
//~^ ERROR expected one of `fn`, `pub`, `static`, or `}`, found `const`
|
||||
//~^ ERROR extern items cannot be `const`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user