Skip to content

Commit e7cb951

Browse files
committed
Remove libc from more tests
1 parent 1dea922 commit e7cb951

20 files changed

+57
-134
lines changed

tests/ui/abi/anon-extern-mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
//@ run-pass
22
//@ pretty-expanded FIXME #23616
33

4-
#![feature(rustc_private)]
5-
6-
extern crate libc;
7-
84
#[link(name = "rust_test_helpers", kind = "static")]
95
extern "C" {
10-
fn rust_get_test_int() -> libc::intptr_t;
6+
fn rust_get_test_int() -> isize;
117
}
128

139
pub fn main() {

tests/ui/abi/c-stack-as-value.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
//@ run-pass
22
//@ pretty-expanded FIXME #23616
33

4-
#![feature(rustc_private)]
5-
64
mod rustrt {
7-
extern crate libc;
8-
95
#[link(name = "rust_test_helpers", kind = "static")]
106
extern "C" {
11-
pub fn rust_get_test_int() -> libc::intptr_t;
7+
pub fn rust_get_test_int() -> isize;
128
}
139
}
1410

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#![crate_name = "anonexternmod"]
2-
#![feature(rustc_private)]
3-
4-
extern crate libc;
52

63
#[link(name = "rust_test_helpers", kind = "static")]
74
extern "C" {
8-
pub fn rust_get_test_int() -> libc::intptr_t;
5+
pub fn rust_get_test_int() -> isize;
96
}
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
#![crate_name = "externcallback"]
22
#![crate_type = "lib"]
3-
#![feature(rustc_private)]
4-
5-
extern crate libc;
63

74
pub mod rustrt {
8-
extern crate libc;
9-
105
#[link(name = "rust_test_helpers", kind = "static")]
116
extern "C" {
127
pub fn rust_dbg_call(
13-
cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
14-
data: libc::uintptr_t,
15-
) -> libc::uintptr_t;
8+
cb: extern "C" fn(usize) -> usize,
9+
data: usize,
10+
) -> usize;
1611
}
1712
}
1813

19-
pub fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
14+
pub fn fact(n: usize) -> usize {
2015
unsafe {
21-
println!("n = {}", n);
16+
println!("n = {:?}", n);
2217
rustrt::rust_dbg_call(cb, n)
2318
}
2419
}
2520

26-
pub extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
21+
pub extern "C" fn cb(data: usize) -> usize {
2722
if data == 1 { data } else { fact(data - 1) * data }
2823
}

tests/ui/abi/extern/extern-call-deep.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
//@ run-pass
22
//@ ignore-emscripten blows the JS stack
33

4-
#![feature(rustc_private)]
5-
6-
extern crate libc;
7-
84
mod rustrt {
9-
extern crate libc;
10-
115
#[link(name = "rust_test_helpers", kind = "static")]
126
extern "C" {
137
pub fn rust_dbg_call(
14-
cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
15-
data: libc::uintptr_t,
16-
) -> libc::uintptr_t;
8+
cb: extern "C" fn(usize) -> usize,
9+
data: usize,
10+
) -> usize;
1711
}
1812
}
1913

20-
extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
14+
extern "C" fn cb(data: usize) -> usize {
2115
if data == 1 { data } else { count(data - 1) + 1 }
2216
}
2317

24-
fn count(n: libc::uintptr_t) -> libc::uintptr_t {
18+
fn count(n: usize) -> usize {
2519
unsafe {
26-
println!("n = {}", n);
20+
println!("n = {:?}", n);
2721
rustrt::rust_dbg_call(cb, n)
2822
}
2923
}
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
//@ run-pass
2-
#![allow(unused_must_use)]
32
//@ needs-threads
4-
#![feature(rustc_private)]
53

6-
extern crate libc;
74
use std::thread;
85

96
mod rustrt {
10-
extern crate libc;
11-
127
#[link(name = "rust_test_helpers", kind = "static")]
138
extern "C" {
149
pub fn rust_dbg_call(
15-
cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
16-
data: libc::uintptr_t,
17-
) -> libc::uintptr_t;
10+
cb: extern "C" fn(usize) -> usize,
11+
data: usize,
12+
) -> usize;
1813
}
1914
}
2015

21-
extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
22-
if data == 1 { data } else { count(data - 1) + 1 }
16+
extern "C" fn cb(data: usize) -> usize {
17+
if data == 1 { data } else { count(data - 1 ) + 1 }
2318
}
2419

25-
fn count(n: libc::uintptr_t) -> libc::uintptr_t {
20+
fn count(n: usize) -> usize {
2621
unsafe {
27-
println!("n = {}", n);
22+
println!("n = {:?}", n);
2823
rustrt::rust_dbg_call(cb, n)
2924
}
3025
}
@@ -34,8 +29,8 @@ pub fn main() {
3429
// has a large stack)
3530
thread::spawn(move || {
3631
let result = count(1000);
37-
println!("result = {}", result);
32+
println!("result = {:?}", result);
3833
assert_eq!(result, 1000);
3934
})
40-
.join();
35+
.join().unwrap();
4136
}

tests/ui/abi/extern/extern-call-indirect.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
11
//@ run-pass
22

3-
#![feature(rustc_private)]
4-
5-
extern crate libc;
6-
73
mod rustrt {
8-
extern crate libc;
9-
104
#[link(name = "rust_test_helpers", kind = "static")]
115
extern "C" {
126
pub fn rust_dbg_call(
13-
cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
14-
data: libc::uintptr_t,
15-
) -> libc::uintptr_t;
7+
cb: extern "C" fn(usize) -> usize,
8+
data: usize,
9+
) -> usize;
1610
}
1711
}
1812

19-
extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
13+
extern "C" fn cb(data: usize) -> usize {
2014
if data == 1 { data } else { fact(data - 1) * data }
2115
}
2216

23-
fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
17+
fn fact(n: usize) -> usize {
2418
unsafe {
2519
println!("n = {}", n);
2620
rustrt::rust_dbg_call(cb, n)
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,26 @@
11
//@ run-pass
2-
#![allow(unused_must_use)]
2+
//@ needs-threads
33
// This time we're testing repeatedly going up and down both stacks to
44
// make sure the stack pointers are maintained properly in both
55
// directions
66

7-
//@ needs-threads
8-
#![feature(rustc_private)]
9-
10-
extern crate libc;
117
use std::thread;
128

139
mod rustrt {
14-
extern crate libc;
15-
1610
#[link(name = "rust_test_helpers", kind = "static")]
1711
extern "C" {
1812
pub fn rust_dbg_call(
19-
cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t,
20-
data: libc::uintptr_t,
21-
) -> libc::uintptr_t;
13+
cb: extern "C" fn(usize) -> usize,
14+
data: usize,
15+
) -> usize;
2216
}
2317
}
2418

25-
extern "C" fn cb(data: libc::uintptr_t) -> libc::uintptr_t {
19+
extern "C" fn cb(data: usize) -> usize {
2620
if data == 1 { data } else { count(data - 1) + count(data - 1) }
2721
}
2822

29-
fn count(n: libc::uintptr_t) -> libc::uintptr_t {
23+
fn count(n: usize) -> usize {
3024
unsafe {
3125
println!("n = {}", n);
3226
rustrt::rust_dbg_call(cb, n)
@@ -41,5 +35,5 @@ pub fn main() {
4135
println!("result = {}", result);
4236
assert_eq!(result, 2048);
4337
})
44-
.join();
38+
.join().unwrap();
4539
}

tests/ui/abi/extern/extern-crosscrate.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
//@ run-pass
22
//@ aux-build:extern-crosscrate-source.rs
33

4-
#![feature(rustc_private)]
5-
64
extern crate externcallback;
7-
extern crate libc;
85

9-
fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
6+
fn fact(n: usize) -> usize {
107
unsafe {
11-
println!("n = {}", n);
8+
println!("n = {:?}", n);
129
externcallback::rustrt::rust_dbg_call(externcallback::cb, n)
1310
}
1411
}

tests/ui/abi/foreign/auxiliary/foreign_lib.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
#![crate_name = "foreign_lib"]
2-
#![feature(rustc_private)]
32

43
pub mod rustrt {
5-
extern crate libc;
6-
74
#[link(name = "rust_test_helpers", kind = "static")]
85
extern "C" {
9-
pub fn rust_get_test_int() -> libc::intptr_t;
6+
pub fn rust_get_test_int() -> isize;
107
}
118
}
129

1310
pub mod rustrt2 {
14-
extern crate libc;
15-
1611
extern "C" {
17-
pub fn rust_get_test_int() -> libc::intptr_t;
12+
pub fn rust_get_test_int() -> isize;
1813
}
1914
}
2015

@@ -32,6 +27,6 @@ pub fn local_uses() {
3227
unsafe {
3328
let x = rustrt::rust_get_test_int();
3429
assert_eq!(x, rustrt2::rust_get_test_int());
35-
assert_eq!(x as *const _, rustrt3::rust_get_test_int());
30+
assert_eq!(x as *const u8, rustrt3::rust_get_test_int());
3631
}
3732
}

0 commit comments

Comments
 (0)