diff options
| author | bors <bors@rust-lang.org> | 2023-11-17 00:03:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-11-17 00:03:54 +0000 |
| commit | f2f526cafab777343b0e24f08d0f5084ac937b8f (patch) | |
| tree | 5cdeb92a742beaa77b2f91f3184676957324cabc /compiler/rustc_parse/src | |
| parent | a57770440f1ebe5b992551d3bcc489ae211908d4 (diff) | |
| parent | a5d7f8bcf2d6658f7c6a5f4408e5d3ef11576605 (diff) | |
| download | rust-f2f526cafab777343b0e24f08d0f5084ac937b8f.tar.gz rust-f2f526cafab777343b0e24f08d0f5084ac937b8f.zip | |
Auto merge of #117996 - matthiaskrgr:rollup-sp48bl4, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #117892 (Detect more `=>` typos) - #117959 (Better handle type errors involving `Self` literals) - #117980 (fix: Update CONTRIBUTING.md recommend -> recommended) - #117982 (bootstrap: only show PGO warnings when verbose) - #117990 (Tweak error and move tests) Failed merges: - #117944 (some additional region refactorings) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 19 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/pat.rs | 10 |
4 files changed, 18 insertions, 18 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 8ab1ec298a1..99e66fddc70 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -2278,9 +2278,8 @@ pub(crate) enum InvalidMutInPattern { #[note(parse_note_mut_pattern_usage)] NonIdent { #[primary_span] - #[suggestion(code = "{pat}", applicability = "machine-applicable")] + #[suggestion(code = "", applicability = "machine-applicable")] span: Span, - pat: String, }, } diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 235b28b6e26..bfd7e8ef4d0 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2904,15 +2904,16 @@ impl<'a> Parser<'a> { "=>", Applicability::MachineApplicable, ); - err.emit(); - this.bump(); - } else if matches!( - (&this.prev_token.kind, &this.token.kind), - (token::DotDotEq, token::Gt) - ) { - // `error_inclusive_range_match_arrow` handles cases like `0..=> {}`, - // so we suppress the error here - err.delay_as_bug(); + if matches!( + (&this.prev_token.kind, &this.token.kind), + (token::DotDotEq, token::Gt) + ) { + // `error_inclusive_range_match_arrow` handles cases like `0..=> {}`, + // so we suppress the error here + err.delay_as_bug(); + } else { + err.emit(); + } this.bump(); } else { return Err(err); diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 2fe70694368..833381a6503 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -830,8 +830,8 @@ impl<'a> Parser<'a> { // https://github.com/rust-lang/rust/issues/72373 if self.prev_token.is_ident() && self.token.kind == token::DotDot { let msg = format!( - "if you meant to bind the contents of \ - the rest of the array pattern into `{}`, use `@`", + "if you meant to bind the contents of the rest of the array \ + pattern into `{}`, use `@`", pprust::token_to_string(&self.prev_token) ); expect_err diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 0a4c7c17d06..f6e1a21bd26 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -638,13 +638,13 @@ impl<'a> Parser<'a> { /// Error on `mut $pat` where `$pat` is not an ident. fn ban_mut_general_pat(&self, lo: Span, pat: &Pat, changed_any_binding: bool) { - let span = lo.to(pat.span); - let pat = pprust::pat_to_string(&pat); - self.sess.emit_err(if changed_any_binding { - InvalidMutInPattern::NestedIdent { span, pat } + InvalidMutInPattern::NestedIdent { + span: lo.to(pat.span), + pat: pprust::pat_to_string(&pat), + } } else { - InvalidMutInPattern::NonIdent { span, pat } + InvalidMutInPattern::NonIdent { span: lo.until(pat.span) } }); } |
