]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs
implement Hash for proc_macro::LineColumn
[rust.git] / tests / ui / borrowck / issue-52967-edition-2018-needs-two-phase-borrows.rs
1 // This is a regression test for #52967, where we discovered that in
2 // the initial deployment of NLL for the 2018 edition, I forgot to
3 // turn on two-phase-borrows in addition to `-Z borrowck=migrate`.
4
5 // revisions: edition2015 edition2018
6 //[edition2018]edition:2018
7
8 // run-pass
9
10 fn the_bug() {
11     let mut stuff = ("left", "right");
12     match stuff {
13         (ref mut left, _) if *left == "left" => { *left = "new left"; }
14         _ => {}
15     }
16     assert_eq!(stuff, ("new left", "right"));
17 }
18
19 fn main() {
20     the_bug();
21 }