about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2024-04-15 23:46:27 -0400
committerBen Kimock <kimockb@gmail.com>2024-04-17 15:08:08 -0400
commitb91c1aafecdd804f3d12eae857671d2059e87c2e (patch)
tree1b6d30b6f15ee851bf9a46b9e63feb3495b07529
parentc45dee5efd0c042e9d1e24559ebd0d6424d8aa70 (diff)
downloadrust-b91c1aafecdd804f3d12eae857671d2059e87c2e.tar.gz
rust-b91c1aafecdd804f3d12eae857671d2059e87c2e.zip
Clean up users of rust_dbg_call
-rw-r--r--tests/auxiliary/rust_test_helpers.c6
-rw-r--r--tests/ui/abi/extern/auxiliary/extern-crosscrate-source.rs25
-rw-r--r--tests/ui/abi/extern/extern-call-deep.rs28
-rw-r--r--tests/ui/abi/extern/extern-call-deep2.rs29
-rw-r--r--tests/ui/abi/extern/extern-call-indirect.rs26
-rw-r--r--tests/ui/abi/extern/extern-call-scrub.rs30
-rw-r--r--tests/ui/abi/extern/extern-crosscrate.rs9
-rw-r--r--tests/ui/abi/foreign/foreign-call-no-runtime.rs60
8 files changed, 56 insertions, 157 deletions
diff --git a/tests/auxiliary/rust_test_helpers.c b/tests/auxiliary/rust_test_helpers.c
index 965df44c676..34cc7fd5dfb 100644
--- a/tests/auxiliary/rust_test_helpers.c
+++ b/tests/auxiliary/rust_test_helpers.c
@@ -27,10 +27,10 @@ rust_dbg_extern_identity_u8(char u) {
     return u;
 }
 
-typedef void *(*dbg_callback)(void*);
+typedef uint64_t (*dbg_callback)(uint64_t);
 
-void *
-rust_dbg_call(dbg_callback cb, void *data) {
+uint64_t
+rust_dbg_call(dbg_callback cb, uint64_t data) {
     return cb(data);
 }
 
diff --git a/tests/ui/abi/extern/auxiliary/extern-crosscrate-source.rs b/tests/ui/abi/extern/auxiliary/extern-crosscrate-source.rs
index 9c61518b941..6b218771096 100644
--- a/tests/ui/abi/extern/auxiliary/extern-crosscrate-source.rs
+++ b/tests/ui/abi/extern/auxiliary/extern-crosscrate-source.rs
@@ -1,28 +1,21 @@
 #![crate_name = "externcallback"]
 #![crate_type = "lib"]
-#![feature(rustc_private)]
 
-extern crate libc;
-
-pub mod rustrt {
-    extern crate libc;
-
-    #[link(name = "rust_test_helpers", kind = "static")]
-    extern "C" {
-        pub fn rust_dbg_call(
-            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-            data: libc::uintptr_t,
-        ) -> libc::uintptr_t;
-    }
+#[link(name = "rust_test_helpers", kind = "static")]
+extern "C" {
+    pub fn rust_dbg_call(
+        cb: extern "C" fn(u64) -> u64,
+        data: u64,
+    ) -> u64;
 }
 
-pub fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
+pub fn fact(n: u64) -> u64 {
     unsafe {
         println!("n = {}", n);
-        rustrt::rust_dbg_call(cb, n)
+        rust_dbg_call(cb, n)
     }
 }
 
-pub extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
+pub extern "C" fn cb(data: u64) -> u64 {
     if data == 1 { data } else { fact(data - 1) * data }
 }
diff --git a/tests/ui/abi/extern/extern-call-deep.rs b/tests/ui/abi/extern/extern-call-deep.rs
index 062e70b1b6e..40457ae5720 100644
--- a/tests/ui/abi/extern/extern-call-deep.rs
+++ b/tests/ui/abi/extern/extern-call-deep.rs
@@ -1,35 +1,27 @@
 //@ run-pass
 //@ ignore-emscripten blows the JS stack
 
-#![feature(rustc_private)]
-
-extern crate libc;
-
-mod rustrt {
-    extern crate libc;
-
-    #[link(name = "rust_test_helpers", kind = "static")]
-    extern "C" {
-        pub fn rust_dbg_call(
-            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-            data: libc::uintptr_t,
-        ) -> libc::uintptr_t;
-    }
+#[link(name = "rust_test_helpers", kind = "static")]
+extern "C" {
+    pub fn rust_dbg_call(
+        cb: extern "C" fn(u64) -> u64,
+        data: u64,
+    ) -> u64;
 }
 
-extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
+extern "C" fn cb(data: u64) -> u64 {
     if data == 1 { data } else { count(data - 1) + 1 }
 }
 
-fn count(n: libc::uintptr_t) -> libc::uintptr_t {
+fn count(n: u64) -> u64 {
     unsafe {
         println!("n = {}", n);
-        rustrt::rust_dbg_call(cb, n)
+        rust_dbg_call(cb, n)
     }
 }
 
 pub fn main() {
     let result = count(1000);
-    println!("result = {}", result);
+    println!("result = {:?}", result);
     assert_eq!(result, 1000);
 }
diff --git a/tests/ui/abi/extern/extern-call-deep2.rs b/tests/ui/abi/extern/extern-call-deep2.rs
index c021bc22348..91ca28d80c8 100644
--- a/tests/ui/abi/extern/extern-call-deep2.rs
+++ b/tests/ui/abi/extern/extern-call-deep2.rs
@@ -1,31 +1,24 @@
 //@ run-pass
-#![allow(unused_must_use)]
 //@ needs-threads
-#![feature(rustc_private)]
 
-extern crate libc;
 use std::thread;
 
-mod rustrt {
-    extern crate libc;
-
-    #[link(name = "rust_test_helpers", kind = "static")]
-    extern "C" {
-        pub fn rust_dbg_call(
-            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-            data: libc::uintptr_t,
-        ) -> libc::uintptr_t;
-    }
+#[link(name = "rust_test_helpers", kind = "static")]
+extern "C" {
+    pub fn rust_dbg_call(
+        cb: extern "C" fn(u64) -> u64,
+        data: u64,
+    ) -> u64;
 }
 
-extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
-    if data == 1 { data } else { count(data - 1) + 1 }
+extern "C" fn cb(data: u64) -> u64 {
+    if data == 1 { data } else { count(data - 1 ) + 1 }
 }
 
-fn count(n: libc::uintptr_t) -> libc::uintptr_t {
+fn count(n: u64) -> u64 {
     unsafe {
         println!("n = {}", n);
-        rustrt::rust_dbg_call(cb, n)
+        rust_dbg_call(cb, n)
     }
 }
 
@@ -37,5 +30,5 @@ pub fn main() {
         println!("result = {}", result);
         assert_eq!(result, 1000);
     })
-    .join();
+    .join().unwrap();
 }
diff --git a/tests/ui/abi/extern/extern-call-indirect.rs b/tests/ui/abi/extern/extern-call-indirect.rs
index 18fb07d8c8b..ef1e8ae5e76 100644
--- a/tests/ui/abi/extern/extern-call-indirect.rs
+++ b/tests/ui/abi/extern/extern-call-indirect.rs
@@ -1,29 +1,21 @@
 //@ run-pass
 
-#![feature(rustc_private)]
-
-extern crate libc;
-
-mod rustrt {
-    extern crate libc;
-
-    #[link(name = "rust_test_helpers", kind = "static")]
-    extern "C" {
-        pub fn rust_dbg_call(
-            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-            data: libc::uintptr_t,
-        ) -> libc::uintptr_t;
-    }
+#[link(name = "rust_test_helpers", kind = "static")]
+extern "C" {
+    pub fn rust_dbg_call(
+        cb: extern "C" fn(u64) -> u64,
+        data: u64,
+    ) -> u64;
 }
 
-extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
+extern "C" fn cb(data: u64) -> u64 {
     if data == 1 { data } else { fact(data - 1) * data }
 }
 
-fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
+fn fact(n: u64) -> u64 {
     unsafe {
         println!("n = {}", n);
-        rustrt::rust_dbg_call(cb, n)
+        rust_dbg_call(cb, n)
     }
 }
 
diff --git a/tests/ui/abi/extern/extern-call-scrub.rs b/tests/ui/abi/extern/extern-call-scrub.rs
index 7edf8975ad8..7df3a8f04ef 100644
--- a/tests/ui/abi/extern/extern-call-scrub.rs
+++ b/tests/ui/abi/extern/extern-call-scrub.rs
@@ -1,35 +1,27 @@
 //@ run-pass
-#![allow(unused_must_use)]
+//@ needs-threads
 // This time we're testing repeatedly going up and down both stacks to
 // make sure the stack pointers are maintained properly in both
 // directions
 
-//@ needs-threads
-#![feature(rustc_private)]
-
-extern crate libc;
 use std::thread;
 
-mod rustrt {
-    extern crate libc;
-
-    #[link(name = "rust_test_helpers", kind = "static")]
-    extern "C" {
-        pub fn rust_dbg_call(
-            cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
-            data: libc::uintptr_t,
-        ) -> libc::uintptr_t;
-    }
+#[link(name = "rust_test_helpers", kind = "static")]
+extern "C" {
+    pub fn rust_dbg_call(
+        cb: extern "C" fn(u64) -> u64,
+        data: u64,
+    ) -> u64;
 }
 
-extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
+extern "C" fn cb(data: u64) -> u64 {
     if data == 1 { data } else { count(data - 1) + count(data - 1) }
 }
 
-fn count(n: libc::uintptr_t) -> libc::uintptr_t {
+fn count(n: u64) -> u64 {
     unsafe {
         println!("n = {}", n);
-        rustrt::rust_dbg_call(cb, n)
+        rust_dbg_call(cb, n)
     }
 }
 
@@ -41,5 +33,5 @@ pub fn main() {
         println!("result = {}", result);
         assert_eq!(result, 2048);
     })
-    .join();
+    .join().unwrap();
 }
diff --git a/tests/ui/abi/extern/extern-crosscrate.rs b/tests/ui/abi/extern/extern-crosscrate.rs
index c283cbe3216..b467d992984 100644
--- a/tests/ui/abi/extern/extern-crosscrate.rs
+++ b/tests/ui/abi/extern/extern-crosscrate.rs
@@ -1,15 +1,12 @@
 //@ run-pass
 //@ aux-build:extern-crosscrate-source.rs
 
-#![feature(rustc_private)]
-
 extern crate externcallback;
-extern crate libc;
 
-fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
+fn fact(n: u64) -> u64 {
     unsafe {
-        println!("n = {}", n);
-        externcallback::rustrt::rust_dbg_call(externcallback::cb, n)
+        println!("n = {:?}", n);
+        externcallback::rust_dbg_call(externcallback::cb, n)
     }
 }
 
diff --git a/tests/ui/abi/foreign/foreign-call-no-runtime.rs b/tests/ui/abi/foreign/foreign-call-no-runtime.rs
deleted file mode 100644
index fccd62b6100..00000000000
--- a/tests/ui/abi/foreign/foreign-call-no-runtime.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-//@ run-pass
-//@ needs-threads
-
-#![feature(rustc_private)]
-
-extern crate libc;
-
-use std::mem;
-use std::thread;
-
-#[link(name = "rust_test_helpers", kind = "static")]
-extern "C" {
-    fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t), data: libc::uintptr_t) -> libc::uintptr_t;
-}
-
-pub fn main() {
-    unsafe {
-        thread::spawn(move || {
-            let i: isize = 100;
-            rust_dbg_call(callback_isize, mem::transmute(&i));
-        })
-        .join()
-        .unwrap();
-
-        thread::spawn(move || {
-            let i: i32 = 100;
-            rust_dbg_call(callback_i32, mem::transmute(&i));
-        })
-        .join()
-        .unwrap();
-
-        thread::spawn(move || {
-            let i: i64 = 100;
-            rust_dbg_call(callback_i64, mem::transmute(&i));
-        })
-        .join()
-        .unwrap();
-    }
-}
-
-extern "C" fn callback_isize(data: libc::uintptr_t) {
-    unsafe {
-        let data = data as *const isize;
-        assert_eq!(*data, 100);
-    }
-}
-
-extern "C" fn callback_i64(data: libc::uintptr_t) {
-    unsafe {
-        let data = data as *const i64;
-        assert_eq!(*data, 100);
-    }
-}
-
-extern "C" fn callback_i32(data: libc::uintptr_t) {
-    unsafe {
-        let data = data as *const i32;
-        assert_eq!(*data, 100);
-    }
-}