about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2016-05-02 07:27:43 +0200
committerGeorg Brandl <georg@python.org>2016-05-03 17:53:23 +0200
commit72560e14039525cf70bcf3343524790978a27475 (patch)
treeb6944ece137d262c99c7f0cffd390d9297dc913e /src/libsyntax
parent3157691f963a86776cb7e6a7842f566032890aba (diff)
downloadrust-72560e14039525cf70bcf3343524790978a27475.tar.gz
rust-72560e14039525cf70bcf3343524790978a27475.zip
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();