Skip to content

Commit cabc9be

Browse files
committed
Reword error hint
1 parent a965bee commit cabc9be

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/libsyntax/parse/parser.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6002,7 +6002,8 @@ impl<'a> Parser<'a> {
60026002
if self.token.is_keyword(keywords::Const) {
60036003
self.diagnostic()
60046004
.struct_span_err(self.span, "extern items cannot be `const`")
6005-
.span_label(self.span, "use `static` instead").emit();
6005+
.span_suggestion(self.span, "instead try using", "static".to_owned())
6006+
.emit();
60066007
}
60076008
self.bump(); // `static` or `const`
60086009
return Ok(Some(self.parse_item_foreign_static(visibility, lo, attrs)?));

src/test/ui/extern-const.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: extern items cannot be `const`
22
--> $DIR/extern-const.rs:14:5
33
|
44
14 | const C: u8; //~ ERROR extern items cannot be `const`
5-
| ^^^^^ use `static` instead
5+
| ^^^^^ help: instead try using: `static`
66

77
error: aborting due to previous error
88

0 commit comments

Comments
 (0)