--- /dev/null
+// run-pass
+// aux-build:anon-extern-mod-cross-crate-1.rs
+// pretty-expanded FIXME #23616
+// ignore-wasm32-bare no libc to test ffi with
+
+extern crate anonexternmod;
+
+use anonexternmod::rust_get_test_int;
+
+pub fn main() {
+ unsafe {
+ rust_get_test_int();
+ }
+}
--- /dev/null
+// aux-build:anon-extern-mod-cross-crate-1.rs
+// aux-build:anon-extern-mod-cross-crate-1.rs
+// pretty-expanded FIXME #23616
+// ignore-wasm32-bare no libc to test ffi with
+
+extern crate anonexternmod;
+
+pub fn main() { }
--- /dev/null
+// run-pass
+// aux-build:extern-crosscrate-source.rs
+// ignore-wasm32-bare no libc to test ffi with
+
+#![feature(rustc_private)]
+
+extern crate externcallback;
+extern crate libc;
+
+fn fact(n: libc::uintptr_t) -> libc::uintptr_t {
+ unsafe {
+ println!("n = {}", n);
+ externcallback::rustrt::rust_dbg_call(externcallback::cb, n)
+ }
+}
+
+pub fn main() {
+ let result = fact(10);
+ println!("result = {}", result);
+ assert_eq!(result, 3628800);
+}
--- /dev/null
+// run-pass
+// aux-build:foreign_lib.rs
+// ignore-wasm32-bare no libc to test ffi with
+
+// Check that we can still call duplicated extern (imported) functions
+// which were declared in another crate. See issues #32740 and #32783.
+
+
+extern crate foreign_lib;
+
+pub fn main() {
+ unsafe {
+ let x = foreign_lib::rustrt::rust_get_test_int();
+ assert_eq!(x, foreign_lib::rustrt2::rust_get_test_int());
+ assert_eq!(x as *const _, foreign_lib::rustrt3::rust_get_test_int());
+ }
+}
--- /dev/null
+// aux-build:foreign_lib.rs
+// ignore-wasm32-bare no libc to test ffi with
+
+// The purpose of this test is to check that we can
+// successfully (and safely) invoke external, cdecl
+// functions from outside the crate.
+
+// pretty-expanded FIXME #23616
+
+extern crate foreign_lib;
+
+pub fn main() {
+ unsafe {
+ let _foo = foreign_lib::rustrt::rust_get_test_int();
+ }
+}
--- /dev/null
+extern crate issue_25185_1;
+
+pub use issue_25185_1::rust_dbg_extern_identity_u32;
--- /dev/null
+// run-pass
+// aux-build:issue-25185-1.rs
+// aux-build:issue-25185-2.rs
+// ignore-wasm32-bare no libc for ffi testing
+
+extern crate issue_25185_2;
+
+fn main() {
+ let x = unsafe {
+ issue_25185_2::rust_dbg_extern_identity_u32(1)
+ };
+ assert_eq!(x, 1);
+}
--- /dev/null
+// force-host
+// no-prefer-dynamic
+
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn nop_attr(_attr: TokenStream, input: TokenStream) -> TokenStream {
+ assert!(_attr.to_string().is_empty());
+ input
+}
+
+#[proc_macro_attribute]
+pub fn no_output(_attr: TokenStream, _input: TokenStream) -> TokenStream {
+ assert!(_attr.to_string().is_empty());
+ assert!(!_input.to_string().is_empty());
+ "".parse().unwrap()
+}
+
+#[proc_macro]
+pub fn emit_input(input: TokenStream) -> TokenStream {
+ input
+}
--- /dev/null
+// ignore-arm
+// ignore-aarch64
+// ignore-mips
+// ignore-mips64
+// ignore-powerpc
+// ignore-s390x
+// ignore-sparc
+// ignore-sparc64
+// ignore-wasm
+// ignore-cloudabi no processes
+// ignore-emscripten no processes
+// ignore-sgx no processes
+// ignore-musl FIXME #31506
+// ignore-pretty
+// compile-flags: -C lto
+// no-prefer-dynamic
+
+include!("stack-probes.rs");