Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve E0585 help #102351

Merged
merged 1 commit into from
Sep 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_error_messages/locales/en-US/parser.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ parser_assignment_else_not_allowed = <assignment> ... else {"{"} ... {"}"} is no
parser_expected_statement_after_outer_attr = expected statement after outer attribute

parser_doc_comment_does_not_document_anything = found a documentation comment that doesn't document anything
.help = doc comments must come before what they document, maybe a comment was intended with `//`?
.help = doc comments must come before what they document, if a comment was intended use `//`
.suggestion = missing comma here

parser_const_let_mutually_exclusive = `const` and `let` are mutually exclusive
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_parse/src/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,8 @@ impl<'a> Parser<'a> {
)
.span_label(self.token.span, "this doc comment doesn't document anything")
.help(
"doc comments must come before what they document, maybe a \
comment was intended with `//`?",
"doc comments must come before what they document, if a comment was \
intended use `//`",
)
.emit();
self.bump();
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0585.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything
LL | /// Hello! I'm useless...
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/parser/doc-after-struct-field.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
struct X {
a: u8 /** document a */,
//~^ ERROR found a documentation comment that doesn't document anything
//~| HELP maybe a comment was intended
//~| HELP if a comment was intended use `//`
}

struct Y {
a: u8 /// document a
//~^ ERROR found a documentation comment that doesn't document anything
//~| HELP maybe a comment was intended
//~| HELP if a comment was intended use `//`
}

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/parser/doc-after-struct-field.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ error[E0585]: found a documentation comment that doesn't document anything
LL | a: u8 /** document a */,
| ^^^^^^^^^^^^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error[E0585]: found a documentation comment that doesn't document anything
--> $DIR/doc-after-struct-field.rs:8:11
|
LL | a: u8 /// document a
| ^^^^^^^^^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to 2 previous errors

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-extern-rbrace.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0584]: found a documentation comment that doesn't document anything
LL | /// hi
| ^^^^^^ this doc comment doesn't document anything
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-fn-rbrace.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
/// document
//~^ ERROR found a documentation comment that doesn't document anything
//~| HELP maybe a comment was intended
//~| HELP if a comment was intended use `//`
}
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-fn-rbrace.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything
LL | /// document
| ^^^^^^^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-rbrace.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
println!("Hi"); /// hi
//~^ ERROR found a documentation comment that doesn't document anything
//~| HELP maybe a comment was intended
//~| HELP if a comment was intended use `//`
}
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-rbrace.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything
LL | println!("Hi"); /// hi
| ^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-semi.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() {
/// hi
//~^ ERROR found a documentation comment that doesn't document anything
//~| HELP maybe a comment was intended
//~| HELP if a comment was intended use `//`
;
}
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-semi.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything
LL | /// hi
| ^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-struct-rbrace-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ struct X {
a: u8,
/// document
//~^ ERROR found a documentation comment that doesn't document anything
//~| HELP maybe a comment was intended
//~| HELP if a comment was intended use `//`
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-struct-rbrace-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LL | a: u8,
LL | /// document
| ^^^^^^^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-struct-rbrace-2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
struct X {
a: u8 /// document
//~^ ERROR found a documentation comment that doesn't document anything
//~| HELP maybe a comment was intended
//~| HELP if a comment was intended use `//`
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-before-struct-rbrace-2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything
LL | a: u8 /// document
| ^^^^^^^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/doc-inside-trait-item.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0584]: found a documentation comment that doesn't document anything
LL | /// empty doc
| ^^^^^^^^^^^^^ this doc comment doesn't document anything
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/issues/issue-34222-1.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0585]: found a documentation comment that doesn't document anything
LL | /// comment
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/parser/issues/issue-48636.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ LL | x: u8
LL | /// The ID of the parent core
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: doc comments must come before what they document, maybe a comment was intended with `//`?
= help: doc comments must come before what they document, if a comment was intended use `//`

error: aborting due to previous error

Expand Down