Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error message with unsafe functions in extern blocks #27361

Closed
kirillkh opened this issue Jul 28, 2015 · 1 comment
Closed

Confusing error message with unsafe functions in extern blocks #27361

kirillkh opened this issue Jul 28, 2015 · 1 comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints

Comments

@kirillkh
Copy link

This code produces "error: expected one of fn, pub, static, or unsafe, found unsafe":

extern { unsafe fn foo(); }
@Aatch Aatch changed the title error: expected one of <...> unsafe, found unsafe Confusing error message with unsafe functions in extern blocks Jul 29, 2015
@Aatch Aatch added the A-diagnostics Area: Messages for errors, warnings, and lints label Jul 29, 2015
@Aatch
Copy link
Contributor

Aatch commented Jul 29, 2015

That code sample probably didn't require linking to a playpen, I've made the description and title more useful.

birkenfeld added a commit to birkenfeld/rust that referenced this issue May 2, 2016
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: rust-lang#27361
steveklabnik added a commit to steveklabnik/rust that referenced this issue May 5, 2016
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: rust-lang#27361
steveklabnik added a commit to steveklabnik/rust that referenced this issue May 5, 2016
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: rust-lang#27361
steveklabnik added a commit to steveklabnik/rust that referenced this issue May 5, 2016
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: rust-lang#27361
steveklabnik added a commit to steveklabnik/rust that referenced this issue May 6, 2016
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: rust-lang#27361
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue May 7, 2016
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: rust-lang#27361
steveklabnik added a commit to steveklabnik/rust that referenced this issue May 7, 2016
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: rust-lang#27361
steveklabnik added a commit to steveklabnik/rust that referenced this issue May 7, 2016
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: rust-lang#27361
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints
Projects
None yet
Development

No branches or pull requests

2 participants