diff options
| author | Georg Brandl <georg@python.org> | 2016-05-02 07:27:43 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2016-05-03 17:53:23 +0200 |
| commit | 72560e14039525cf70bcf3343524790978a27475 (patch) | |
| tree | b6944ece137d262c99c7f0cffd390d9297dc913e /src/libsyntax | |
| parent | 3157691f963a86776cb7e6a7842f566032890aba (diff) | |
| download | rust-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.rs | 5 |
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(); |
