diff options
| author | bors <bors@rust-lang.org> | 2023-03-21 20:56:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-03-21 20:56:38 +0000 |
| commit | 1db9c061d387a66ab16a90ec5a1b90adf216e2da (patch) | |
| tree | 7e7a041d9e2da492fd9b6ad2170afa4948a3f0ff /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 77d50a8870a912af1def75760b9638db892717c5 (diff) | |
| parent | 94d2028abd638366d338c8f24981240415129c90 (diff) | |
| download | rust-1db9c061d387a66ab16a90ec5a1b90adf216e2da.tar.gz rust-1db9c061d387a66ab16a90ec5a1b90adf216e2da.zip | |
Auto merge of #109453 - matthiaskrgr:rollup-odn02wu, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #96391 (Windows: make `Command` prefer non-verbatim paths) - #108164 (Drop all messages in bounded channel when destroying the last receiver) - #108729 (fix: modify the condition that `resolve_imports` stops) - #109336 (Constrain const vars to error if const types are mismatched) - #109403 (Avoid ICE of attempt to add with overflow in emitter) - #109415 (Refactor `handle_missing_lit`.) - #109441 (Only implement Fn* traits for extern "Rust" safe function pointers and items) - #109446 (Do not suggest bounds restrictions for synthesized RPITITs) Failed merges: 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 | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 296eb4d653c..8b69b3cb036 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1843,20 +1843,14 @@ impl<'a> Parser<'a> { &mut self, mk_lit_char: impl FnOnce(Symbol, Span) -> L, ) -> PResult<'a, L> { - if let token::Interpolated(inner) = &self.token.kind { - let expr = match inner.as_ref() { - token::NtExpr(expr) => Some(expr), - token::NtLiteral(expr) => Some(expr), - _ => None, - }; - if let Some(expr) = expr { - if matches!(expr.kind, ExprKind::Err) { - let mut err = errors::InvalidInterpolatedExpression { span: self.token.span } - .into_diagnostic(&self.sess.span_diagnostic); - err.downgrade_to_delayed_bug(); - return Err(err); - } - } + if let token::Interpolated(nt) = &self.token.kind + && let token::NtExpr(e) | token::NtLiteral(e) = &**nt + && matches!(e.kind, ExprKind::Err) + { + let mut err = errors::InvalidInterpolatedExpression { span: self.token.span } + .into_diagnostic(&self.sess.span_diagnostic); + err.downgrade_to_delayed_bug(); + return Err(err); } let token = self.token.clone(); let err = |self_: &Self| { |
