Skip to content

Commit 66c3c8e

Browse files
committed
auto merge of #18766 : liigo/rust/improve-inner-attr-msg, r=huonw
for the code: ``` use std::io; #![crate_type="rlib"] // ERROR: an inner attribute is not permitted in this context fn say_hello() { println!("hello"); } ``` this PR provides another note to help programmer fixing this error more easily: ``` hello.rs:6:3: 6:4 error: an inner attribute is not permitted in this context hello.rs:6 #![crate_type="rlib"] ^ hello.rs:6:3: 6:4 note: put inner attribute in top of file or block hello.rs:6 #![crate_type="rlib"] ^ ```
2 parents 60820ba + 0a52cc3 commit 66c3c8e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/libsyntax/parse/attr.rs

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ impl<'a> ParserAttr for Parser<'a> {
7575
self.span_err(span,
7676
"an inner attribute is not permitted in \
7777
this context");
78+
self.span_help(span,
79+
"place inner attribute at the top of the module or block");
7880
}
7981
ast::AttrInner
8082
} else {

0 commit comments

Comments
 (0)