diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-12-11 10:20:50 -0800 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-12-13 10:39:14 -0800 |
| commit | 2b5ae1cb061f6599d108d9a0fc0b7b4e17abb5e7 (patch) | |
| tree | 018565f715ab7f3c6f7c2c5076e22b68bbf0337f | |
| parent | b3aecd0d55d81b73b571b961201d4da36417bf61 (diff) | |
| download | rust-2b5ae1cb061f6599d108d9a0fc0b7b4e17abb5e7.tar.gz rust-2b5ae1cb061f6599d108d9a0fc0b7b4e17abb5e7.zip | |
Apply suggestions from review
| -rw-r--r-- | src/librustc_passes/check_const.rs | 10 | ||||
| -rw-r--r-- | 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 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<Vec<i32>> = { 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; } |
