diff options
| author | bors <bors@rust-lang.org> | 2024-07-15 19:44:22 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-07-15 19:44:22 +0000 |
| commit | 24d2ac0b56fcbde13d827745f66e73efb1e17156 (patch) | |
| tree | 9fbe3038a35c79c8ee02c2e6d6402e6a90397f7e /compiler/rustc_parse/src/parser/expr.rs | |
| parent | eb72697e41b00e5d8723f14c64a969d59d9b9474 (diff) | |
| parent | e5d65e46ed2734b0c20aa9d8159c1b31121a72ef (diff) | |
| download | rust-24d2ac0b56fcbde13d827745f66e73efb1e17156.tar.gz rust-24d2ac0b56fcbde13d827745f66e73efb1e17156.zip | |
Auto merge of #127777 - matthiaskrgr:rollup-qp2vkan, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #124921 (offset_from: always allow pointers to point to the same address) - #127407 (Make parse error suggestions verbose and fix spans) - #127684 (consolidate miri-unleashed tests for mutable refs into one file) - #127729 (Stop using the `gen` identifier in the compiler) - #127736 (Add myself to the review rotation) - #127758 (coverage: Restrict `ExpressionUsed` simplification to `Code` mappings) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index b2df9a14eb0..4bd20be4171 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -714,7 +714,7 @@ impl<'a> Parser<'a> { type_err.cancel(); self.dcx().emit_err(errors::MalformedLoopLabel { span: label.ident.span, - correct_label: label.ident, + suggestion: label.ident.span.shrink_to_lo(), }); return Ok(expr); } @@ -856,7 +856,7 @@ impl<'a> Parser<'a> { let hi = self.interpolated_or_expr_span(&expr); let span = lo.to(hi); if let Some(lt) = lifetime { - self.error_remove_borrow_lifetime(span, lt.ident.span); + self.error_remove_borrow_lifetime(span, lt.ident.span.until(expr.span)); } Ok((span, ExprKind::AddrOf(borrow_kind, mutbl, expr))) } @@ -1653,6 +1653,7 @@ impl<'a> Parser<'a> { let lo = label_.ident.span; let label = Some(label_); let ate_colon = self.eat(&token::Colon); + let tok_sp = self.token.span; let expr = if self.eat_keyword(kw::While) { self.parse_expr_while(label, lo) } else if self.eat_keyword(kw::For) { @@ -1747,7 +1748,7 @@ impl<'a> Parser<'a> { self.dcx().emit_err(errors::RequireColonAfterLabeledExpression { span: expr.span, label: lo, - label_end: lo.shrink_to_hi(), + label_end: lo.between(tok_sp), }); } @@ -2106,7 +2107,7 @@ impl<'a> Parser<'a> { self.bump(); self.dcx().emit_err(errors::FloatLiteralRequiresIntegerPart { span: token.span, - correct: pprust::token_to_string(token).into_owned(), + suggestion: token.span.shrink_to_lo(), }); } } @@ -2741,7 +2742,7 @@ impl<'a> Parser<'a> { if !attrs.is_empty() && let [x0 @ xn] | [x0, .., xn] = &*attrs.take_for_recovery(self.psess) { - let attributes = x0.span.to(xn.span); + let attributes = x0.span.until(branch_span); let last = xn.span; let ctx = if is_ctx_else { "else" } else { "if" }; self.dcx().emit_err(errors::OuterAttributeNotAllowedOnIfElse { |
