Skip to content

Commit e6b745e

Browse files
cjlongoriafacebook-github-bot
authored andcommitted
1/3 patch let_chain feature removal
Summary: The let_chain feature is only stable in Rust 2024 edition and the unstable feature was removed in 1.90.0 This removes the unstable feature and re-writes the loop conditional to preserve the same logic. rust-lang/rust#143214 Reviewed By: dtolnay Differential Revision: D83506308 fbshipit-source-id: 3494392ecb4bebf12e638dee745fb435d7ca0937
1 parent f76b2a2 commit e6b745e

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

hphp/hack/src/elab/elab.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// LICENSE file in the "hack" directory of this source tree.
55

66
#![feature(box_patterns)]
7-
#![cfg_attr(not(rust_lib_feature = "let_chains"), feature(let_chains))]
87

98
mod elab_utils;
109
mod env;

hphp/hack/src/elab/typed_local.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -486,23 +486,23 @@ impl<'a> VisitorMut<'a> for TypedLocal {
486486
}
487487
self.add_local(name.to_string(), Some(as_hint.clone()), pos);
488488
self.add_declared_id(name);
489-
if self.should_elab
490-
&& let Some(expr) = expr
491-
{
492-
self.wrap_rhs_with_as(expr, as_hint, pos);
493-
let mut init_lid = Lid(Pos::NONE, (0, "".to_string()));
494-
std::mem::swap(&mut init_lid, lid);
495-
let mut init_expr = Expr((), Pos::NONE, Expr_::Null);
496-
std::mem::swap(expr, &mut init_expr);
497-
let assign_expr_ = Expr_::mk_assign(
498-
Expr((), pos.clone(), Expr_::Lvar(Box::new(init_lid))),
499-
None,
500-
init_expr,
501-
);
502-
let assign_expr = Expr((), pos.clone(), assign_expr_);
503-
*stmt_ = Stmt_::Expr(Box::new(assign_expr));
504-
} else if self.should_elab {
505-
*stmt_ = Stmt_::Noop;
489+
if self.should_elab {
490+
if let Some(expr) = expr {
491+
self.wrap_rhs_with_as(expr, as_hint, pos);
492+
let mut init_lid = Lid(Pos::NONE, (0, "".to_string()));
493+
std::mem::swap(&mut init_lid, lid);
494+
let mut init_expr = Expr((), Pos::NONE, Expr_::Null);
495+
std::mem::swap(expr, &mut init_expr);
496+
let assign_expr_ = Expr_::mk_assign(
497+
Expr((), pos.clone(), Expr_::Lvar(Box::new(init_lid))),
498+
None,
499+
init_expr,
500+
);
501+
let assign_expr = Expr((), pos.clone(), assign_expr_);
502+
*stmt_ = Stmt_::Expr(Box::new(assign_expr));
503+
} else {
504+
*stmt_ = Stmt_::Noop;
505+
}
506506
} else {
507507
std::mem::swap(hint, &mut as_hint);
508508
}

0 commit comments

Comments
 (0)