about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-11-11 04:26:57 +0000
committerbors <bors@rust-lang.org>2014-11-11 04:26:57 +0000
commit66c3c8e3e6e85c8e1dd6619bc3fcbf783a74f30f (patch)
treef56f7c86fd11affdd3272ac92d1c343f7704cc16 /src/libsyntax/parse
parent60820ba528a711d27562df87d6fd14524d67341f (diff)
parent0a52cc3534b7bc72e6fc20afdaac995ba80e44e1 (diff)
downloadrust-66c3c8e3e6e85c8e1dd6619bc3fcbf783a74f30f.tar.gz
rust-66c3c8e3e6e85c8e1dd6619bc3fcbf783a74f30f.zip
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"]
             ^
```
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/attr.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index aefac804e4d..0c919daa8ed 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -75,6 +75,8 @@ impl<'a> ParserAttr for Parser<'a> {
                         self.span_err(span,
                                       "an inner attribute is not permitted in \
                                        this context");
+                        self.span_help(span,
+                                       "place inner attribute at the top of the module or block");
                     }
                     ast::AttrInner
                 } else {