feature-gate c-variadic definitions and calls in const contexts
This commit is contained in:
parent
f5bf3353e6
commit
981dacc34f
11 changed files with 88 additions and 5 deletions
|
|
@ -1,7 +1,7 @@
|
|||
//@ build-fail
|
||||
|
||||
#![feature(c_variadic)]
|
||||
#![feature(c_variadic_const)]
|
||||
#![feature(const_c_variadic)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(const_destruct)]
|
||||
#![feature(const_clone)]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
//@ ignore-backends: gcc
|
||||
|
||||
#![feature(c_variadic)]
|
||||
#![feature(const_c_variadic)]
|
||||
#![feature(const_destruct)]
|
||||
#![feature(c_variadic_const)]
|
||||
#![feature(const_cmp)]
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
|
|
|
|||
11
tests/ui/feature-gates/feature-gate-const-c-variadic.rs
Normal file
11
tests/ui/feature-gates/feature-gate-const-c-variadic.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#![feature(c_variadic)]
|
||||
|
||||
fn main() {
|
||||
const unsafe extern "C" fn foo(ap: ...) {
|
||||
//~^ ERROR c-variadic const function definitions are unstable
|
||||
core::mem::forget(ap);
|
||||
}
|
||||
|
||||
const { unsafe { foo() } }
|
||||
//~^ ERROR calling const c-variadic functions is unstable in constants
|
||||
}
|
||||
24
tests/ui/feature-gates/feature-gate-const-c-variadic.stderr
Normal file
24
tests/ui/feature-gates/feature-gate-const-c-variadic.stderr
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
error[E0658]: c-variadic const function definitions are unstable
|
||||
--> $DIR/feature-gate-const-c-variadic.rs:4:5
|
||||
|
|
||||
LL | const unsafe extern "C" fn foo(ap: ...) {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #151787 <https://github.com/rust-lang/rust/issues/151787> for more information
|
||||
= help: add `#![feature(const_c_variadic)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0015]: calling const c-variadic functions is unstable in constants
|
||||
--> $DIR/feature-gate-const-c-variadic.rs:9:22
|
||||
|
|
||||
LL | const { unsafe { foo() } }
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #151787 <https://github.com/rust-lang/rust/issues/151787> for more information
|
||||
= help: add `#![feature(const_c_variadic)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0015, E0658.
|
||||
For more information about an error, try `rustc --explain E0015`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue