about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-05-07 03:01:44 -0700
committerbors <bors@rust-lang.org>2016-05-07 03:01:44 -0700
commit0d61bb3b497e3e0c788315dd8756f3dc18060c69 (patch)
tree8dd00fefc0daba24f18d339e0068ecf0755cde7b /src/libsyntax
parenta9cc5b097ec8171b093fc507749bf742d536ffcf (diff)
parent72560e14039525cf70bcf3343524790978a27475 (diff)
downloadrust-0d61bb3b497e3e0c788315dd8756f3dc18060c69.tar.gz
rust-0d61bb3b497e3e0c788315dd8756f3dc18060c69.zip
Auto merge of #33333 - birkenfeld:issue-30318, r=Manishearth
parser: show a helpful note on unexpected inner comment

Fixes: #30318.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/attr.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 3aac12d76ff..db643eb0df0 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -35,7 +35,10 @@ impl<'a> Parser<'a> {
                     self.span.hi
                 );
                     if attr.node.style != ast::AttrStyle::Outer {
-                        return Err(self.fatal("expected outer comment"));
+                        let mut err = self.fatal("expected outer doc comment");
+                        err.note("inner doc comments like this (starting with \
+                                  `//!` or `/*!`) can only appear before items");
+                        return Err(err);
                     }
                     attrs.push(attr);
                     self.bump();