Issue by dwrensha
_Sunday Nov 09, 2014 at 14:25 GMT_
_For earlier discussion, see https://github.com/rust-lang/rust/issues/18810_
_This issue was labelled with: in the Rust repository_
// test.rs
pub mod included {
include!("test_included.rs")
}
fn main() {}
// test_included.rs
#![allow(dead_code)]
pub fn foo() {}
$ rustc test.rs
test_included.rs:3:3: 3:4 error: an inner attribute is not permitted in this context
test_included.rs:3 #![allow(dead_code)]
^
error: aborting due to previous error
I at first thought that the problem was due to the implicit insert of the prelude in the included module. However, adding a #[no_implicit_prelude] attribute does not help.
Is this fixed by https://github.com/rust-lang/meeting-minutes/blob/master/weekly-meetings/2015-01-20.md#goodbye-view-items ?
On the latest nightly, I still get the same error (after inserting a semicolon to account for the new macro syntax).
Future searchers: I stumbled on this issue as I created a generated module in build.rs and https://github.com/rust-lang/rust/issues/18810 contained a work around that helped me.
After running into this issue still, I implemented a hacky workaround for this issue with the upcoming procedural macros feature: https://github.com/peterhuene/azure-functions-rs/blob/master/azure-functions-shared-codegen/src/lib.rs
Future searchers: I stumbled on this issue as I created a generated module in
build.rsand rust-lang/rust#18810 contained a work around that helped me.
Future searchers who happen to be rust newbies might be interested to know what you mean by "a work around"
I read the ticket, nothing jumped out at me, and everything I tried failed to yield any result.
I am following this guide for bindgen:
https://rust-lang.github.io/rust-bindgen/tutorial-4.html
and getting this:
error: an inner attribute is not permitted in this context
|
6 | #![allow(non_snake_case)];
| ^^^^^^^^^^^^^^^^^^^^^^^^^
It is hard to google for the difference between #![allow... and #[allow... and although the error explains what the difference between an inner and outer attribute is, it doesn't explain help me understand why the tutorial doesn't work as explained.
Most helpful comment
Future searchers who happen to be rust newbies might be interested to know what you mean by "a work around"
I read the ticket, nothing jumped out at me, and everything I tried failed to yield any result.
I am following this guide for bindgen:
https://rust-lang.github.io/rust-bindgen/tutorial-4.html
and getting this:
error: an inner attribute is not permitted in this context
|
6 | #![allow(non_snake_case)];
| ^^^^^^^^^^^^^^^^^^^^^^^^^
It is hard to google for the difference between #![allow... and #[allow... and although the error explains what the difference between an inner and outer attribute is, it doesn't explain help me understand why the tutorial doesn't work as explained.