Skip to content

Commit

Permalink
Reword error hint
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Aug 10, 2017
1 parent a965bee commit cabc9be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/libsyntax/parse/parser.rs
Expand Up @@ -6002,7 +6002,8 @@ impl<'a> Parser<'a> {
if self.token.is_keyword(keywords::Const) {
self.diagnostic()
.struct_span_err(self.span, "extern items cannot be `const`")
.span_label(self.span, "use `static` instead").emit();
.span_suggestion(self.span, "instead try using", "static".to_owned())
.emit();
}
self.bump(); // `static` or `const`
return Ok(Some(self.parse_item_foreign_static(visibility, lo, attrs)?));
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/extern-const.stderr
Expand Up @@ -2,7 +2,7 @@ error: extern items cannot be `const`
--> $DIR/extern-const.rs:14:5
|
14 | const C: u8; //~ ERROR extern items cannot be `const`
| ^^^^^ use `static` instead
| ^^^^^ help: instead try using: `static`

error: aborting due to previous error

0 comments on commit cabc9be

Please sign in to comment.