2 // This test illustrates that under NLL, we can remove our overly
3 // conservative approach for disallowing mutations of match inputs.
5 // See further discussion on rust-lang/rust#24535,
6 // rust-lang/rfcs#1006, and rust-lang/rfcs#107
14 fn rust_issue_24535() {
15 fn compare(a: &u8, b: &mut u8) -> bool {
23 3 if compare(&a, &mut 3) => (),
28 fn rfcs_issue_1006_1() {
29 let v = vec!["1".to_string(), "2".to_string(), "3".to_string()];
31 Some(iv) if iv.iter().any(|x| &x[..]=="2") => true,
36 fn rfcs_issue_1006_2() {
38 fn check<'a, I: Iterator<Item=&'a i32>>(mut i: I) -> bool {
42 let slice = [1, 2, 3];
45 _ if slice.iter().any(|&x| x == 2) => { true },
46 _ => { panic!("nope"); }
49 // (This match is just illustrating how easy it was to circumvent
50 // the checking performed for the previous `match`.)
52 _ if check(slice.iter()) => { true },
53 _ => { panic!("nope"); }