Add c_variadic language feature item
This commit is contained in:
parent
58147d486b
commit
210c6071b0
@ -471,6 +471,9 @@ declare_features! (
|
||||
|
||||
// #[repr(align(X))] on enums
|
||||
(active, repr_align_enum, "1.34.0", Some(57996), None),
|
||||
|
||||
// Allows the use of C-variadics
|
||||
(active, c_variadic, "1.34.0", Some(44930), None),
|
||||
);
|
||||
|
||||
declare_features! (
|
||||
@ -1901,6 +1904,11 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
if header.asyncness.is_async() {
|
||||
gate_feature_post!(&self, async_await, span, "async fn is unstable");
|
||||
}
|
||||
|
||||
if fn_decl.c_variadic {
|
||||
gate_feature_post!(&self, c_variadic, span,
|
||||
"C-varaidic functions are unstable");
|
||||
}
|
||||
// Stability of const fn methods are covered in
|
||||
// `visit_trait_item` and `visit_impl_item` below; this is
|
||||
// because default methods don't pass through this point.
|
||||
@ -1929,6 +1937,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||
if block.is_none() {
|
||||
self.check_abi(sig.header.abi, ti.span);
|
||||
}
|
||||
if sig.decl.c_variadic {
|
||||
gate_feature_post!(&self, c_variadic, ti.span,
|
||||
"C-varaidic functions are unstable");
|
||||
}
|
||||
if sig.header.constness.node == ast::Constness::Const {
|
||||
gate_feature_post!(&self, const_fn, ti.span, "const fn is unstable");
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#![crate_type="lib"]
|
||||
#![feature(c_variadic)]
|
||||
|
||||
pub unsafe extern "C" fn use_vararg_lifetime(
|
||||
x: usize,
|
||||
|
4
src/test/ui/feature-gate/feature-gate-c_variadic.rs
Normal file
4
src/test/ui/feature-gate/feature-gate-c_variadic.rs
Normal file
@ -0,0 +1,4 @@
|
||||
#![crate_type="lib"]
|
||||
|
||||
pub unsafe extern "C" fn test(_: i32, ap: ...) { }
|
||||
//~^ C-varaidic functions are unstable
|
11
src/test/ui/feature-gate/feature-gate-c_variadic.stderr
Normal file
11
src/test/ui/feature-gate/feature-gate-c_variadic.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error[E0658]: C-varaidic functions are unstable (see issue #44930)
|
||||
--> $DIR/feature-gate-c_variadic.rs:3:1
|
||||
|
|
||||
LL | pub unsafe extern "C" fn test(_: i32, ap: ...) { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(c_variadic)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
Loading…
Reference in New Issue
Block a user