Introduce hir::ExprKind::Let - Take 2
This commit is contained in:
@@ -48,11 +48,8 @@ impl NonConstExpr {
|
||||
|
||||
Self::Match(TryDesugar) => &[sym::const_try],
|
||||
|
||||
Self::Match(IfLetGuardDesugar) => bug!("`if let` guard outside a `match` expression"),
|
||||
|
||||
// All other expressions are allowed.
|
||||
Self::Loop(Loop | While | WhileLet)
|
||||
| Self::Match(WhileDesugar | WhileLetDesugar | Normal | IfLetDesugar { .. }) => &[],
|
||||
Self::Loop(Loop | While) | Self::Match(Normal) => &[],
|
||||
};
|
||||
|
||||
Some(gates)
|
||||
@@ -277,9 +274,7 @@ impl<'tcx> Visitor<'tcx> for CheckConstVisitor<'tcx> {
|
||||
hir::ExprKind::Match(_, _, source) => {
|
||||
let non_const_expr = match source {
|
||||
// These are handled by `ExprKind::Loop` above.
|
||||
hir::MatchSource::WhileDesugar
|
||||
| hir::MatchSource::WhileLetDesugar
|
||||
| hir::MatchSource::ForLoopDesugar => None,
|
||||
hir::MatchSource::ForLoopDesugar => None,
|
||||
|
||||
_ => Some(NonConstExpr::Match(*source)),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user