about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2016-05-02 08:45:38 +0200
committerGeorg Brandl <georg@python.org>2016-05-02 12:49:31 +0200
commitb75f81c9b3f996100c72f9141dcf6161f8fc90f4 (patch)
treeea25571a1f22bc63f436a1791925125e4fe7e7f1 /src/libsyntax/parse
parent855fb6192263a5c059325bb4b4e10b55e4e8ddbb (diff)
downloadrust-b75f81c9b3f996100c72f9141dcf6161f8fc90f4.tar.gz
rust-b75f81c9b3f996100c72f9141dcf6161f8fc90f4.zip
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
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 671a11b57de..c22a36739d6 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -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)?));
         }