about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorZack M. Davis <code@zackmdavis.net>2017-10-15 19:02:45 -0700
committerZack M. Davis <code@zackmdavis.net>2017-10-15 19:41:12 -0700
commit696612c02f7e64b8ca5f62c4614d0cb5b20ff9b7 (patch)
tree4457a2df6346db645ac5d4118804c9de527de422 /src/libsyntax/parse
parent29ed49fb0aeab444adcfe16ef3d04e5e910fb08d (diff)
downloadrust-696612c02f7e64b8ca5f62c4614d0cb5b20ff9b7.tar.gz
rust-696612c02f7e64b8ca5f62c4614d0cb5b20ff9b7.zip
don't issue "expected statement after outer attr." after inner attr.
While an inner attribute here is in fact erroneous, that error ("inner
attribute is not permitted in this context") successfully gets set earlier;
this further admonition is nonsensical.

Resolves #45296.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index bd400ef6dd6..8fd2bad4e44 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4088,11 +4088,11 @@ impl<'a> Parser<'a> {
                     node: StmtKind::Item(i),
                 },
                 None => {
-                    let unused_attrs = |attrs: &[_], s: &mut Self| {
+                    let unused_attrs = |attrs: &[Attribute], s: &mut Self| {
                         if !attrs.is_empty() {
                             if s.prev_token_kind == PrevTokenKind::DocComment {
                                 s.span_fatal_err(s.prev_span, Error::UselessDocComment).emit();
-                            } else {
+                            } else if attrs.iter().any(|a| a.style == AttrStyle::Outer) {
                                 s.span_err(s.span, "expected statement after outer attribute");
                             }
                         }