From 254a10b318b69cc1e564168b66511658261e76a6 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Mon, 12 Oct 2015 09:49:29 +1300 Subject: [PATCH] Properly set the MatchSource for for loops --- src/librustc_front/lowering.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/librustc_front/lowering.rs b/src/librustc_front/lowering.rs index 4ee5fa2c1e9..5bd188020a3 100644 --- a/src/librustc_front/lowering.rs +++ b/src/librustc_front/lowering.rs @@ -1422,7 +1422,11 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P { vec![head]) }; - let match_expr = expr_match(lctx, e.span, into_iter_expr, vec![iter_arm]); + let match_expr = expr_match(lctx, + e.span, + into_iter_expr, + vec![iter_arm], + hir::MatchSource::ForLoopDesugar); // `{ let result = ...; result }` let result_ident = lctx.str_to_ident("result"); @@ -1574,11 +1578,12 @@ fn expr_path(lctx: &LoweringContext, path: hir::Path) -> P { fn expr_match(lctx: &LoweringContext, span: Span, arg: P, - arms: Vec) + arms: Vec, + source: hir::MatchSource) -> P { expr(lctx, span, - hir::ExprMatch(arg, arms, hir::MatchSource::Normal)) + hir::ExprMatch(arg, arms, source)) } fn expr_block(lctx: &LoweringContext, b: P) -> P {