Skip to content

Commit cac92f3

Browse files
Split parse_inner_attr errors by case
1 parent d869f1f commit cac92f3

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

  • compiler/rustc_parse/src/parser

compiler/rustc_parse/src/parser/attr.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,13 +209,25 @@ impl<'a> Parser<'a> {
209209
AllowConstBlockItems::Yes,
210210
) {
211211
Ok(Some(item)) => {
212-
// FIXME(#100717)
213212
err.arg("item", item.kind.descr());
214-
err.span_label(item.span, inline_fluent!("BROKEN"));
213+
err.span_label(
214+
item.span,
215+
match attr_type {
216+
OuterAttributeType::Attribute => {
217+
inline_fluent!("the inner attribute doesn't annotate this {$item}")
218+
}
219+
OuterAttributeType::DocComment | OuterAttributeType::DocBlockComment => {
220+
inline_fluent!("the inner doc comment doesn't annotate this {$item}")
221+
}
222+
},
223+
);
215224
if suggest_to_outer {
216225
err.span_suggestion_verbose(
217226
replacement_span,
218-
inline_fluent!("BROKEN"),
227+
match attr_type {
228+
OuterAttributeType::Attribute => inline_fluent!("to annotate the {$item}, change the attribute from inner to outer style"),
229+
OuterAttributeType::DocComment | OuterAttributeType::DocBlockComment => inline_fluent!("to annotate the {$item}, change the doc comment from inner to outer style"),
230+
},
219231
match attr_type {
220232
OuterAttributeType::Attribute => "",
221233
OuterAttributeType::DocBlockComment => "*",

0 commit comments

Comments
 (0)