parser: do not try to continue with unsafe on foreign fns
The changed line makes it look like `unsafe` is allowed, but the first statement of `parse_item_foreign_fn` is: `self.expect_keyword(keywords::Fn)?;` So we get the strange "expected one of `fn`, `pub`, `static`, or `unsafe`, found `unsafe`". Fixes: #27361
This commit is contained in:
@@ -6025,7 +6025,7 @@ impl<'a> Parser<'a> {
|
||||
// FOREIGN STATIC ITEM
|
||||
return Ok(Some(self.parse_item_foreign_static(visibility, lo, attrs)?));
|
||||
}
|
||||
if self.check_keyword(keywords::Fn) || self.check_keyword(keywords::Unsafe) {
|
||||
if self.check_keyword(keywords::Fn) {
|
||||
// FOREIGN FUNCTION ITEM
|
||||
return Ok(Some(self.parse_item_foreign_fn(visibility, lo, attrs)?));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user