From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../bind-by-move-no-guards.rs | 19 ---------- .../former-E0008-now-pass.rs | 11 ------ .../rfc-basic-examples.rs | 43 ---------------------- .../rfc-reject-double-move-across-arms.rs | 13 ------- .../rfc-reject-double-move-across-arms.stderr | 11 ------ .../rfc-reject-double-move-in-first-arm.rs | 14 ------- .../rfc-reject-double-move-in-first-arm.stderr | 11 ------ 7 files changed, 122 deletions(-) delete mode 100644 src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs delete mode 100644 src/test/ui/rfc-0107-bind-by-move-pattern-guards/former-E0008-now-pass.rs delete mode 100644 src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs delete mode 100644 src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.rs delete mode 100644 src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.stderr delete mode 100644 src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.rs delete mode 100644 src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.stderr (limited to 'src/test/ui/rfc-0107-bind-by-move-pattern-guards') diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs deleted file mode 100644 index 1e086160f..000000000 --- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/bind-by-move-no-guards.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Adaptation of existing ui test (from way back in -// rust-lang/rust#2329), that starts passing with this feature in -// place. - -// run-pass - -use std::sync::mpsc::channel; - -fn main() { - let (tx, rx) = channel(); - let x = Some(rx); - tx.send(false).unwrap(); - tx.send(false).unwrap(); - match x { - Some(z) if z.recv().unwrap() => { panic!() }, - Some(z) => { assert!(!z.recv().unwrap()); }, - None => panic!() - } -} diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/former-E0008-now-pass.rs b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/former-E0008-now-pass.rs deleted file mode 100644 index 3161d6fbb..000000000 --- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/former-E0008-now-pass.rs +++ /dev/null @@ -1,11 +0,0 @@ -// This test used to emit E0008 but now passed since `bind_by_move_pattern_guards` -// have been stabilized. - -// check-pass - -fn main() { - match Some("hi".to_string()) { - Some(s) if s.len() == 0 => {}, - _ => {}, - } -} diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs deleted file mode 100644 index b716fc870..000000000 --- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-basic-examples.rs +++ /dev/null @@ -1,43 +0,0 @@ -// run-pass - -struct A { a: Box } - -impl A { - fn get(&self) -> i32 { *self.a } -} - -fn foo(n: i32) -> i32 { - let x = A { a: Box::new(n) }; - let y = match x { - A { a: v } if *v == 42 => v, - _ => Box::new(0), - }; - *y -} - -fn bar(n: i32) -> i32 { - let x = A { a: Box::new(n) }; - let y = match x { - A { a: v } if x.get() == 42 => v, - _ => Box::new(0), - }; - *y -} - -fn baz(n: i32) -> i32 { - let x = A { a: Box::new(n) }; - let y = match x { - A { a: v } if *v.clone() == 42 => v, - _ => Box::new(0), - }; - *y -} - -fn main() { - assert_eq!(foo(107), 0); - assert_eq!(foo(42), 42); - assert_eq!(bar(107), 0); - assert_eq!(bar(42), 42); - assert_eq!(baz(107), 0); - assert_eq!(baz(42), 42); -} diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.rs b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.rs deleted file mode 100644 index d1f685f3e..000000000 --- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.rs +++ /dev/null @@ -1,13 +0,0 @@ -enum VecWrapper { A(Vec) } - -fn foo(x: VecWrapper) -> usize { - match x { - VecWrapper::A(v) if { drop(v); false } => 1, - //~^ ERROR cannot move out of `v` in pattern guard - VecWrapper::A(v) => v.len() - } -} - -fn main() { - foo(VecWrapper::A(vec![107])); -} diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.stderr b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.stderr deleted file mode 100644 index 6c3d1caf8..000000000 --- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-across-arms.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0507]: cannot move out of `v` in pattern guard - --> $DIR/rfc-reject-double-move-across-arms.rs:5:36 - | -LL | VecWrapper::A(v) if { drop(v); false } => 1, - | ^ move occurs because `v` has type `Vec`, which does not implement the `Copy` trait - | - = note: variables bound in patterns cannot be moved from until after the end of the pattern guard - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.rs b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.rs deleted file mode 100644 index 571f51c90..000000000 --- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.rs +++ /dev/null @@ -1,14 +0,0 @@ -struct A { a: Box } - -fn foo(n: i32) { - let x = A { a: Box::new(n) }; - let _y = match x { - A { a: v } if { drop(v); true } => v, - //~^ ERROR cannot move out of `v` in pattern guard - _ => Box::new(0), - }; -} - -fn main() { - foo(107); -} diff --git a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.stderr b/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.stderr deleted file mode 100644 index d1204bc26..000000000 --- a/src/test/ui/rfc-0107-bind-by-move-pattern-guards/rfc-reject-double-move-in-first-arm.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0507]: cannot move out of `v` in pattern guard - --> $DIR/rfc-reject-double-move-in-first-arm.rs:6:30 - | -LL | A { a: v } if { drop(v); true } => v, - | ^ move occurs because `v` has type `Box`, which does not implement the `Copy` trait - | - = note: variables bound in patterns cannot be moved from until after the end of the pattern guard - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0507`. -- cgit v1.2.3