File tree Expand file tree Collapse file tree 9 files changed +136
-0
lines changed Expand file tree Collapse file tree 9 files changed +136
-0
lines changed Original file line number Diff line number Diff line change 1+ // run-pass
2+ // aux-build:anon-extern-mod-cross-crate-1.rs
3+ // pretty-expanded FIXME #23616
4+ // ignore-wasm32-bare no libc to test ffi with
5+
6+ extern crate anonexternmod;
7+
8+ use anonexternmod:: rust_get_test_int;
9+
10+ pub fn main ( ) {
11+ unsafe {
12+ rust_get_test_int ( ) ;
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ // aux-build:anon-extern-mod-cross-crate-1.rs
2+ // aux-build:anon-extern-mod-cross-crate-1.rs
3+ // pretty-expanded FIXME #23616
4+ // ignore-wasm32-bare no libc to test ffi with
5+
6+ extern crate anonexternmod;
7+
8+ pub fn main ( ) { }
Original file line number Diff line number Diff line change 1+ // run-pass
2+ // aux-build:extern-crosscrate-source.rs
3+ // ignore-wasm32-bare no libc to test ffi with
4+
5+ #![ feature( rustc_private) ]
6+
7+ extern crate externcallback;
8+ extern crate libc;
9+
10+ fn fact ( n : libc:: uintptr_t ) -> libc:: uintptr_t {
11+ unsafe {
12+ println ! ( "n = {}" , n) ;
13+ externcallback:: rustrt:: rust_dbg_call ( externcallback:: cb, n)
14+ }
15+ }
16+
17+ pub fn main ( ) {
18+ let result = fact ( 10 ) ;
19+ println ! ( "result = {}" , result) ;
20+ assert_eq ! ( result, 3628800 ) ;
21+ }
Original file line number Diff line number Diff line change 1+ // run-pass
2+ // aux-build:foreign_lib.rs
3+ // ignore-wasm32-bare no libc to test ffi with
4+
5+ // Check that we can still call duplicated extern (imported) functions
6+ // which were declared in another crate. See issues #32740 and #32783.
7+
8+
9+ extern crate foreign_lib;
10+
11+ pub fn main ( ) {
12+ unsafe {
13+ let x = foreign_lib:: rustrt:: rust_get_test_int ( ) ;
14+ assert_eq ! ( x, foreign_lib:: rustrt2:: rust_get_test_int( ) ) ;
15+ assert_eq ! ( x as * const _, foreign_lib:: rustrt3:: rust_get_test_int( ) ) ;
16+ }
17+ }
Original file line number Diff line number Diff line change 1+ // aux-build:foreign_lib.rs
2+ // ignore-wasm32-bare no libc to test ffi with
3+
4+ // The purpose of this test is to check that we can
5+ // successfully (and safely) invoke external, cdecl
6+ // functions from outside the crate.
7+
8+ // pretty-expanded FIXME #23616
9+
10+ extern crate foreign_lib;
11+
12+ pub fn main ( ) {
13+ unsafe {
14+ let _foo = foreign_lib:: rustrt:: rust_get_test_int ( ) ;
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ extern crate issue_25185_1;
2+
3+ pub use issue_25185_1:: rust_dbg_extern_identity_u32;
Original file line number Diff line number Diff line change 1+ // run-pass
2+ // aux-build:issue-25185-1.rs
3+ // aux-build:issue-25185-2.rs
4+ // ignore-wasm32-bare no libc for ffi testing
5+
6+ extern crate issue_25185_2;
7+
8+ fn main ( ) {
9+ let x = unsafe {
10+ issue_25185_2:: rust_dbg_extern_identity_u32 ( 1 )
11+ } ;
12+ assert_eq ! ( x, 1 ) ;
13+ }
Original file line number Diff line number Diff line change 1+ // force-host
2+ // no-prefer-dynamic
3+
4+ #![ crate_type = "proc-macro" ]
5+
6+ extern crate proc_macro;
7+
8+ use proc_macro:: TokenStream ;
9+
10+ #[ proc_macro_attribute]
11+ pub fn nop_attr ( _attr : TokenStream , input : TokenStream ) -> TokenStream {
12+ assert ! ( _attr. to_string( ) . is_empty( ) ) ;
13+ input
14+ }
15+
16+ #[ proc_macro_attribute]
17+ pub fn no_output ( _attr : TokenStream , _input : TokenStream ) -> TokenStream {
18+ assert ! ( _attr. to_string( ) . is_empty( ) ) ;
19+ assert ! ( !_input. to_string( ) . is_empty( ) ) ;
20+ "" . parse ( ) . unwrap ( )
21+ }
22+
23+ #[ proc_macro]
24+ pub fn emit_input ( input : TokenStream ) -> TokenStream {
25+ input
26+ }
Original file line number Diff line number Diff line change 1+ // ignore-arm
2+ // ignore-aarch64
3+ // ignore-mips
4+ // ignore-mips64
5+ // ignore-powerpc
6+ // ignore-s390x
7+ // ignore-sparc
8+ // ignore-sparc64
9+ // ignore-wasm
10+ // ignore-cloudabi no processes
11+ // ignore-emscripten no processes
12+ // ignore-sgx no processes
13+ // ignore-musl FIXME #31506
14+ // ignore-pretty
15+ // compile-flags: -C lto
16+ // no-prefer-dynamic
17+
18+ include ! ( "stack-probes.rs" ) ;
You can’t perform that action at this time.
0 commit comments