Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
edit and fix bad spacing of inner-attribute-not-allowed note
This multiline string literal was missing a backslash, leaving an awkward
newline and 35 spaces in the middle of the message.

But while we're here, the existing message seems kind of long in comparison to
similar notes: to cut it down, we excise the mentions of doc comments, which
seems sensible because we know that this erroneous attribute is not a doc
comment (notice the `is_sugared_doc: false` at the end of the function; if it
had been a doc comment, that error would get set in the `token::DocComment`
match branch of `parse_outer_attributes`).
  • Loading branch information
zackmdavis committed Oct 31, 2017
1 parent f0fe716 commit 42ef3f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 4 additions & 5 deletions src/libsyntax/parse/attr.rs
Expand Up @@ -105,11 +105,10 @@ impl<'a> Parser<'a> {
let span = self.span;
self.diagnostic()
.struct_span_err(span, reason)
.note("inner attributes and doc comments, like `#![no_std]` or \
`//! My crate`, annotate the item enclosing them, and are \
usually found at the beginning of source files. Outer \
attributes and doc comments, like `#[test]` and
`/// My function`, annotate the item following them.")
.note("inner attributes, like `#![no_std]`, annotate the item \
enclosing them, and are usually found at the beginning of \
source files. Outer attributes, like `#[test]`, annotate the \
item following them.")
.emit()
}
ast::AttrStyle::Inner
Expand Down
3 changes: 1 addition & 2 deletions src/test/ui/issue-45296.stderr
Expand Up @@ -4,8 +4,7 @@ error: an inner attribute is not permitted in this context
14 | #![allow(unused_variables)]
| ^
|
= note: inner attributes and doc comments, like `#![no_std]` or `//! My crate`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes and doc comments, like `#[test]` and
`/// My function`, annotate the item following them.
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.

error: aborting due to previous error

0 comments on commit 42ef3f1

Please sign in to comment.