summaryrefslogtreecommitdiffstats
path: root/src/test/ui/binding/order-drop-with-match.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/binding/order-drop-with-match.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/binding/order-drop-with-match.rs')
-rw-r--r--src/test/ui/binding/order-drop-with-match.rs57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/test/ui/binding/order-drop-with-match.rs b/src/test/ui/binding/order-drop-with-match.rs
deleted file mode 100644
index f50632ede..000000000
--- a/src/test/ui/binding/order-drop-with-match.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-// run-pass
-
-// Test to make sure the destructors run in the right order.
-// Each destructor sets it's tag in the corresponding entry
-// in ORDER matching up to when it ran.
-// Correct order is: matched, inner, outer
-
-
-static mut ORDER: [usize; 3] = [0, 0, 0];
-static mut INDEX: usize = 0;
-
-struct A;
-impl Drop for A {
- fn drop(&mut self) {
- unsafe {
- ORDER[INDEX] = 1;
- INDEX = INDEX + 1;
- }
- }
-}
-
-struct B;
-impl Drop for B {
- fn drop(&mut self) {
- unsafe {
- ORDER[INDEX] = 2;
- INDEX = INDEX + 1;
- }
- }
-}
-
-struct C;
-impl Drop for C {
- fn drop(&mut self) {
- unsafe {
- ORDER[INDEX] = 3;
- INDEX = INDEX + 1;
- }
- }
-}
-
-fn main() {
- {
- let matched = A;
- let _outer = C;
- {
- match matched {
- _s => {}
- }
- let _inner = B;
- }
- }
- unsafe {
- let expected: &[_] = &[1, 2, 3];
- assert_eq!(expected, ORDER);
- }
-}