diff options
| author | bors <bors@rust-lang.org> | 2022-08-12 16:32:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-12 16:32:24 +0000 |
| commit | f22819bcce4abaff7d1246a56eec493418f9f4ee (patch) | |
| tree | 2fc9ac8d3bfe8d748c4b0971b05b472efca99120 /compiler/rustc_parse/src | |
| parent | 0068b8bf4b150b506ef0871be4e8652fd4308f84 (diff) | |
| parent | 3bc30bb012889eeeb08d5241dfe64fc47ed33537 (diff) | |
| download | rust-f22819bcce4abaff7d1246a56eec493418f9f4ee.tar.gz rust-f22819bcce4abaff7d1246a56eec493418f9f4ee.zip | |
Auto merge of #100456 - Dylan-DPC:rollup-fn17z9f, r=Dylan-DPC
Rollup of 9 pull requests Successful merges: - #100022 (Optimize thread ID generation) - #100030 (cleanup code w/ pointers in std a little) - #100229 (add -Zextra-const-ub-checks to enable more UB checking in const-eval) - #100247 (Generalize trait object generic param check to aliases.) - #100255 (Adding more verbose documentation for `std::fmt::Write`) - #100366 (errors: don't fail on broken primary translations) - #100396 (Suggest const and static for global variable) - #100409 (rustdoc: don't generate DOM element for operator) - #100443 (Add two let else regression tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 72c23776d33..197c0384898 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -68,7 +68,12 @@ impl<'a> Parser<'a> { if !self.maybe_consume_incorrect_semicolon(&items) { let msg = &format!("expected item, found {token_str}"); let mut err = self.struct_span_err(self.token.span, msg); - err.span_label(self.token.span, "expected item"); + let label = if self.is_kw_followed_by_ident(kw::Let) { + "consider using `const` or `static` instead of `let` for global variables" + } else { + "expected item" + }; + err.span_label(self.token.span, label); return Err(err); } } |
