Skip to content

Commit 42ef3f1

Browse files
committed
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`).
1 parent f0fe716 commit 42ef3f1

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/libsyntax/parse/attr.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,10 @@ impl<'a> Parser<'a> {
105105
let span = self.span;
106106
self.diagnostic()
107107
.struct_span_err(span, reason)
108-
.note("inner attributes and doc comments, like `#![no_std]` or \
109-
`//! My crate`, annotate the item enclosing them, and are \
110-
usually found at the beginning of source files. Outer \
111-
attributes and doc comments, like `#[test]` and
112-
`/// My function`, annotate the item following them.")
108+
.note("inner attributes, like `#![no_std]`, annotate the item \
109+
enclosing them, and are usually found at the beginning of \
110+
source files. Outer attributes, like `#[test]`, annotate the \
111+
item following them.")
113112
.emit()
114113
}
115114
ast::AttrStyle::Inner

src/test/ui/issue-45296.stderr

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ error: an inner attribute is not permitted in this context
44
14 | #![allow(unused_variables)]
55
| ^
66
|
7-
= 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
8-
`/// My function`, annotate the item following them.
7+
= 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.
98

109
error: aborting due to previous error
1110

0 commit comments

Comments
 (0)