about summary refs log tree commit diff
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com>2024-10-07 08:02:30 +0000
committer许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com>2024-10-07 08:02:30 +0000
commitfa3c25e1124d4cd45efde79efdd7455e48379eda (patch)
treeb9e658f8a4c0b4f72916d4b8ce373e3d9842fecc
parentf1e408a8debad9b6dd230cc7b7e914e8d7c2fdd6 (diff)
downloadrust-fa3c25e1124d4cd45efde79efdd7455e48379eda.tar.gz
rust-fa3c25e1124d4cd45efde79efdd7455e48379eda.zip
Delete the `run-pass-valgrind` test suite
-rw-r--r--tests/run-pass-valgrind/cast-enum-with-dtor.rs34
-rw-r--r--tests/run-pass-valgrind/cleanup-auto-borrow-obj.rs28
-rw-r--r--tests/run-pass-valgrind/cleanup-stdin.rs5
-rw-r--r--tests/run-pass-valgrind/coerce-match-calls.rs21
-rw-r--r--tests/run-pass-valgrind/coerce-match.rs31
-rw-r--r--tests/run-pass-valgrind/down-with-thread-dtors.rs43
-rw-r--r--tests/run-pass-valgrind/dst-dtor-1.rs28
-rw-r--r--tests/run-pass-valgrind/dst-dtor-2.rs23
-rw-r--r--tests/run-pass-valgrind/dst-dtor-3.rs26
-rw-r--r--tests/run-pass-valgrind/dst-dtor-4.rs21
-rw-r--r--tests/run-pass-valgrind/exit-flushes.rs19
-rw-r--r--tests/run-pass-valgrind/issue-44800.rs12
-rw-r--r--tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call.rs55
-rw-r--r--tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call2.rs69
-rw-r--r--tests/run-pass-valgrind/unsized-locals/by-value-trait-objects.rs48
-rw-r--r--tests/run-pass-valgrind/unsized-locals/long-live-the-unsized-temporary.rs52
16 files changed, 0 insertions, 515 deletions
diff --git a/tests/run-pass-valgrind/cast-enum-with-dtor.rs b/tests/run-pass-valgrind/cast-enum-with-dtor.rs
deleted file mode 100644
index a57dc373478..00000000000
--- a/tests/run-pass-valgrind/cast-enum-with-dtor.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-#![allow(dead_code, cenum_impl_drop_cast)]
-
-// check dtor calling order when casting enums.
-
-use std::mem;
-use std::sync::atomic;
-use std::sync::atomic::Ordering;
-
-enum E {
-    A = 0,
-    B = 1,
-    C = 2,
-}
-
-static FLAG: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
-
-impl Drop for E {
-    fn drop(&mut self) {
-        // avoid dtor loop
-        unsafe { mem::forget(mem::replace(self, E::B)) };
-
-        FLAG.store(FLAG.load(Ordering::SeqCst) + 1, Ordering::SeqCst);
-    }
-}
-
-fn main() {
-    assert_eq!(FLAG.load(Ordering::SeqCst), 0);
-    {
-        let e = E::C;
-        assert_eq!(e as u32, 2);
-        assert_eq!(FLAG.load(Ordering::SeqCst), 1);
-    }
-    assert_eq!(FLAG.load(Ordering::SeqCst), 1);
-}
diff --git a/tests/run-pass-valgrind/cleanup-auto-borrow-obj.rs b/tests/run-pass-valgrind/cleanup-auto-borrow-obj.rs
deleted file mode 100644
index e4ce80b3305..00000000000
--- a/tests/run-pass-valgrind/cleanup-auto-borrow-obj.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// This would previously leak the Box<Trait> because we wouldn't
-// schedule cleanups when auto borrowing trait objects.
-// This program should be valgrind clean.
-
-static mut DROP_RAN: bool = false;
-
-struct Foo;
-impl Drop for Foo {
-    fn drop(&mut self) {
-        unsafe {
-            DROP_RAN = true;
-        }
-    }
-}
-
-trait Trait {
-    fn dummy(&self) {}
-}
-impl Trait for Foo {}
-
-pub fn main() {
-    {
-        let _x: &Trait = &*(Box::new(Foo) as Box<Trait>);
-    }
-    unsafe {
-        assert!(DROP_RAN);
-    }
-}
diff --git a/tests/run-pass-valgrind/cleanup-stdin.rs b/tests/run-pass-valgrind/cleanup-stdin.rs
deleted file mode 100644
index cf8f81cf5aa..00000000000
--- a/tests/run-pass-valgrind/cleanup-stdin.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
-    let _ = std::io::stdin();
-    let _ = std::io::stdout();
-    let _ = std::io::stderr();
-}
diff --git a/tests/run-pass-valgrind/coerce-match-calls.rs b/tests/run-pass-valgrind/coerce-match-calls.rs
deleted file mode 100644
index 8c7375610dd..00000000000
--- a/tests/run-pass-valgrind/coerce-match-calls.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Check that coercions are propagated through match and if expressions.
-
-//@ pretty-expanded FIXME #23616
-
-use std::boxed::Box;
-
-pub fn main() {
-    let _: Box<[isize]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) };
-
-    let _: Box<[isize]> = match true {
-        true => Box::new([1, 2, 3]),
-        false => Box::new([1]),
-    };
-
-    // Check we don't get over-keen at propagating coercions in the case of casts.
-    let x = if true { 42 } else { 42u8 } as u16;
-    let x = match true {
-        true => 42,
-        false => 42u8,
-    } as u16;
-}
diff --git a/tests/run-pass-valgrind/coerce-match.rs b/tests/run-pass-valgrind/coerce-match.rs
deleted file mode 100644
index 95f16a8cc89..00000000000
--- a/tests/run-pass-valgrind/coerce-match.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Check that coercions are propagated through match and if expressions.
-
-//@ pretty-expanded FIXME #23616
-
-pub fn main() {
-    let _: Box<[isize]> = if true {
-        let b: Box<_> = Box::new([1, 2, 3]);
-        b
-    } else {
-        let b: Box<_> = Box::new([1]);
-        b
-    };
-
-    let _: Box<[isize]> = match true {
-        true => {
-            let b: Box<_> = Box::new([1, 2, 3]);
-            b
-        }
-        false => {
-            let b: Box<_> = Box::new([1]);
-            b
-        }
-    };
-
-    // Check we don't get over-keen at propagating coercions in the case of casts.
-    let x = if true { 42 } else { 42u8 } as u16;
-    let x = match true {
-        true => 42,
-        false => 42u8,
-    } as u16;
-}
diff --git a/tests/run-pass-valgrind/down-with-thread-dtors.rs b/tests/run-pass-valgrind/down-with-thread-dtors.rs
deleted file mode 100644
index 0d3745bba5b..00000000000
--- a/tests/run-pass-valgrind/down-with-thread-dtors.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-//@ ignore-emscripten
-
-thread_local!(static FOO: Foo = Foo);
-thread_local!(static BAR: Bar = Bar(1));
-thread_local!(static BAZ: Baz = Baz);
-
-static mut HIT: bool = false;
-
-struct Foo;
-struct Bar(i32);
-struct Baz;
-
-impl Drop for Foo {
-    fn drop(&mut self) {
-        BAR.with(|_| {});
-    }
-}
-
-impl Drop for Bar {
-    fn drop(&mut self) {
-        assert_eq!(self.0, 1);
-        self.0 = 2;
-        BAZ.with(|_| {});
-        assert_eq!(self.0, 2);
-    }
-}
-
-impl Drop for Baz {
-    fn drop(&mut self) {
-        unsafe {
-            HIT = true;
-        }
-    }
-}
-
-fn main() {
-    std::thread::spawn(|| {
-        FOO.with(|_| {});
-    })
-    .join()
-    .unwrap();
-    assert!(unsafe { HIT });
-}
diff --git a/tests/run-pass-valgrind/dst-dtor-1.rs b/tests/run-pass-valgrind/dst-dtor-1.rs
deleted file mode 100644
index 47065151a03..00000000000
--- a/tests/run-pass-valgrind/dst-dtor-1.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-static mut DROP_RAN: bool = false;
-
-struct Foo;
-impl Drop for Foo {
-    fn drop(&mut self) {
-        unsafe {
-            DROP_RAN = true;
-        }
-    }
-}
-
-trait Trait {
-    fn dummy(&self) {}
-}
-impl Trait for Foo {}
-
-struct Fat<T: ?Sized> {
-    f: T,
-}
-
-pub fn main() {
-    {
-        let _x: Box<Fat<Trait>> = Box::<Fat<Foo>>::new(Fat { f: Foo });
-    }
-    unsafe {
-        assert!(DROP_RAN);
-    }
-}
diff --git a/tests/run-pass-valgrind/dst-dtor-2.rs b/tests/run-pass-valgrind/dst-dtor-2.rs
deleted file mode 100644
index d8abebfb447..00000000000
--- a/tests/run-pass-valgrind/dst-dtor-2.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-static mut DROP_RAN: isize = 0;
-
-struct Foo;
-impl Drop for Foo {
-    fn drop(&mut self) {
-        unsafe {
-            DROP_RAN += 1;
-        }
-    }
-}
-
-struct Fat<T: ?Sized> {
-    f: T,
-}
-
-pub fn main() {
-    {
-        let _x: Box<Fat<[Foo]>> = Box::<Fat<[Foo; 3]>>::new(Fat { f: [Foo, Foo, Foo] });
-    }
-    unsafe {
-        assert_eq!(DROP_RAN, 3);
-    }
-}
diff --git a/tests/run-pass-valgrind/dst-dtor-3.rs b/tests/run-pass-valgrind/dst-dtor-3.rs
deleted file mode 100644
index 09adaca21c7..00000000000
--- a/tests/run-pass-valgrind/dst-dtor-3.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-#![feature(unsized_tuple_coercion)]
-
-static mut DROP_RAN: bool = false;
-
-struct Foo;
-impl Drop for Foo {
-    fn drop(&mut self) {
-        unsafe {
-            DROP_RAN = true;
-        }
-    }
-}
-
-trait Trait {
-    fn dummy(&self) {}
-}
-impl Trait for Foo {}
-
-pub fn main() {
-    {
-        let _x: Box<(i32, Trait)> = Box::<(i32, Foo)>::new((42, Foo));
-    }
-    unsafe {
-        assert!(DROP_RAN);
-    }
-}
diff --git a/tests/run-pass-valgrind/dst-dtor-4.rs b/tests/run-pass-valgrind/dst-dtor-4.rs
deleted file mode 100644
index a66ac8e3cfc..00000000000
--- a/tests/run-pass-valgrind/dst-dtor-4.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#![feature(unsized_tuple_coercion)]
-
-static mut DROP_RAN: isize = 0;
-
-struct Foo;
-impl Drop for Foo {
-    fn drop(&mut self) {
-        unsafe {
-            DROP_RAN += 1;
-        }
-    }
-}
-
-pub fn main() {
-    {
-        let _x: Box<(i32, [Foo])> = Box::<(i32, [Foo; 3])>::new((42, [Foo, Foo, Foo]));
-    }
-    unsafe {
-        assert_eq!(DROP_RAN, 3);
-    }
-}
diff --git a/tests/run-pass-valgrind/exit-flushes.rs b/tests/run-pass-valgrind/exit-flushes.rs
deleted file mode 100644
index 4e25ef76d39..00000000000
--- a/tests/run-pass-valgrind/exit-flushes.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-//@ ignore-wasm32 no subprocess support
-//@ ignore-sgx no processes
-//@ ignore-apple this needs valgrind 3.11 or higher; see
-// https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679
-
-use std::env;
-use std::process::{Command, exit};
-
-fn main() {
-    if env::args().len() > 1 {
-        print!("hello!");
-        exit(0);
-    } else {
-        let out = Command::new(env::args().next().unwrap()).arg("foo").output().unwrap();
-        assert!(out.status.success());
-        assert_eq!(String::from_utf8(out.stdout).unwrap(), "hello!");
-        assert_eq!(String::from_utf8(out.stderr).unwrap(), "");
-    }
-}
diff --git a/tests/run-pass-valgrind/issue-44800.rs b/tests/run-pass-valgrind/issue-44800.rs
deleted file mode 100644
index f76657ca752..00000000000
--- a/tests/run-pass-valgrind/issue-44800.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-use std::alloc::System;
-use std::collections::VecDeque;
-
-#[global_allocator]
-static ALLOCATOR: System = System;
-
-fn main() {
-    let mut deque = VecDeque::with_capacity(32);
-    deque.push_front(0);
-    deque.reserve(31);
-    deque.push_back(0);
-}
diff --git a/tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call.rs b/tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call.rs
deleted file mode 100644
index 5d3f558a63a..00000000000
--- a/tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call.rs
+++ /dev/null
@@ -1,55 +0,0 @@
-#![feature(unsized_locals)]
-#![feature(unboxed_closures)]
-#![feature(tuple_trait)]
-
-pub trait FnOnce<Args: std::marker::Tuple> {
-    type Output;
-    extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
-}
-
-struct A;
-
-impl FnOnce<()> for A {
-    type Output = String;
-    extern "rust-call" fn call_once(self, (): ()) -> Self::Output {
-        format!("hello")
-    }
-}
-
-struct B(i32);
-
-impl FnOnce<()> for B {
-    type Output = String;
-    extern "rust-call" fn call_once(self, (): ()) -> Self::Output {
-        format!("{}", self.0)
-    }
-}
-
-struct C(String);
-
-impl FnOnce<()> for C {
-    type Output = String;
-    extern "rust-call" fn call_once(self, (): ()) -> Self::Output {
-        self.0
-    }
-}
-
-struct D(Box<String>);
-
-impl FnOnce<()> for D {
-    type Output = String;
-    extern "rust-call" fn call_once(self, (): ()) -> Self::Output {
-        *self.0
-    }
-}
-
-fn main() {
-    let x = *(Box::new(A) as Box<dyn FnOnce<(), Output = String>>);
-    assert_eq!(x.call_once(()), format!("hello"));
-    let x = *(Box::new(B(42)) as Box<dyn FnOnce<(), Output = String>>);
-    assert_eq!(x.call_once(()), format!("42"));
-    let x = *(Box::new(C(format!("jumping fox"))) as Box<dyn FnOnce<(), Output = String>>);
-    assert_eq!(x.call_once(()), format!("jumping fox"));
-    let x = *(Box::new(D(Box::new(format!("lazy dog")))) as Box<dyn FnOnce<(), Output = String>>);
-    assert_eq!(x.call_once(()), format!("lazy dog"));
-}
diff --git a/tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call2.rs b/tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call2.rs
deleted file mode 100644
index 9b6648f2e27..00000000000
--- a/tests/run-pass-valgrind/unsized-locals/by-value-trait-objects-rust-call2.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-#![feature(unsized_locals)]
-#![feature(unboxed_closures)]
-#![feature(tuple_trait)]
-
-pub trait FnOnce<Args: std::marker::Tuple> {
-    type Output;
-    extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
-}
-
-struct A;
-
-impl FnOnce<(String, Box<str>)> for A {
-    type Output = String;
-    extern "rust-call" fn call_once(self, (s1, s2): (String, Box<str>)) -> Self::Output {
-        assert_eq!(&s1 as &str, "s1");
-        assert_eq!(&s2 as &str, "s2");
-        format!("hello")
-    }
-}
-
-struct B(i32);
-
-impl FnOnce<(String, Box<str>)> for B {
-    type Output = String;
-    extern "rust-call" fn call_once(self, (s1, s2): (String, Box<str>)) -> Self::Output {
-        assert_eq!(&s1 as &str, "s1");
-        assert_eq!(&s2 as &str, "s2");
-        format!("{}", self.0)
-    }
-}
-
-struct C(String);
-
-impl FnOnce<(String, Box<str>)> for C {
-    type Output = String;
-    extern "rust-call" fn call_once(self, (s1, s2): (String, Box<str>)) -> Self::Output {
-        assert_eq!(&s1 as &str, "s1");
-        assert_eq!(&s2 as &str, "s2");
-        self.0
-    }
-}
-
-struct D(Box<String>);
-
-impl FnOnce<(String, Box<str>)> for D {
-    type Output = String;
-    extern "rust-call" fn call_once(self, (s1, s2): (String, Box<str>)) -> Self::Output {
-        assert_eq!(&s1 as &str, "s1");
-        assert_eq!(&s2 as &str, "s2");
-        *self.0
-    }
-}
-
-fn main() {
-    let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
-    let x = *(Box::new(A) as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
-    assert_eq!(x.call_once((s1, s2)), format!("hello"));
-    let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
-    let x = *(Box::new(B(42)) as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
-    assert_eq!(x.call_once((s1, s2)), format!("42"));
-    let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
-    let x = *(Box::new(C(format!("jumping fox")))
-        as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
-    assert_eq!(x.call_once((s1, s2)), format!("jumping fox"));
-    let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
-    let x = *(Box::new(D(Box::new(format!("lazy dog"))))
-        as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
-    assert_eq!(x.call_once((s1, s2)), format!("lazy dog"));
-}
diff --git a/tests/run-pass-valgrind/unsized-locals/by-value-trait-objects.rs b/tests/run-pass-valgrind/unsized-locals/by-value-trait-objects.rs
deleted file mode 100644
index 3f6b6d262b5..00000000000
--- a/tests/run-pass-valgrind/unsized-locals/by-value-trait-objects.rs
+++ /dev/null
@@ -1,48 +0,0 @@
-#![feature(unsized_locals)]
-
-pub trait Foo {
-    fn foo(self) -> String;
-}
-
-struct A;
-
-impl Foo for A {
-    fn foo(self) -> String {
-        format!("hello")
-    }
-}
-
-struct B(i32);
-
-impl Foo for B {
-    fn foo(self) -> String {
-        format!("{}", self.0)
-    }
-}
-
-struct C(String);
-
-impl Foo for C {
-    fn foo(self) -> String {
-        self.0
-    }
-}
-
-struct D(Box<String>);
-
-impl Foo for D {
-    fn foo(self) -> String {
-        *self.0
-    }
-}
-
-fn main() {
-    let x = *(Box::new(A) as Box<dyn Foo>);
-    assert_eq!(x.foo(), format!("hello"));
-    let x = *(Box::new(B(42)) as Box<dyn Foo>);
-    assert_eq!(x.foo(), format!("42"));
-    let x = *(Box::new(C(format!("jumping fox"))) as Box<dyn Foo>);
-    assert_eq!(x.foo(), format!("jumping fox"));
-    let x = *(Box::new(D(Box::new(format!("lazy dog")))) as Box<dyn Foo>);
-    assert_eq!(x.foo(), format!("lazy dog"));
-}
diff --git a/tests/run-pass-valgrind/unsized-locals/long-live-the-unsized-temporary.rs b/tests/run-pass-valgrind/unsized-locals/long-live-the-unsized-temporary.rs
deleted file mode 100644
index a7b9052617f..00000000000
--- a/tests/run-pass-valgrind/unsized-locals/long-live-the-unsized-temporary.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-#![allow(incomplete_features)]
-#![feature(unsized_locals, unsized_fn_params)]
-
-use std::fmt;
-
-fn gen_foo() -> Box<fmt::Display> {
-    Box::new(Box::new("foo"))
-}
-
-fn foo(x: fmt::Display) {
-    assert_eq!(x.to_string(), "foo");
-}
-
-fn foo_indirect(x: fmt::Display) {
-    foo(x);
-}
-
-fn main() {
-    foo(*gen_foo());
-    foo_indirect(*gen_foo());
-
-    {
-        let x: fmt::Display = *gen_foo();
-        foo(x);
-    }
-
-    {
-        let x: fmt::Display = *gen_foo();
-        let y: fmt::Display = *gen_foo();
-        foo(x);
-        foo(y);
-    }
-
-    {
-        let mut cnt: usize = 3;
-        let x = loop {
-            let x: fmt::Display = *gen_foo();
-            if cnt == 0 {
-                break x;
-            } else {
-                cnt -= 1;
-            }
-        };
-        foo(x);
-    }
-
-    {
-        let x: fmt::Display = *gen_foo();
-        let x = if true { x } else { *gen_foo() };
-        foo(x);
-    }
-}