mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 10:05:06 +03:00
Create new error E0743
This commit is contained in:
@@ -487,7 +487,6 @@ pub(in crate::foo) struct Bar {
|
||||
// `test_2018_feature` is
|
||||
// included in the Rust 2018 edition
|
||||
```
|
||||
|
||||
"##,
|
||||
|
||||
E0725: r##"
|
||||
@@ -505,6 +504,20 @@ pub(in crate::foo) struct Bar {
|
||||
features in the `-Z allow_features` flag.
|
||||
"##,
|
||||
|
||||
E0743: r##"
|
||||
C-variadic has been used on a non-foreign function.
|
||||
|
||||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0743
|
||||
fn foo2(x: u8, ...) {} // error!
|
||||
```
|
||||
|
||||
Only foreign functions can use C-variadic (`...`). It is used to give an
|
||||
undefined number of parameters to a given function (like `printf` in C). The
|
||||
equivalent in Rust would be to use macros directly.
|
||||
"##,
|
||||
|
||||
;
|
||||
|
||||
E0539, // incorrect meta item
|
||||
|
||||
@@ -197,8 +197,11 @@ pub(super) fn parse_ty_common(&mut self, allow_plus: bool, allow_qpath_recovery:
|
||||
self.eat(&token::DotDotDot);
|
||||
TyKind::CVarArgs
|
||||
} else {
|
||||
return Err(self.fatal(
|
||||
"only foreign functions are allowed to be C-variadic"
|
||||
return Err(struct_span_fatal!(
|
||||
self.sess.span_diagnostic,
|
||||
self.token.span,
|
||||
E0743,
|
||||
"only foreign functions are allowed to be C-variadic",
|
||||
));
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user