Skip to content

Commit d6688ef

Browse files
committed
removed gate and added test for drop order
1 parent d34eb45 commit d6688ef

14 files changed

+144
-81
lines changed

compiler/rustc_parse/src/parser/expr.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3407,31 +3407,19 @@ impl<'a> Parser<'a> {
34073407
fn parse_match_arm_guard(&mut self) -> PResult<'a, Option<P<Expr>>> {
34083408
// Used to check the `if_let_guard` feature mostly by scanning
34093409
// `&&` tokens.
3410-
fn has_let_expr(expr: &Expr) -> bool {
3411-
match &expr.kind {
3412-
ExprKind::Binary(BinOp { node: BinOpKind::And, .. }, lhs, rhs) => {
3413-
let lhs_rslt = has_let_expr(lhs);
3414-
let rhs_rslt = has_let_expr(rhs);
3415-
lhs_rslt || rhs_rslt
3416-
}
3417-
ExprKind::Let(..) => true,
3418-
_ => false,
3419-
}
3420-
}
34213410
if !self.eat_keyword(exp!(If)) {
34223411
// No match arm guard present.
34233412
return Ok(None);
34243413
}
34253414

3426-
let if_span = self.prev_token.span;
34273415
let mut cond = self.parse_match_guard_condition()?;
34283416

3429-
CondChecker::new(self, LetChainsPolicy::AlwaysAllowed).visit_expr(&mut cond);
3417+
CondChecker::new(
3418+
self,
3419+
LetChainsPolicy::EditionDependent { current_edition: Edition::Edition2024 },
3420+
)
3421+
.visit_expr(&mut cond);
34303422

3431-
if has_let_expr(&cond) {
3432-
let span = if_span.to(cond.span);
3433-
self.psess.gated_spans.gate(sym::if_let_guard, span);
3434-
}
34353423
Ok(Some(cond))
34363424
}
34373425

tests/ui/drop/drop-order-comparisons.e2021.fixed

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
//@ [e2024] edition: 2024
2525
//@ run-pass
2626

27-
#![feature(if_let_guard)]
2827
#![cfg_attr(e2021, feature(let_chains))]
2928
#![cfg_attr(e2021, warn(rust_2024_compatibility))]
3029

0 commit comments

Comments
 (0)