提交 cabc9be9 编写于 作者: K Kornel

Reword error hint

上级 a965beef
......@@ -6002,7 +6002,8 @@ fn parse_foreign_item(&mut self) -> PResult<'a, Option<ForeignItem>> {
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)?));
......
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册