diff options
| author | bors <bors@rust-lang.org> | 2023-12-07 22:30:24 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-07 22:30:24 +0000 |
| commit | 370c91100ce008f3f31e207adbfee8aeafe09b14 (patch) | |
| tree | 56fa4d7e2abb36dccd991e47b0f7dc4801850252 /compiler/rustc_parse/src/parser | |
| parent | 503e129328080e924c0ddfca6abf4c2812580102 (diff) | |
| parent | 71812d7eb04110f8e5d89903ac1add24e464dd2a (diff) | |
| download | rust-370c91100ce008f3f31e207adbfee8aeafe09b14.tar.gz rust-370c91100ce008f3f31e207adbfee8aeafe09b14.zip | |
Auto merge of #118723 - matthiaskrgr:rollup-409e9u1, r=matthiaskrgr
Rollup of 6 pull requests
Successful merges:
- #116420 (discard invalid spans in external blocks)
- #118686 (Only check principal trait ref for object safety)
- #118688 (Add method to get type of an Rvalue in StableMIR)
- #118707 (Ping GuillaumeGomez for changes in rustc_codegen_gcc)
- #118712 (targets: remove not-added {i386,i486}-unknown-linux-gnu)
- #118719 (CFI: Add char to CFI integer normalization)
Failed merges:
- #117586 (Uplift the (new solver) canonicalizer into `rustc_next_trait_solver`)
r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/item.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 8a987767dc4..086e8d5cf9b 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1139,9 +1139,11 @@ impl<'a> Parser<'a> { Ok(kind) => kind, Err(kind) => match kind { ItemKind::Const(box ConstItem { ty, expr, .. }) => { + let const_span = Some(span.with_hi(ident.span.lo())) + .filter(|span| span.can_be_used_for_suggestions()); self.sess.emit_err(errors::ExternItemCannotBeConst { ident_span: ident.span, - const_span: span.with_hi(ident.span.lo()), + const_span, }); ForeignItemKind::Static(ty, Mutability::Not, expr) } |
