From 2b5ae1cb061f6599d108d9a0fc0b7b4e17abb5e7 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Wed, 11 Dec 2019 10:20:50 -0800 Subject: [PATCH] Apply suggestions from review --- src/librustc_passes/check_const.rs | 10 +++++----- src/test/ui/consts/control-flow/drop-failure.rs | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs index a60e005797eb..713dd3a7c834 100644 --- a/src/librustc_passes/check_const.rs +++ b/src/librustc_passes/check_const.rs @@ -56,7 +56,7 @@ impl NonConstExpr { | Self::Match(WhileLetDesugar) => &[sym::const_loop, sym::const_if_match], - // A `for` loop's desugaring contains a call to `FromIterator::from_iter`, + // A `for` loop's desugaring contains a call to `IntoIterator::into_iter`, // so they are not yet allowed with `#![feature(const_loop)]`. _ => return None, }; @@ -167,10 +167,10 @@ impl<'tcx> CheckConstVisitor<'tcx> { // If the user enabled `#![feature(const_loop)]` but not `#![feature(const_if_match)]`, // explain why their `while` loop is being rejected. &[gate @ sym::const_if_match] if gates.contains(&sym::const_loop) => { - let mut err = feature_err(&self.tcx.sess.parse_sess, gate, span, &msg); - err.note("`#![feature(const_loop)]` alone is not sufficient, \ - since this loop expression contains an implicit conditional"); - err.emit(); + feature_err(&self.tcx.sess.parse_sess, gate, span, &msg) + .note("`#![feature(const_loop)]` alone is not sufficient, \ + since this loop expression contains an implicit conditional") + .emit(); } &[missing_primary, ref missing_secondary @ ..] => { diff --git a/src/test/ui/consts/control-flow/drop-failure.rs b/src/test/ui/consts/control-flow/drop-failure.rs index 599ebc6243e9..9da5546976c7 100644 --- a/src/test/ui/consts/control-flow/drop-failure.rs +++ b/src/test/ui/consts/control-flow/drop-failure.rs @@ -43,6 +43,8 @@ const _: Option> = { tmp = some; some = None; + // We can escape the loop with `Some` still in `tmp`, + // which would require that it be dropped at the end of the block. if i > 100 { break; }