summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts/const-extern-fn
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts/const-extern-fn')
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs23
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.stderr19
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs11
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr21
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr19
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs14
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr11
-rw-r--r--src/test/ui/consts/const-extern-fn/const-extern-fn.rs35
-rw-r--r--src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.rs13
-rw-r--r--src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.stderr21
-rw-r--r--src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs7
-rw-r--r--src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.stderr8
-rw-r--r--src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.rs7
-rw-r--r--src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.stderr8
14 files changed, 0 insertions, 217 deletions
diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs b/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs
deleted file mode 100644
index eccda49db..000000000
--- a/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-#![feature(const_extern_fn)]
-
-extern "C" {
- fn regular_in_block();
-}
-
-const extern "C" fn bar() {
- unsafe {
- regular_in_block();
- //~^ ERROR: cannot call non-const fn
- }
-}
-
-extern "C" fn regular() {}
-
-const extern "C" fn foo() {
- unsafe {
- regular();
- //~^ ERROR: cannot call non-const fn
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.stderr
deleted file mode 100644
index 5acf22e4b..000000000
--- a/src/test/ui/consts/const-extern-fn/const-extern-fn-call-extern-fn.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0015]: cannot call non-const fn `regular_in_block` in constant functions
- --> $DIR/const-extern-fn-call-extern-fn.rs:9:9
- |
-LL | regular_in_block();
- | ^^^^^^^^^^^^^^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-
-error[E0015]: cannot call non-const fn `regular` in constant functions
- --> $DIR/const-extern-fn-call-extern-fn.rs:18:9
- |
-LL | regular();
- | ^^^^^^^^^
- |
- = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0015`.
diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs b/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs
deleted file mode 100644
index c7078e46f..000000000
--- a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-#![feature(const_extern_fn)]
-
-const extern "C" fn unsize(x: &[u8; 3]) -> &[u8] { x }
-const unsafe extern "C" fn closure() -> fn() { || {} }
-const unsafe extern "C" fn use_float() { 1.0 + 1.0; }
-//~^ ERROR floating point arithmetic
-const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
-//~^ ERROR pointers cannot be cast to integers
-
-
-fn main() {}
diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr
deleted file mode 100644
index 4bab466fb..000000000
--- a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0658]: floating point arithmetic is not allowed in constant functions
- --> $DIR/const-extern-fn-min-const-fn.rs:5:42
- |
-LL | const unsafe extern "C" fn use_float() { 1.0 + 1.0; }
- | ^^^^^^^^^
- |
- = note: see issue #57241 <https://github.com/rust-lang/rust/issues/57241> for more information
- = help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable
-
-error: pointers cannot be cast to integers during const eval
- --> $DIR/const-extern-fn-min-const-fn.rs:7:48
- |
-LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
- | ^^^^^^^^^^^^
- |
- = note: at compile-time, pointers do not have an integer value
- = note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr
deleted file mode 100644
index 34ec8aadb..000000000
--- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.mir.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/const-extern-fn-requires-unsafe.rs:12:5
- |
-LL | foo();
- | ^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
- --> $DIR/const-extern-fn-requires-unsafe.rs:9:17
- |
-LL | let a: [u8; foo()];
- | ^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
deleted file mode 100644
index afe645ae8..000000000
--- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// revisions: mir thir
-// [thir]compile-flags: -Z thir-unsafeck
-
-#![feature(const_extern_fn)]
-
-const unsafe extern "C" fn foo() -> usize { 5 }
-
-fn main() {
- let a: [u8; foo()];
- //[mir]~^ call to unsafe function is unsafe and requires unsafe function or block
- //[thir]~^^ call to unsafe function `foo` is unsafe and requires unsafe function or block
- foo();
- //[mir]~^ ERROR call to unsafe function is unsafe and requires unsafe function or block
-}
diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr
deleted file mode 100644
index b313f0653..000000000
--- a/src/test/ui/consts/const-extern-fn/const-extern-fn-requires-unsafe.thir.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block
- --> $DIR/const-extern-fn-requires-unsafe.rs:9:17
- |
-LL | let a: [u8; foo()];
- | ^^^^^ call to unsafe function
- |
- = note: consult the function's documentation for information on how to avoid undefined behavior
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn.rs b/src/test/ui/consts/const-extern-fn/const-extern-fn.rs
deleted file mode 100644
index 2ce2eafd5..000000000
--- a/src/test/ui/consts/const-extern-fn/const-extern-fn.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// run-pass
-#![feature(const_extern_fn)]
-
-const extern "C" fn foo1(val: u8) -> u8 {
- val + 1
-}
-
-const extern "C" fn foo2(val: u8) -> u8 {
- val + 1
-}
-
-const unsafe extern "C" fn bar1(val: bool) -> bool {
- !val
-}
-
-const unsafe extern "C" fn bar2(val: bool) -> bool {
- !val
-}
-
-
-fn main() {
- let a: [u8; foo1(25) as usize] = [0; 26];
- let b: [u8; foo2(25) as usize] = [0; 26];
- assert_eq!(a, b);
-
- let bar1_res = unsafe { bar1(false) };
- let bar2_res = unsafe { bar2(false) };
- assert!(bar1_res);
- assert_eq!(bar1_res, bar2_res);
-
- let _foo1_cast: extern "C" fn(u8) -> u8 = foo1;
- let _foo2_cast: extern "C" fn(u8) -> u8 = foo2;
- let _bar1_cast: unsafe extern "C" fn(bool) -> bool = bar1;
- let _bar2_cast: unsafe extern "C" fn(bool) -> bool = bar2;
-}
diff --git a/src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.rs b/src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.rs
deleted file mode 100644
index f7bed91b0..000000000
--- a/src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// Check that `const extern fn` and `const unsafe extern fn` are feature-gated
-// for certain ABIs.
-
-const extern fn foo1() {}
-const extern "C" fn foo2() {}
-const extern "Rust" fn foo3() {}
-const extern "cdecl" fn foo4() {} //~ ERROR `cdecl` as a `const fn` ABI is unstable
-const unsafe extern fn bar1() {}
-const unsafe extern "C" fn bar2() {}
-const unsafe extern "Rust" fn bar3() {}
-const unsafe extern "cdecl" fn bar4() {} //~ ERROR `cdecl` as a `const fn` ABI is unstable
-
-fn main() {}
diff --git a/src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.stderr b/src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.stderr
deleted file mode 100644
index f8c3107bd..000000000
--- a/src/test/ui/consts/const-extern-fn/feature-gate-const_extern_fn.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0658]: `cdecl` as a `const fn` ABI is unstable
- --> $DIR/feature-gate-const_extern_fn.rs:7:14
- |
-LL | const extern "cdecl" fn foo4() {}
- | ^^^^^^^
- |
- = note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
- = help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
-
-error[E0658]: `cdecl` as a `const fn` ABI is unstable
- --> $DIR/feature-gate-const_extern_fn.rs:11:21
- |
-LL | const unsafe extern "cdecl" fn bar4() {}
- | ^^^^^^^
- |
- = note: see issue #64926 <https://github.com/rust-lang/rust/issues/64926> for more information
- = help: add `#![feature(const_extern_fn)]` to the crate attributes to enable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs b/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs
deleted file mode 100644
index 7ced24808..000000000
--- a/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() {}
-
-#[cfg(FALSE)]
-fn container() {
- const unsafe WhereIsFerris Now() {}
- //~^ ERROR expected one of `extern` or `fn`
-}
diff --git a/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.stderr b/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.stderr
deleted file mode 100644
index 5ec9e2a91..000000000
--- a/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier-2.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected one of `extern` or `fn`, found `WhereIsFerris`
- --> $DIR/issue-68062-const-extern-fns-dont-need-fn-specifier-2.rs:5:18
- |
-LL | const unsafe WhereIsFerris Now() {}
- | ^^^^^^^^^^^^^ expected one of `extern` or `fn`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.rs b/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.rs
deleted file mode 100644
index 6f575d055..000000000
--- a/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-fn main() {}
-
-#[cfg(FALSE)]
-fn container() {
- const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 }
- //~^ ERROR expected `fn`
-}
diff --git a/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.stderr b/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.stderr
deleted file mode 100644
index ec415ec9d..000000000
--- a/src/test/ui/consts/const-extern-fn/issue-68062-const-extern-fns-dont-need-fn-specifier.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected `fn`, found `PUT_ANYTHING_YOU_WANT_HERE`
- --> $DIR/issue-68062-const-extern-fns-dont-need-fn-specifier.rs:5:25
- |
-LL | const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `fn`
-
-error: aborting due to previous error
-