20 files changed +57
-134
lines changed Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
2
//@ pretty-expanded FIXME #23616
3
3
4
- #![ feature( rustc_private) ]
5
-
6
- extern crate libc;
7
-
8
4
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
9
5
extern "C" {
10
- fn rust_get_test_int ( ) -> libc :: intptr_t ;
6
+ fn rust_get_test_int ( ) -> isize ;
11
7
}
12
8
13
9
pub fn main ( ) {
Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
2
//@ pretty-expanded FIXME #23616
3
3
4
- #![ feature( rustc_private) ]
5
-
6
4
mod rustrt {
7
- extern crate libc;
8
-
9
5
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
10
6
extern "C" {
11
- pub fn rust_get_test_int ( ) -> libc :: intptr_t ;
7
+ pub fn rust_get_test_int ( ) -> isize ;
12
8
}
13
9
}
14
10
Original file line number Diff line number Diff line change 1
1
#![ crate_name = "anonexternmod" ]
2
- #![ feature( rustc_private) ]
3
-
4
- extern crate libc;
5
2
6
3
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
7
4
extern "C" {
8
- pub fn rust_get_test_int ( ) -> libc :: intptr_t ;
5
+ pub fn rust_get_test_int ( ) -> isize ;
9
6
}
Original file line number Diff line number Diff line change 1
1
#![ crate_name = "externcallback" ]
2
2
#![ crate_type = "lib" ]
3
- #![ feature( rustc_private) ]
4
-
5
- extern crate libc;
6
3
7
4
pub mod rustrt {
8
- extern crate libc;
9
-
10
5
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
11
6
extern "C" {
12
7
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 ;
16
11
}
17
12
}
18
13
19
- pub fn fact ( n : libc :: uintptr_t ) -> libc :: uintptr_t {
14
+ pub fn fact ( n : usize ) -> usize {
20
15
unsafe {
21
- println ! ( "n = {}" , n) ;
16
+ println ! ( "n = {:? }" , n) ;
22
17
rustrt:: rust_dbg_call ( cb, n)
23
18
}
24
19
}
25
20
26
- pub extern "C" fn cb ( data : libc :: uintptr_t ) -> libc :: uintptr_t {
21
+ pub extern "C" fn cb ( data : usize ) -> usize {
27
22
if data == 1 { data } else { fact ( data - 1 ) * data }
28
23
}
Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
2
//@ ignore-emscripten blows the JS stack
3
3
4
- #![ feature( rustc_private) ]
5
-
6
- extern crate libc;
7
-
8
4
mod rustrt {
9
- extern crate libc;
10
-
11
5
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
12
6
extern "C" {
13
7
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 ;
17
11
}
18
12
}
19
13
20
- extern "C" fn cb ( data : libc :: uintptr_t ) -> libc :: uintptr_t {
14
+ extern "C" fn cb ( data : usize ) -> usize {
21
15
if data == 1 { data } else { count ( data - 1 ) + 1 }
22
16
}
23
17
24
- fn count ( n : libc :: uintptr_t ) -> libc :: uintptr_t {
18
+ fn count ( n : usize ) -> usize {
25
19
unsafe {
26
- println ! ( "n = {}" , n) ;
20
+ println ! ( "n = {:? }" , n) ;
27
21
rustrt:: rust_dbg_call ( cb, n)
28
22
}
29
23
}
Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
- #![ allow( unused_must_use) ]
3
2
//@ needs-threads
4
- #![ feature( rustc_private) ]
5
3
6
- extern crate libc;
7
4
use std:: thread;
8
5
9
6
mod rustrt {
10
- extern crate libc;
11
-
12
7
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
13
8
extern "C" {
14
9
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 ;
18
13
}
19
14
}
20
15
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 }
23
18
}
24
19
25
- fn count ( n : libc :: uintptr_t ) -> libc :: uintptr_t {
20
+ fn count ( n : usize ) -> usize {
26
21
unsafe {
27
- println ! ( "n = {}" , n) ;
22
+ println ! ( "n = {:? }" , n) ;
28
23
rustrt:: rust_dbg_call ( cb, n)
29
24
}
30
25
}
@@ -34,8 +29,8 @@ pub fn main() {
34
29
// has a large stack)
35
30
thread:: spawn ( move || {
36
31
let result = count ( 1000 ) ;
37
- println ! ( "result = {}" , result) ;
32
+ println ! ( "result = {:? }" , result) ;
38
33
assert_eq ! ( result, 1000 ) ;
39
34
} )
40
- . join ( ) ;
35
+ . join ( ) . unwrap ( ) ;
41
36
}
Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
2
3
- #![ feature( rustc_private) ]
4
-
5
- extern crate libc;
6
-
7
3
mod rustrt {
8
- extern crate libc;
9
-
10
4
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
11
5
extern "C" {
12
6
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 ;
16
10
}
17
11
}
18
12
19
- extern "C" fn cb ( data : libc :: uintptr_t ) -> libc :: uintptr_t {
13
+ extern "C" fn cb ( data : usize ) -> usize {
20
14
if data == 1 { data } else { fact ( data - 1 ) * data }
21
15
}
22
16
23
- fn fact ( n : libc :: uintptr_t ) -> libc :: uintptr_t {
17
+ fn fact ( n : usize ) -> usize {
24
18
unsafe {
25
19
println ! ( "n = {}" , n) ;
26
20
rustrt:: rust_dbg_call ( cb, n)
Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
- #! [ allow ( unused_must_use ) ]
2
+ //@ needs-threads
3
3
// This time we're testing repeatedly going up and down both stacks to
4
4
// make sure the stack pointers are maintained properly in both
5
5
// directions
6
6
7
- //@ needs-threads
8
- #![ feature( rustc_private) ]
9
-
10
- extern crate libc;
11
7
use std:: thread;
12
8
13
9
mod rustrt {
14
- extern crate libc;
15
-
16
10
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
17
11
extern "C" {
18
12
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 ;
22
16
}
23
17
}
24
18
25
- extern "C" fn cb ( data : libc :: uintptr_t ) -> libc :: uintptr_t {
19
+ extern "C" fn cb ( data : usize ) -> usize {
26
20
if data == 1 { data } else { count ( data - 1 ) + count ( data - 1 ) }
27
21
}
28
22
29
- fn count ( n : libc :: uintptr_t ) -> libc :: uintptr_t {
23
+ fn count ( n : usize ) -> usize {
30
24
unsafe {
31
25
println ! ( "n = {}" , n) ;
32
26
rustrt:: rust_dbg_call ( cb, n)
@@ -41,5 +35,5 @@ pub fn main() {
41
35
println ! ( "result = {}" , result) ;
42
36
assert_eq ! ( result, 2048 ) ;
43
37
} )
44
- . join ( ) ;
38
+ . join ( ) . unwrap ( ) ;
45
39
}
Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
2
//@ aux-build:extern-crosscrate-source.rs
3
3
4
- #![ feature( rustc_private) ]
5
-
6
4
extern crate externcallback;
7
- extern crate libc;
8
5
9
- fn fact ( n : libc :: uintptr_t ) -> libc :: uintptr_t {
6
+ fn fact ( n : usize ) -> usize {
10
7
unsafe {
11
- println ! ( "n = {}" , n) ;
8
+ println ! ( "n = {:? }" , n) ;
12
9
externcallback:: rustrt:: rust_dbg_call ( externcallback:: cb, n)
13
10
}
14
11
}
Original file line number Diff line number Diff line change 1
1
#![ crate_name = "foreign_lib" ]
2
- #![ feature( rustc_private) ]
3
2
4
3
pub mod rustrt {
5
- extern crate libc;
6
-
7
4
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
8
5
extern "C" {
9
- pub fn rust_get_test_int ( ) -> libc :: intptr_t ;
6
+ pub fn rust_get_test_int ( ) -> isize ;
10
7
}
11
8
}
12
9
13
10
pub mod rustrt2 {
14
- extern crate libc;
15
-
16
11
extern "C" {
17
- pub fn rust_get_test_int ( ) -> libc :: intptr_t ;
12
+ pub fn rust_get_test_int ( ) -> isize ;
18
13
}
19
14
}
20
15
@@ -32,6 +27,6 @@ pub fn local_uses() {
32
27
unsafe {
33
28
let x = rustrt:: rust_get_test_int ( ) ;
34
29
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( ) ) ;
36
31
}
37
32
}
Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
2
//@ needs-threads
3
3
4
- #![ feature( rustc_private) ]
5
-
6
- extern crate libc;
7
-
4
+ use std:: ffi:: c_void;
8
5
use std:: mem;
9
6
use std:: thread;
10
7
11
8
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
12
9
extern "C" {
13
- fn rust_dbg_call ( cb : extern "C" fn ( libc :: uintptr_t ) , data : libc :: uintptr_t ) -> libc :: uintptr_t ;
10
+ fn rust_dbg_call ( cb : extern "C" fn ( * const c_void ) , data : * const c_void ) -> * const c_void ;
14
11
}
15
12
16
13
pub fn main ( ) {
@@ -38,21 +35,21 @@ pub fn main() {
38
35
}
39
36
}
40
37
41
- extern "C" fn callback_isize ( data : libc :: uintptr_t ) {
38
+ extern "C" fn callback_isize ( data : * const c_void ) {
42
39
unsafe {
43
40
let data = data as * const isize ;
44
41
assert_eq ! ( * data, 100 ) ;
45
42
}
46
43
}
47
44
48
- extern "C" fn callback_i64 ( data : libc :: uintptr_t ) {
45
+ extern "C" fn callback_i64 ( data : * const c_void ) {
49
46
unsafe {
50
47
let data = data as * const i64 ;
51
48
assert_eq ! ( * data, 100 ) ;
52
49
}
53
50
}
54
51
55
- extern "C" fn callback_i32 ( data : libc :: uintptr_t ) {
52
+ extern "C" fn callback_i32 ( data : * const c_void ) {
56
53
unsafe {
57
54
let data = data as * const i32 ;
58
55
assert_eq ! ( * data, 100 ) ;
Original file line number Diff line number Diff line change @@ -11,6 +11,6 @@ pub fn main() {
11
11
unsafe {
12
12
let x = foreign_lib:: rustrt:: rust_get_test_int ( ) ;
13
13
assert_eq ! ( x, foreign_lib:: rustrt2:: rust_get_test_int( ) ) ;
14
- assert_eq ! ( x as * const _ , foreign_lib:: rustrt3:: rust_get_test_int( ) ) ;
14
+ assert_eq ! ( x as * const u8 , foreign_lib:: rustrt3:: rust_get_test_int( ) ) ;
15
15
}
16
16
}
Original file line number Diff line number Diff line change 3
3
4
4
//@ pretty-expanded FIXME #23616
5
5
6
- #![ feature( rustc_private) ]
7
-
8
6
mod rustrt {
9
- extern crate libc;
10
-
11
7
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
12
8
extern "C" {
13
- pub fn rust_get_test_int ( ) -> libc :: intptr_t ;
9
+ pub fn rust_get_test_int ( ) -> isize ;
14
10
}
15
11
}
16
12
Original file line number Diff line number Diff line change 1
1
//@ run-pass
2
-
3
- #![ allow( unused_imports) ]
4
2
//@ ignore-wasm32 can't run commands
5
3
//@ ignore-sgx no processes
6
4
//@ ignore-fuchsia must translate zircon signal to SIGSEGV/SIGBUS, FIXME (#58590)
7
- #![ feature( rustc_private) ]
8
5
9
- extern crate libc ;
6
+ #! [ feature ( rustc_private ) ]
10
7
11
8
use std:: env;
9
+ use std:: ffi:: c_char;
12
10
use std:: process:: { Command , ExitStatus } ;
13
11
14
12
#[ link( name = "rust_test_helpers" , kind = "static" ) ]
15
13
extern "C" {
16
- fn rust_get_null_ptr ( ) -> * mut :: libc :: c_char ;
14
+ fn rust_get_null_ptr ( ) -> * mut c_char ;
17
15
}
18
16
19
17
#[ cfg( unix) ]
20
- fn check_status ( status : std :: process :: ExitStatus ) {
21
- use libc;
18
+ fn check_status ( status : ExitStatus ) {
19
+ extern crate libc;
22
20
use std:: os:: unix:: process:: ExitStatusExt ;
23
21
24
22
assert ! ( status. signal( ) == Some ( libc:: SIGSEGV ) || status. signal( ) == Some ( libc:: SIGBUS ) ) ;
25
23
}
26
24
27
25
#[ cfg( not( unix) ) ]
28
- fn check_status ( status : std :: process :: ExitStatus ) {
26
+ fn check_status ( status : ExitStatus ) {
29
27
assert ! ( !status. success( ) ) ;
30
28
}
31
29
There was a problem loading the remainder of the diff.
0 commit comments