Auto merge of - matthiaskrgr:rollup-ap5m2l6, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 -  (Ignore `branch-protection-check-IBT` run-make test)
 -  (Try to clarify the confusingly-named `RustDev` and `RustcDev` steps)
 -  (Support absolute source paths in bootstrap)
 -  (Fix issue number for the `tcplistener_into_incoming` feature)
 -  (Allow "C-unwind" fn to have C variadics)

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2024-06-23 08:57:00 +00:00
commit 05468cf124
16 changed files with 136 additions and 60 deletions

View file

@ -28,7 +28,7 @@ ast_passes_auto_super_lifetime = auto traits cannot have super traits or lifetim
.label = {ast_passes_auto_super_lifetime} .label = {ast_passes_auto_super_lifetime}
.suggestion = remove the super traits or lifetime bounds .suggestion = remove the super traits or lifetime bounds
ast_passes_bad_c_variadic = only foreign or `unsafe extern "C"` functions may be C-variadic ast_passes_bad_c_variadic = only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
ast_passes_bare_fn_invalid_safety = function pointers cannot be declared with `safe` safety qualifier ast_passes_bare_fn_invalid_safety = function pointers cannot be declared with `safe` safety qualifier
.suggestion = remove safe from this item .suggestion = remove safe from this item

View file

@ -637,6 +637,7 @@ impl<'a> AstValidator<'a> {
(Some(FnCtxt::Foreign), _) => return, (Some(FnCtxt::Foreign), _) => return,
(Some(FnCtxt::Free), Some(header)) => match header.ext { (Some(FnCtxt::Free), Some(header)) => match header.ext {
Extern::Explicit(StrLit { symbol_unescaped: sym::C, .. }, _) Extern::Explicit(StrLit { symbol_unescaped: sym::C, .. }, _)
| Extern::Explicit(StrLit { symbol_unescaped: sym::C_dash_unwind, .. }, _)
| Extern::Implicit(_) | Extern::Implicit(_)
if matches!(header.safety, Safety::Unsafe(_)) => if matches!(header.safety, Safety::Unsafe(_)) =>
{ {

View file

@ -167,6 +167,7 @@ symbols! {
Break, Break,
C, C,
CStr, CStr,
C_dash_unwind: "C-unwind",
CallOnceFuture, CallOnceFuture,
CallRefFuture, CallRefFuture,
Capture, Capture,

View file

@ -27,7 +27,7 @@ use crate::io::{self, ErrorKind};
pub use self::ip_addr::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; pub use self::ip_addr::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope};
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use self::socket_addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs}; pub use self::socket_addr::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};
#[unstable(feature = "tcplistener_into_incoming", issue = "88339")] #[unstable(feature = "tcplistener_into_incoming", issue = "88373")]
pub use self::tcp::IntoIncoming; pub use self::tcp::IntoIncoming;
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub use self::tcp::{Incoming, TcpListener, TcpStream}; pub use self::tcp::{Incoming, TcpListener, TcpStream};

View file

@ -105,7 +105,7 @@ pub struct Incoming<'a> {
/// ///
/// [`accept`]: TcpListener::accept /// [`accept`]: TcpListener::accept
#[derive(Debug)] #[derive(Debug)]
#[unstable(feature = "tcplistener_into_incoming", issue = "88339")] #[unstable(feature = "tcplistener_into_incoming", issue = "88373")]
pub struct IntoIncoming { pub struct IntoIncoming {
listener: TcpListener, listener: TcpListener,
} }
@ -894,7 +894,7 @@ impl TcpListener {
/// } /// }
/// ``` /// ```
#[must_use = "`self` will be dropped if the result is not used"] #[must_use = "`self` will be dropped if the result is not used"]
#[unstable(feature = "tcplistener_into_incoming", issue = "88339")] #[unstable(feature = "tcplistener_into_incoming", issue = "88373")]
pub fn into_incoming(self) -> IntoIncoming { pub fn into_incoming(self) -> IntoIncoming {
IntoIncoming { listener: self } IntoIncoming { listener: self }
} }
@ -1033,7 +1033,7 @@ impl<'a> Iterator for Incoming<'a> {
#[stable(feature = "tcp_listener_incoming_fused_iterator", since = "1.64.0")] #[stable(feature = "tcp_listener_incoming_fused_iterator", since = "1.64.0")]
impl FusedIterator for Incoming<'_> {} impl FusedIterator for Incoming<'_> {}
#[unstable(feature = "tcplistener_into_incoming", issue = "88339")] #[unstable(feature = "tcplistener_into_incoming", issue = "88373")]
impl Iterator for IntoIncoming { impl Iterator for IntoIncoming {
type Item = io::Result<TcpStream>; type Item = io::Result<TcpStream>;
fn next(&mut self) -> Option<io::Result<TcpStream>> { fn next(&mut self) -> Option<io::Result<TcpStream>> {
@ -1041,7 +1041,7 @@ impl Iterator for IntoIncoming {
} }
} }
#[unstable(feature = "tcplistener_into_incoming", issue = "88339")] #[unstable(feature = "tcplistener_into_incoming", issue = "88373")]
impl FusedIterator for IntoIncoming {} impl FusedIterator for IntoIncoming {}
impl AsInner<net_imp::TcpListener> for TcpListener { impl AsInner<net_imp::TcpListener> for TcpListener {

View file

@ -665,6 +665,10 @@ impl Step for Std {
} }
} }
/// Tarball containing the compiler that gets downloaded and used by
/// `rust.download-rustc`.
///
/// (Don't confuse this with [`RustDev`], without the `c`!)
#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)] #[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
pub struct RustcDev { pub struct RustcDev {
pub compiler: Compiler, pub compiler: Compiler,
@ -2225,6 +2229,11 @@ impl Step for LlvmBitcodeLinker {
/// Tarball intended for internal consumption to ease rustc/std development. /// Tarball intended for internal consumption to ease rustc/std development.
/// ///
/// Should not be considered stable by end users. /// Should not be considered stable by end users.
///
/// In practice, this is the tarball that gets downloaded and used by
/// `llvm.download-ci-llvm`.
///
/// (Don't confuse this with [`RustcDev`], with a `c`!)
#[derive(Clone, Debug, Eq, Hash, PartialEq)] #[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub struct RustDev { pub struct RustDev {
pub target: TargetSelection, pub target: TargetSelection,

View file

@ -274,7 +274,7 @@ impl PathSet {
/// This is used for `StepDescription::krate`, which passes all matching crates at once to /// This is used for `StepDescription::krate`, which passes all matching crates at once to
/// `Step::make_run`, rather than calling it many times with a single crate. /// `Step::make_run`, rather than calling it many times with a single crate.
/// See `tests.rs` for examples. /// See `tests.rs` for examples.
fn intersection_removing_matches(&self, needles: &mut Vec<&Path>, module: Kind) -> PathSet { fn intersection_removing_matches(&self, needles: &mut Vec<PathBuf>, module: Kind) -> PathSet {
let mut check = |p| { let mut check = |p| {
for (i, n) in needles.iter().enumerate() { for (i, n) in needles.iter().enumerate() {
let matched = Self::check(p, n, module); let matched = Self::check(p, n, module);
@ -346,7 +346,7 @@ const PATH_REMAP: &[(&str, &[&str])] = &[
), ),
]; ];
fn remap_paths(paths: &mut Vec<&Path>) { fn remap_paths(paths: &mut Vec<PathBuf>) {
let mut remove = vec![]; let mut remove = vec![];
let mut add = vec![]; let mut add = vec![];
for (i, path) in paths.iter().enumerate().filter_map(|(i, path)| path.to_str().map(|s| (i, s))) for (i, path) in paths.iter().enumerate().filter_map(|(i, path)| path.to_str().map(|s| (i, s)))
@ -355,7 +355,7 @@ fn remap_paths(paths: &mut Vec<&Path>) {
// Remove leading and trailing slashes so `tests/` and `tests` are equivalent // Remove leading and trailing slashes so `tests/` and `tests` are equivalent
if path.trim_matches(std::path::is_separator) == search { if path.trim_matches(std::path::is_separator) == search {
remove.push(i); remove.push(i);
add.extend(replace.iter().map(Path::new)); add.extend(replace.iter().map(PathBuf::from));
break; break;
} }
} }
@ -438,8 +438,25 @@ impl StepDescription {
} }
} }
// strip CurDir prefix if present // Attempt to resolve paths to be relative to the builder source directory.
let mut paths: Vec<_> = paths.iter().map(|p| p.strip_prefix(".").unwrap_or(p)).collect(); let mut paths: Vec<PathBuf> = paths
.iter()
.map(|p| {
// If the path does not exist, it may represent the name of a Step, such as `tidy` in `x test tidy`
if !p.exists() {
return p.clone();
}
// Make the path absolute, strip the prefix, and convert to a PathBuf.
match std::path::absolute(p) {
Ok(p) => p.strip_prefix(&builder.src).unwrap_or(&p).to_path_buf(),
Err(e) => {
eprintln!("ERROR: {:?}", e);
panic!("Due to the above error, failed to resolve path: {:?}", p);
}
}
})
.collect();
remap_paths(&mut paths); remap_paths(&mut paths);
@ -629,7 +646,7 @@ impl<'a> ShouldRun<'a> {
/// (for now, just `all_krates` and `paths`, but we may want to add an `aliases` function in the future?) /// (for now, just `all_krates` and `paths`, but we may want to add an `aliases` function in the future?)
fn pathset_for_paths_removing_matches( fn pathset_for_paths_removing_matches(
&self, &self,
paths: &mut Vec<&Path>, paths: &mut Vec<PathBuf>,
kind: Kind, kind: Kind,
) -> Vec<PathSet> { ) -> Vec<PathSet> {
let mut sets = vec![]; let mut sets = vec![];

View file

@ -122,11 +122,14 @@ fn test_intersection() {
PathSet::Set(paths.into_iter().map(|p| TaskPath { path: p.into(), kind: None }).collect()) PathSet::Set(paths.into_iter().map(|p| TaskPath { path: p.into(), kind: None }).collect())
}; };
let library_set = set(&["library/core", "library/alloc", "library/std"]); let library_set = set(&["library/core", "library/alloc", "library/std"]);
let mut command_paths = let mut command_paths = vec![
vec![Path::new("library/core"), Path::new("library/alloc"), Path::new("library/stdarch")]; PathBuf::from("library/core"),
PathBuf::from("library/alloc"),
PathBuf::from("library/stdarch"),
];
let subset = library_set.intersection_removing_matches(&mut command_paths, Kind::Build); let subset = library_set.intersection_removing_matches(&mut command_paths, Kind::Build);
assert_eq!(subset, set(&["library/core", "library/alloc"]),); assert_eq!(subset, set(&["library/core", "library/alloc"]),);
assert_eq!(command_paths, vec![Path::new("library/stdarch")]); assert_eq!(command_paths, vec![PathBuf::from("library/stdarch")]);
} }
#[test] #[test]

View file

@ -7,6 +7,12 @@ include ../tools.mk
# only-x86_64 # only-x86_64
# ignore-test
# FIXME(jieyouxu): This test never runs because the `ifeq` check on line 17
# compares `x86` to `x86_64`, which always evaluates to false.
# When the test does run, the compilation does not include `.note.gnu.property`.
# See https://github.com/rust-lang/rust/pull/126720 for more information.
all: all:
ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86_64) ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86_64)
$(RUSTC) --target x86_64-unknown-linux-gnu -Z cf-protection=branch -L$(TMPDIR) -C link-args='-nostartfiles' -C save-temps ./main.rs -o $(TMPDIR)/rsmain $(RUSTC) --target x86_64-unknown-linux-gnu -Z cf-protection=branch -L$(TMPDIR) -C link-args='-nostartfiles' -C save-temps ./main.rs -o $(TMPDIR)/rsmain

View file

@ -0,0 +1,31 @@
// Check for GNU Property Note
// How to run this
// python3 x.py test --target x86_64-unknown-linux-gnu tests/run-make/branch-protection-check-IBT/
//@ only-x86_64
//@ ignore-test
// FIXME(jieyouxu): see the FIXME in the Makefile
use run_make_support::llvm_readobj;
use run_make_support::rustc;
use run_make_support::{cwd, env_var};
fn main() {
let llvm_components = env_var("LLVM_COMPONENTS");
if !format!(" {llvm_components} ").contains(" x86 ") {
return;
}
rustc()
.input("main.rs")
.target("x86_64-unknown-linux-gnu")
.arg("-Zcf-protection=branch")
.arg(format!("-L{}", cwd().display()))
.arg("-Clink-args=-nostartfiles")
.arg("-Csave-temps")
.run();
llvm_readobj().arg("-nW").input("main").run().assert_stdout_contains(".note.gnu.property");
}

View file

@ -14,6 +14,10 @@ pub unsafe extern "C" fn test_valist_forward(n: u64, mut ap: ...) -> f64 {
rust_valist_interesting_average(n, ap.as_va_list()) rust_valist_interesting_average(n, ap.as_va_list())
} }
pub unsafe extern "C-unwind" fn c_unwind_can_forward(n: u64, mut ap: ...) -> f64 {
rust_valist_interesting_average(n, ap.as_va_list())
}
pub unsafe extern "C" fn test_va_copy(_: u64, mut ap: ...) { pub unsafe extern "C" fn test_va_copy(_: u64, mut ap: ...) {
let mut ap2 = ap.clone(); let mut ap2 = ap.clone();
assert_eq!(rust_valist_interesting_average(2, ap2.as_va_list()) as i64, 30); assert_eq!(rust_valist_interesting_average(2, ap2.as_va_list()) as i64, 30);
@ -72,6 +76,10 @@ pub fn main() {
assert_eq!(test_valist_forward(2, 10i64, 10f64, 20i64, 20f64) as i64, 30); assert_eq!(test_valist_forward(2, 10i64, 10f64, 20i64, 20f64) as i64, 30);
} }
unsafe {
assert_eq!(c_unwind_can_forward(2, 10i64, 10f64, 20i64, 20f64) as i64, 30);
}
unsafe { unsafe {
test_va_copy(4, 10i64, 10f64, 20i64, 20f64, 30i64, 30f64, 40i64, 40f64); test_va_copy(4, 10i64, 10f64, 20i64, 20f64, 30i64, 30f64, 40i64, 40f64);
} }

View file

@ -46,7 +46,7 @@ error: `...` must be the last argument of a C-variadic function
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/issue-86053-1.rs:11:12 --> $DIR/issue-86053-1.rs:11:12
| |
LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) {

View file

@ -5,6 +5,6 @@
fn main() {} fn main() {}
fn foo(_: Bar, ...) -> impl {} fn foo(_: Bar, ...) -> impl {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR cannot find type `Bar` in this scope //~| ERROR cannot find type `Bar` in this scope
//~| ERROR at least one trait must be specified //~| ERROR at least one trait must be specified

View file

@ -1,4 +1,4 @@
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/issue-83499-input-output-iteration-ice.rs:7:16 --> $DIR/issue-83499-input-output-iteration-ice.rs:7:16
| |
LL | fn foo(_: Bar, ...) -> impl {} LL | fn foo(_: Bar, ...) -> impl {}

View file

@ -4,29 +4,29 @@
fn main() {} fn main() {}
fn f1_1(x: isize, ...) {} fn f1_1(x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
fn f1_2(...) {} fn f1_2(...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
extern "C" fn f2_1(x: isize, ...) {} extern "C" fn f2_1(x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
extern "C" fn f2_2(...) {} extern "C" fn f2_2(...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
extern "C" fn f2_3(..., x: isize) {} extern "C" fn f2_3(..., x: isize) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR `...` must be the last argument of a C-variadic function //~| ERROR `...` must be the last argument of a C-variadic function
extern "C" fn f3_1(x: isize, ...) {} extern "C" fn f3_1(x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
extern "C" fn f3_2(...) {} extern "C" fn f3_2(...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
extern "C" fn f3_3(..., x: isize) {} extern "C" fn f3_3(..., x: isize) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR `...` must be the last argument of a C-variadic function //~| ERROR `...` must be the last argument of a C-variadic function
const unsafe extern "C" fn f4_1(x: isize, ...) {} const unsafe extern "C" fn f4_1(x: isize, ...) {}
@ -35,12 +35,12 @@ const unsafe extern "C" fn f4_1(x: isize, ...) {}
const extern "C" fn f4_2(x: isize, ...) {} const extern "C" fn f4_2(x: isize, ...) {}
//~^ ERROR functions cannot be both `const` and C-variadic //~^ ERROR functions cannot be both `const` and C-variadic
//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR destructor of `VaListImpl<'_>` cannot be evaluated at compile-time //~| ERROR destructor of `VaListImpl<'_>` cannot be evaluated at compile-time
const extern "C" fn f4_3(..., x: isize, ...) {} const extern "C" fn f4_3(..., x: isize, ...) {}
//~^ ERROR functions cannot be both `const` and C-variadic //~^ ERROR functions cannot be both `const` and C-variadic
//~| ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~| ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR `...` must be the last argument of a C-variadic function //~| ERROR `...` must be the last argument of a C-variadic function
extern "C" { extern "C" {
@ -52,34 +52,34 @@ struct X;
impl X { impl X {
fn i_f1(x: isize, ...) {} fn i_f1(x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
fn i_f2(...) {} fn i_f2(...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
fn i_f3(..., x: isize, ...) {} fn i_f3(..., x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR `...` must be the last argument of a C-variadic function //~| ERROR `...` must be the last argument of a C-variadic function
fn i_f4(..., x: isize, ...) {} fn i_f4(..., x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR `...` must be the last argument of a C-variadic function //~| ERROR `...` must be the last argument of a C-variadic function
const fn i_f5(x: isize, ...) {} const fn i_f5(x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR functions cannot be both `const` and C-variadic //~| ERROR functions cannot be both `const` and C-variadic
//~| ERROR destructor of `VaListImpl<'_>` cannot be evaluated at compile-time //~| ERROR destructor of `VaListImpl<'_>` cannot be evaluated at compile-time
} }
trait T { trait T {
fn t_f1(x: isize, ...) {} fn t_f1(x: isize, ...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
fn t_f2(x: isize, ...); fn t_f2(x: isize, ...);
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
fn t_f3(...) {} fn t_f3(...) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
fn t_f4(...); fn t_f4(...);
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
fn t_f5(..., x: isize) {} fn t_f5(..., x: isize) {}
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR `...` must be the last argument of a C-variadic function //~| ERROR `...` must be the last argument of a C-variadic function
fn t_f6(..., x: isize); fn t_f6(..., x: isize);
//~^ ERROR only foreign or `unsafe extern "C"` functions may be C-variadic //~^ ERROR only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
//~| ERROR `...` must be the last argument of a C-variadic function //~| ERROR `...` must be the last argument of a C-variadic function
} }

View file

@ -1,22 +1,22 @@
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:6:19 --> $DIR/variadic-ffi-semantic-restrictions.rs:6:19
| |
LL | fn f1_1(x: isize, ...) {} LL | fn f1_1(x: isize, ...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:9:9 --> $DIR/variadic-ffi-semantic-restrictions.rs:9:9
| |
LL | fn f1_2(...) {} LL | fn f1_2(...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:12:30 --> $DIR/variadic-ffi-semantic-restrictions.rs:12:30
| |
LL | extern "C" fn f2_1(x: isize, ...) {} LL | extern "C" fn f2_1(x: isize, ...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:15:20 --> $DIR/variadic-ffi-semantic-restrictions.rs:15:20
| |
LL | extern "C" fn f2_2(...) {} LL | extern "C" fn f2_2(...) {}
@ -28,19 +28,19 @@ error: `...` must be the last argument of a C-variadic function
LL | extern "C" fn f2_3(..., x: isize) {} LL | extern "C" fn f2_3(..., x: isize) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:18:20 --> $DIR/variadic-ffi-semantic-restrictions.rs:18:20
| |
LL | extern "C" fn f2_3(..., x: isize) {} LL | extern "C" fn f2_3(..., x: isize) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:22:30 --> $DIR/variadic-ffi-semantic-restrictions.rs:22:30
| |
LL | extern "C" fn f3_1(x: isize, ...) {} LL | extern "C" fn f3_1(x: isize, ...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:25:20 --> $DIR/variadic-ffi-semantic-restrictions.rs:25:20
| |
LL | extern "C" fn f3_2(...) {} LL | extern "C" fn f3_2(...) {}
@ -52,7 +52,7 @@ error: `...` must be the last argument of a C-variadic function
LL | extern "C" fn f3_3(..., x: isize) {} LL | extern "C" fn f3_3(..., x: isize) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:28:20 --> $DIR/variadic-ffi-semantic-restrictions.rs:28:20
| |
LL | extern "C" fn f3_3(..., x: isize) {} LL | extern "C" fn f3_3(..., x: isize) {}
@ -70,7 +70,7 @@ error: functions cannot be both `const` and C-variadic
LL | const extern "C" fn f4_2(x: isize, ...) {} LL | const extern "C" fn f4_2(x: isize, ...) {}
| ^^^^^ `const` because of this ^^^ C-variadic because of this | ^^^^^ `const` because of this ^^^ C-variadic because of this
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:36:36 --> $DIR/variadic-ffi-semantic-restrictions.rs:36:36
| |
LL | const extern "C" fn f4_2(x: isize, ...) {} LL | const extern "C" fn f4_2(x: isize, ...) {}
@ -91,7 +91,7 @@ LL | const extern "C" fn f4_3(..., x: isize, ...) {}
| | C-variadic because of this | | C-variadic because of this
| `const` because of this | `const` because of this
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:41:26 --> $DIR/variadic-ffi-semantic-restrictions.rs:41:26
| |
LL | const extern "C" fn f4_3(..., x: isize, ...) {} LL | const extern "C" fn f4_3(..., x: isize, ...) {}
@ -103,13 +103,13 @@ error: `...` must be the last argument of a C-variadic function
LL | fn e_f2(..., x: isize); LL | fn e_f2(..., x: isize);
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:54:23 --> $DIR/variadic-ffi-semantic-restrictions.rs:54:23
| |
LL | fn i_f1(x: isize, ...) {} LL | fn i_f1(x: isize, ...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:56:13 --> $DIR/variadic-ffi-semantic-restrictions.rs:56:13
| |
LL | fn i_f2(...) {} LL | fn i_f2(...) {}
@ -121,7 +121,7 @@ error: `...` must be the last argument of a C-variadic function
LL | fn i_f3(..., x: isize, ...) {} LL | fn i_f3(..., x: isize, ...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:58:13 --> $DIR/variadic-ffi-semantic-restrictions.rs:58:13
| |
LL | fn i_f3(..., x: isize, ...) {} LL | fn i_f3(..., x: isize, ...) {}
@ -133,7 +133,7 @@ error: `...` must be the last argument of a C-variadic function
LL | fn i_f4(..., x: isize, ...) {} LL | fn i_f4(..., x: isize, ...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:61:13 --> $DIR/variadic-ffi-semantic-restrictions.rs:61:13
| |
LL | fn i_f4(..., x: isize, ...) {} LL | fn i_f4(..., x: isize, ...) {}
@ -147,31 +147,31 @@ LL | const fn i_f5(x: isize, ...) {}
| | | |
| `const` because of this | `const` because of this
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:64:29 --> $DIR/variadic-ffi-semantic-restrictions.rs:64:29
| |
LL | const fn i_f5(x: isize, ...) {} LL | const fn i_f5(x: isize, ...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:71:23 --> $DIR/variadic-ffi-semantic-restrictions.rs:71:23
| |
LL | fn t_f1(x: isize, ...) {} LL | fn t_f1(x: isize, ...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:73:23 --> $DIR/variadic-ffi-semantic-restrictions.rs:73:23
| |
LL | fn t_f2(x: isize, ...); LL | fn t_f2(x: isize, ...);
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:75:13 --> $DIR/variadic-ffi-semantic-restrictions.rs:75:13
| |
LL | fn t_f3(...) {} LL | fn t_f3(...) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:77:13 --> $DIR/variadic-ffi-semantic-restrictions.rs:77:13
| |
LL | fn t_f4(...); LL | fn t_f4(...);
@ -183,7 +183,7 @@ error: `...` must be the last argument of a C-variadic function
LL | fn t_f5(..., x: isize) {} LL | fn t_f5(..., x: isize) {}
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:79:13 --> $DIR/variadic-ffi-semantic-restrictions.rs:79:13
| |
LL | fn t_f5(..., x: isize) {} LL | fn t_f5(..., x: isize) {}
@ -195,7 +195,7 @@ error: `...` must be the last argument of a C-variadic function
LL | fn t_f6(..., x: isize); LL | fn t_f6(..., x: isize);
| ^^^ | ^^^
error: only foreign or `unsafe extern "C"` functions may be C-variadic error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg
--> $DIR/variadic-ffi-semantic-restrictions.rs:82:13 --> $DIR/variadic-ffi-semantic-restrictions.rs:82:13
| |
LL | fn t_f6(..., x: isize); LL | fn t_f6(..., x: isize);