Skip to content

Commit b3ee37d

Browse files
committed
expand: fix minor diagnostics bug
The error mentions `///`, when it's actually `//!`: error[E0658]: attributes on expressions are experimental --> test.rs:4:9 | 4 | //! wah | ^^^^^^^ | = note: see issue #15701 <#15701> for more information = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable = help: `///` is for documentation comments. For a plain comment, use `//`.
1 parent 3730732 commit b3ee37d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/rustc_expand/messages.ftl

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ expand_attribute_single_word =
1313
expand_attributes_on_expressions_experimental =
1414
attributes on expressions are experimental
1515
.help_outer_doc = `///` is for documentation comments. For a plain comment, use `//`.
16+
.help_inner_doc = `//!` is for documentation comments. For a plain comment, insert a space: `// !`
1617
1718
expand_attributes_wrong_form =
1819
attribute must be of form: `attributes(foo, bar)`

compiler/rustc_expand/src/config.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,11 @@ impl<'a> StripUnconfigured<'a> {
387387
);
388388

389389
if attr.is_doc_comment() {
390-
err.help(crate::fluent_generated::expand_help_outer_doc);
390+
err.help(if attr.style == AttrStyle::Outer {
391+
crate::fluent_generated::expand_help_outer_doc
392+
} else {
393+
crate::fluent_generated::expand_help_inner_doc
394+
});
391395
}
392396

393397
err.emit();

0 commit comments

Comments
 (0)