diff options
Diffstat (limited to 'src/test/ui/foreign')
17 files changed, 0 insertions, 238 deletions
diff --git a/src/test/ui/foreign/auxiliary/fn-abi.rs b/src/test/ui/foreign/auxiliary/fn-abi.rs deleted file mode 100644 index 25c9e1b4c..000000000 --- a/src/test/ui/foreign/auxiliary/fn-abi.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[no_mangle] -pub extern fn foo() {} diff --git a/src/test/ui/foreign/foreign-fn-linkname.rs b/src/test/ui/foreign/foreign-fn-linkname.rs deleted file mode 100644 index f6d820594..000000000 --- a/src/test/ui/foreign/foreign-fn-linkname.rs +++ /dev/null @@ -1,28 +0,0 @@ -// run-pass -// ignore-wasm32-bare no libc to test ffi with -// ignore-sgx no libc - -#![feature(rustc_private)] - -extern crate libc; -use std::ffi::CString; - -mod mlibc { - use libc::{c_char, size_t}; - - extern "C" { - #[link_name = "strlen"] - pub fn my_strlen(str: *const c_char) -> size_t; - } -} - -fn strlen(str: String) -> usize { - // C string is terminated with a zero - let s = CString::new(str).unwrap(); - unsafe { mlibc::my_strlen(s.as_ptr()) as usize } -} - -pub fn main() { - let len = strlen("Rust".to_string()); - assert_eq!(len, 4); -} diff --git a/src/test/ui/foreign/foreign-int-types.rs b/src/test/ui/foreign/foreign-int-types.rs deleted file mode 100644 index 2d01d3204..000000000 --- a/src/test/ui/foreign/foreign-int-types.rs +++ /dev/null @@ -1,12 +0,0 @@ -// run-pass -#![forbid(improper_ctypes)] -#![allow(dead_code)] - -mod xx { - extern "C" { - pub fn strlen(str: *const u8) -> usize; - pub fn foo(x: isize, y: usize); - } -} - -fn main() {} diff --git a/src/test/ui/foreign/foreign-mod-src/compiletest-ignore-dir b/src/test/ui/foreign/foreign-mod-src/compiletest-ignore-dir deleted file mode 100644 index e69de29bb..000000000 --- a/src/test/ui/foreign/foreign-mod-src/compiletest-ignore-dir +++ /dev/null diff --git a/src/test/ui/foreign/foreign-mod-src/inner.rs b/src/test/ui/foreign/foreign-mod-src/inner.rs deleted file mode 100644 index cf484878b..000000000 --- a/src/test/ui/foreign/foreign-mod-src/inner.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass - - - -pub fn main() { - let f = "Makefile"; - let s = rustrt.str_buf(f); - let buf = libc.malloc(1024); - let fd = libc.open(s, 0, 0); - libc.read(fd, buf, 1024); - libc.write(1, buf, 1024); - libc.close(fd); - libc.free(buf); -} diff --git a/src/test/ui/foreign/foreign-mod-unused-const.rs b/src/test/ui/foreign/foreign-mod-unused-const.rs deleted file mode 100644 index 7d79c30f4..000000000 --- a/src/test/ui/foreign/foreign-mod-unused-const.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![allow(dead_code)] -// pretty-expanded FIXME #23616 - -mod foo { - extern "C" { - pub static errno: u32; - } -} - -pub fn main() {} diff --git a/src/test/ui/foreign/foreign-pub-super.rs b/src/test/ui/foreign/foreign-pub-super.rs deleted file mode 100644 index 19f9e4e33..000000000 --- a/src/test/ui/foreign/foreign-pub-super.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Test for #79487 -// check-pass - -#![allow(dead_code)] - -mod sha2 { - extern "C" { - pub(super) fn GFp_sha512_block_data_order(); - } -} - -fn main() {} diff --git a/src/test/ui/foreign/foreign-src/compiletest-ignore-dir b/src/test/ui/foreign/foreign-src/compiletest-ignore-dir deleted file mode 100644 index e69de29bb..000000000 --- a/src/test/ui/foreign/foreign-src/compiletest-ignore-dir +++ /dev/null diff --git a/src/test/ui/foreign/foreign-src/foreign.rs b/src/test/ui/foreign/foreign-src/foreign.rs deleted file mode 100644 index 47016ad6c..000000000 --- a/src/test/ui/foreign/foreign-src/foreign.rs +++ /dev/null @@ -1,9 +0,0 @@ -// run-pass - - - -pub fn main() { - libc.puts(rustrt.str_buf("hello, extern world 1")); - libc.puts(rustrt.str_buf("hello, extern world 2")); - libc.puts(rustrt.str_buf("hello, extern world 3")); -} diff --git a/src/test/ui/foreign/foreign-truncated-arguments.rs b/src/test/ui/foreign/foreign-truncated-arguments.rs deleted file mode 100644 index c61c2b587..000000000 --- a/src/test/ui/foreign/foreign-truncated-arguments.rs +++ /dev/null @@ -1,20 +0,0 @@ -// run-pass -// compile-flags: -O -// Regression test for https://github.com/rust-lang/rust/issues/33868 - -#[repr(C)] -pub struct S { - a: u32, - b: f32, - c: u32 -} - -#[no_mangle] -#[inline(never)] -pub extern "C" fn test(s: S) -> u32 { - s.c -} - -fn main() { - assert_eq!(test(S{a: 0, b: 0.0, c: 42}), 42); -} diff --git a/src/test/ui/foreign/foreign2.rs b/src/test/ui/foreign/foreign2.rs deleted file mode 100644 index df431f299..000000000 --- a/src/test/ui/foreign/foreign2.rs +++ /dev/null @@ -1,29 +0,0 @@ -// run-pass -#![allow(dead_code)] -// ignore-wasm32-bare no libc to test ffi with -// pretty-expanded FIXME #23616 -#![feature(rustc_private)] - -extern crate libc; - -mod bar { - extern "C" {} -} - -mod zed { - extern "C" {} -} - -mod mlibc { - use libc::{c_int, c_void, size_t, ssize_t}; - - extern "C" { - pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t; - } -} - -mod baz { - extern "C" {} -} - -pub fn main() {} diff --git a/src/test/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs b/src/test/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs deleted file mode 100644 index a84065e02..000000000 --- a/src/test/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Previously this ICE'd because `fn g()` would be lowered, but the block associated with `fn f()` -// wasn't. - -// compile-flags: --crate-type=lib - -extern "C" { - fn f() { - //~^ incorrect function inside `extern` block - fn g() {} - } -} diff --git a/src/test/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.stderr b/src/test/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.stderr deleted file mode 100644 index d4a9ca3e7..000000000 --- a/src/test/ui/foreign/issue-74120-lowering-of-ffi-block-bodies.stderr +++ /dev/null @@ -1,19 +0,0 @@ -error: incorrect function inside `extern` block - --> $DIR/issue-74120-lowering-of-ffi-block-bodies.rs:7:8 - | -LL | extern "C" { - | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | fn f() { - | ________^___- - | | | - | | cannot have a body -LL | | -LL | | fn g() {} -LL | | } - | |_____- help: remove the invalid body: `;` - | - = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block - = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html - -error: aborting due to previous error - diff --git a/src/test/ui/foreign/issue-91370-foreign-fn-block-impl.rs b/src/test/ui/foreign/issue-91370-foreign-fn-block-impl.rs deleted file mode 100644 index 2ac3ca293..000000000 --- a/src/test/ui/foreign/issue-91370-foreign-fn-block-impl.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Regression test for issue #91370. - -extern { - //~^ `extern` blocks define existing foreign functions - fn f() { - //~^ incorrect function inside `extern` block - //~| cannot have a body - impl Copy for u8 {} - } -} - -fn main() {} diff --git a/src/test/ui/foreign/issue-91370-foreign-fn-block-impl.stderr b/src/test/ui/foreign/issue-91370-foreign-fn-block-impl.stderr deleted file mode 100644 index 4fb2f8c65..000000000 --- a/src/test/ui/foreign/issue-91370-foreign-fn-block-impl.stderr +++ /dev/null @@ -1,21 +0,0 @@ -error: incorrect function inside `extern` block - --> $DIR/issue-91370-foreign-fn-block-impl.rs:5:8 - | -LL | extern { - | ------ `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | -LL | fn f() { - | ________^___- - | | | - | | cannot have a body -LL | | -LL | | -LL | | impl Copy for u8 {} -LL | | } - | |_____- help: remove the invalid body: `;` - | - = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block - = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html - -error: aborting due to previous error - diff --git a/src/test/ui/foreign/issue-99276-same-type-lifetimes.rs b/src/test/ui/foreign/issue-99276-same-type-lifetimes.rs deleted file mode 100644 index fce603c80..000000000 --- a/src/test/ui/foreign/issue-99276-same-type-lifetimes.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Check that we do not ICE when structurally comparing types with lifetimes present. -// check-pass - -pub struct Record<'a> { - pub args: &'a [(usize, &'a str)], -} - -mod a { - extern "Rust" { - fn foo<'a, 'b>(record: &'a super::Record<'b>); - - fn bar<'a, 'b>(record: &'a super::Record<'b>); - } -} - -mod b { - extern "Rust" { - fn foo<'a, 'b>(record: &'a super::Record<'b>); - - fn bar<'a, 'b>(record: &'a super::Record<'b>); - } -} - -fn main() {} diff --git a/src/test/ui/foreign/nil-decl-in-foreign.rs b/src/test/ui/foreign/nil-decl-in-foreign.rs deleted file mode 100644 index f3be94878..000000000 --- a/src/test/ui/foreign/nil-decl-in-foreign.rs +++ /dev/null @@ -1,14 +0,0 @@ -// run-pass - -#![allow(improper_ctypes)] -#![allow(dead_code)] -// Issue #901 -// pretty-expanded FIXME #23616 - -mod libc { - extern "C" { - pub fn printf(x: ()); - } -} - -pub fn main() {} |