diff --git a/src/librustc_passes/check_const.rs b/src/librustc_passes/check_const.rs index a60e005797e..713dd3a7c83 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 599ebc6243e..9da5546976c 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; }