Skip to content

Commit 2a67eaa

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 67afe26 commit 2a67eaa

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

compiler/rustc_expand/messages.ftl

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ expand_attribute_single_word =
1212
1313
expand_attributes_on_expressions_experimental =
1414
attributes on expressions are experimental
15-
.help_outer_doc = `///` is for documentation comments. For a plain comment, use `//`.
15+
.help_outer_doc = `///` is used for outer documentation comments; for a plain comment, use `//`.
16+
.help_inner_doc = `//!` is used for inner documentation comments; for a plain comment, use `//` by removing the `!` or inserting a space in between them: `// !`
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)