Skip to content

Outer attribute where outer attributes considered as inner attribute by statement after attribute error #45296

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

Closed
Havvy opened this issue Oct 15, 2017 · 0 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@Havvy
Copy link
Contributor

Havvy commented Oct 15, 2017

fn main() {
    let unused = ();
    
    #![allow(unused_variables)]
}
   Compiling playground v0.0.1 (file:///playground)
error: an inner attribute is not permitted in this context
 --> src/main.rs:4:7
  |
4 |     #![allow(unused_variables)]
  |       ^
  |
  = note: inner attributes and doc comments, like `#![no_std]` or `//! My crate`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes and doc comments, like `#[test]` and
                                             `/// My function`, annotate the item following them.

error: expected statement after outer attribute
 --> src/main.rs:5:1
  |
5 | }
  | ^

error: aborting due to 2 previous errors

error: Could not compile `playground`.

The second error shouldn't occur.

@kennytm kennytm added the A-diagnostics Area: Messages for errors, warnings, and lints label Oct 15, 2017
zackmdavis added a commit to zackmdavis/rust that referenced this issue Oct 16, 2017
While an inner attribute here is in fact erroneous, that error ("inner
attribute is not permitted in this context") successfully gets set earlier;
this further admonition is nonsensical.

Resolves rust-lang#45296.
kennytm added a commit to kennytm/rust that referenced this issue Oct 17, 2017
…_outer_attr_after_inner_attr, r=petrochenkov

don't issue "expected statement after outer attr." after inner attr.

While an inner attribute here is in fact erroneous, that error ("inner
attribute is not permitted in this context") successfully gets set earlier;
this further admonition is nonsensical.

Resolves rust-lang#45296.
@TimNN TimNN added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Oct 17, 2017
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 C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants