1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // This is a test of the borrowck migrate mode. It leverages #27282, a
12 // bug that is fixed by NLL: this code is (unsoundly) accepted by
13 // AST-borrowck, but is correctly rejected by the NLL borrowck.
15 // Therefore, for backwards-compatiblity, under borrowck=migrate the
16 // NLL checks will be emitted as *warnings*.
18 // NLL mode makes this compile-fail; we cannot currently encode a
19 // test that is run-pass or compile-fail based on compare-mode. So
20 // just ignore it instead:
22 // ignore-compare-mode-nll
24 // revisions: zflag edition
25 //[zflag]compile-flags: -Z borrowck=migrate
26 //[edition]compile-flags: --edition 2018
35 (|| { let bar = foo; bar.take() })();
38 Some(ref _s) => println!("Note this arm is bogus; the `Some` became `None` in the guard."),
39 _ => println!("Here is some supposedly unreachable code."),