Skip to content

Commit 2b5ae1c

Browse files
Apply suggestions from review
1 parent b3aecd0 commit 2b5ae1c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/librustc_passes/check_const.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl NonConstExpr {
5656
| Self::Match(WhileLetDesugar)
5757
=> &[sym::const_loop, sym::const_if_match],
5858

59-
// A `for` loop's desugaring contains a call to `FromIterator::from_iter`,
59+
// A `for` loop's desugaring contains a call to `IntoIterator::into_iter`,
6060
// so they are not yet allowed with `#![feature(const_loop)]`.
6161
_ => return None,
6262
};
@@ -167,10 +167,10 @@ impl<'tcx> CheckConstVisitor<'tcx> {
167167
// If the user enabled `#![feature(const_loop)]` but not `#![feature(const_if_match)]`,
168168
// explain why their `while` loop is being rejected.
169169
&[gate @ sym::const_if_match] if gates.contains(&sym::const_loop) => {
170-
let mut err = feature_err(&self.tcx.sess.parse_sess, gate, span, &msg);
171-
err.note("`#![feature(const_loop)]` alone is not sufficient, \
172-
since this loop expression contains an implicit conditional");
173-
err.emit();
170+
feature_err(&self.tcx.sess.parse_sess, gate, span, &msg)
171+
.note("`#![feature(const_loop)]` alone is not sufficient, \
172+
since this loop expression contains an implicit conditional")
173+
.emit();
174174
}
175175

176176
&[missing_primary, ref missing_secondary @ ..] => {

src/test/ui/consts/control-flow/drop-failure.rs

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ const _: Option<Vec<i32>> = {
4343
tmp = some;
4444
some = None;
4545

46+
// We can escape the loop with `Some` still in `tmp`,
47+
// which would require that it be dropped at the end of the block.
4648
if i > 100 {
4749
break;
4850
}

0 commit comments

Comments
 (0)