diff --git a/src/librustc_front/lowering.rs b/src/librustc_front/lowering.rs index c0b10fb89124..da561a0b3228 100644 --- a/src/librustc_front/lowering.rs +++ b/src/librustc_front/lowering.rs @@ -1499,8 +1499,9 @@ pub fn lower_expr(lctx: &LoweringContext, e: &Expr) -> P { hir::MatchSource::ForLoopDesugar, None); - // `{ let result = ...; result }` - let result_ident = lctx.str_to_ident("result"); + // `{ let _result = ...; _result }` + // underscore prevents an unused_variables lint if the head diverges + let result_ident = lctx.str_to_ident("_result"); let let_stmt = stmt_let(lctx, e.span, false, result_ident, match_expr, None); let result = expr_ident(lctx, e.span, result_ident, None); let block = block_all(lctx, e.span, vec![let_stmt], Some(result));