diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:03 +0000 |
commit | 64d98f8ee037282c35007b64c2649055c56af1db (patch) | |
tree | 5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/test/ui/c-variadic | |
parent | Adding debian version 1.67.1+dfsg1-1. (diff) | |
download | rustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/c-variadic')
19 files changed, 0 insertions, 639 deletions
diff --git a/src/test/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs b/src/test/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs deleted file mode 100644 index 087743e50..000000000 --- a/src/test/ui/c-variadic/feature-gate-extended_varargs_abi_support.rs +++ /dev/null @@ -1,19 +0,0 @@ -#![feature(abi_efiapi)] - -fn efiapi(f: extern "efiapi" fn(usize, ...)) { - //~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl` - //~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable - f(22, 44); -} -fn sysv(f: extern "sysv64" fn(usize, ...)) { - //~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl` - //~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable - f(22, 44); -} -fn win(f: extern "win64" fn(usize, ...)) { - //~^ ERROR: C-variadic function must have a compatible calling convention, like `C` or `cdecl` - //~^^ ERROR: using calling conventions other than `C` or `cdecl` for varargs functions is unstable - f(22, 44); -} - -fn main() {} diff --git a/src/test/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr b/src/test/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr deleted file mode 100644 index 007d7d795..000000000 --- a/src/test/ui/c-variadic/feature-gate-extended_varargs_abi_support.stderr +++ /dev/null @@ -1,49 +0,0 @@ -error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable - --> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14 - | -LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information - = help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable - -error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl` - --> $DIR/feature-gate-extended_varargs_abi_support.rs:3:14 - | -LL | fn efiapi(f: extern "efiapi" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention - -error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable - --> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12 - | -LL | fn sysv(f: extern "sysv64" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information - = help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable - -error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl` - --> $DIR/feature-gate-extended_varargs_abi_support.rs:8:12 - | -LL | fn sysv(f: extern "sysv64" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention - -error[E0658]: using calling conventions other than `C` or `cdecl` for varargs functions is unstable - --> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11 - | -LL | fn win(f: extern "win64" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #100189 <https://github.com/rust-lang/rust/issues/100189> for more information - = help: add `#![feature(extended_varargs_abi_support)]` to the crate attributes to enable - -error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl` - --> $DIR/feature-gate-extended_varargs_abi_support.rs:13:11 - | -LL | fn win(f: extern "win64" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention - -error: aborting due to 6 previous errors - -Some errors have detailed explanations: E0045, E0658. -For more information about an error, try `rustc --explain E0045`. diff --git a/src/test/ui/c-variadic/issue-32201.rs b/src/test/ui/c-variadic/issue-32201.rs deleted file mode 100644 index f27bb1c2e..000000000 --- a/src/test/ui/c-variadic/issue-32201.rs +++ /dev/null @@ -1,13 +0,0 @@ -extern "C" { - fn foo(a: i32, ...); -} - -fn bar(_: *const u8) {} - -fn main() { - unsafe { - foo(0, bar); - //~^ ERROR can't pass `fn(*const u8) {bar}` to variadic function - //~| HELP cast the value to `fn(*const u8)` - } -} diff --git a/src/test/ui/c-variadic/issue-32201.stderr b/src/test/ui/c-variadic/issue-32201.stderr deleted file mode 100644 index cedb58784..000000000 --- a/src/test/ui/c-variadic/issue-32201.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0617]: can't pass `fn(*const u8) {bar}` to variadic function - --> $DIR/issue-32201.rs:9:16 - | -LL | foo(0, bar); - | ^^^ help: cast the value to `fn(*const u8)`: `bar as fn(*const u8)` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0617`. diff --git a/src/test/ui/c-variadic/issue-86053-1.rs b/src/test/ui/c-variadic/issue-86053-1.rs deleted file mode 100644 index b30548e19..000000000 --- a/src/test/ui/c-variadic/issue-86053-1.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Regression test for the ICE described in issue #86053. -// error-pattern:unexpected `self` parameter in function -// error-pattern:`...` must be the last argument of a C-variadic function -// error-pattern:cannot find type `F` in this scope -// error-pattern:in type `&'a &'b usize`, reference has a longer lifetime than the data it references - -#![feature(c_variadic)] -#![crate_type="lib"] - -fn ordering4 < 'a , 'b > ( a : , self , self , self , - self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { -} diff --git a/src/test/ui/c-variadic/issue-86053-1.stderr b/src/test/ui/c-variadic/issue-86053-1.stderr deleted file mode 100644 index 075bd1fc4..000000000 --- a/src/test/ui/c-variadic/issue-86053-1.stderr +++ /dev/null @@ -1,101 +0,0 @@ -error: expected type, found `,` - --> $DIR/issue-86053-1.rs:10:47 - | -LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , - | ^ expected type - -error: unexpected `self` parameter in function - --> $DIR/issue-86053-1.rs:10:51 - | -LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , - | ^^^^ must be the first parameter of an associated function - -error: unexpected `self` parameter in function - --> $DIR/issue-86053-1.rs:10:58 - | -LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , - | ^^^^ must be the first parameter of an associated function - -error: unexpected `self` parameter in function - --> $DIR/issue-86053-1.rs:10:67 - | -LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , - | ^^^^ must be the first parameter of an associated function - -error: unexpected `self` parameter in function - --> $DIR/issue-86053-1.rs:11:5 - | -LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^^ must be the first parameter of an associated function - -error: unexpected `self` parameter in function - --> $DIR/issue-86053-1.rs:11:20 - | -LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^^ must be the first parameter of an associated function - -error: unexpected `self` parameter in function - --> $DIR/issue-86053-1.rs:11:29 - | -LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^^ must be the first parameter of an associated function - -error: `...` must be the last argument of a C-variadic function - --> $DIR/issue-86053-1.rs:11:12 - | -LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^ - -error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/issue-86053-1.rs:11:12 - | -LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^ - -error: only foreign or `unsafe extern "C"` functions may be C-variadic - --> $DIR/issue-86053-1.rs:11:36 - | -LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^ - -error[E0412]: cannot find type `F` in this scope - --> $DIR/issue-86053-1.rs:11:48 - | -LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^ - | - ::: $SRC_DIR/core/src/ops/function.rs:LL:COL - | -LL | pub trait Fn<Args: Tuple>: FnMut<Args> { - | -------------------------------------- similarly named trait `Fn` defined here - | -help: a trait with a similar name exists - | -LL | self , ... , self , self , ... ) where Fn : FnOnce ( & 'a & 'b usize ) { - | ~~ -help: you might be missing a type parameter - | -LL | fn ordering4 < 'a , 'b, F > ( a : , self , self , self , - | +++ - -error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references - --> $DIR/issue-86053-1.rs:11:52 - | -LL | self , ... , self , self , ... ) where F : FnOnce ( & 'a & 'b usize ) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: the pointer is valid for the lifetime `'a` as defined here - --> $DIR/issue-86053-1.rs:10:16 - | -LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , - | ^^ -note: but the referenced data is only valid for the lifetime `'b` as defined here - --> $DIR/issue-86053-1.rs:10:21 - | -LL | fn ordering4 < 'a , 'b > ( a : , self , self , self , - | ^^ - -error: aborting due to 12 previous errors - -Some errors have detailed explanations: E0412, E0491. -For more information about an error, try `rustc --explain E0412`. diff --git a/src/test/ui/c-variadic/issue-86053-2.rs b/src/test/ui/c-variadic/issue-86053-2.rs deleted file mode 100644 index c545831f7..000000000 --- a/src/test/ui/c-variadic/issue-86053-2.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Regression test for the ICE caused by the example in -// https://github.com/rust-lang/rust/issues/86053#issuecomment-855672258 - -#![feature(c_variadic)] - -trait H<T> {} - -unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), ...) {} -//~^ ERROR: in type `&'static &'a ()`, reference has a longer lifetime than the data it references [E0491] - -fn main() {} diff --git a/src/test/ui/c-variadic/issue-86053-2.stderr b/src/test/ui/c-variadic/issue-86053-2.stderr deleted file mode 100644 index 815b06e77..000000000 --- a/src/test/ui/c-variadic/issue-86053-2.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references - --> $DIR/issue-86053-2.rs:8:39 - | -LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), ...) {} - | ^^^^^^^^^^^^^^^^^^ - | - = note: the pointer is valid for the static lifetime -note: but the referenced data is only valid for the lifetime `'a` as defined here - --> $DIR/issue-86053-2.rs:8:32 - | -LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), ...) {} - | ^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0491`. diff --git a/src/test/ui/c-variadic/variadic-ffi-1.rs b/src/test/ui/c-variadic/variadic-ffi-1.rs deleted file mode 100644 index 24407a71c..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-1.rs +++ /dev/null @@ -1,35 +0,0 @@ -// needs-llvm-components: x86 -// compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib -#![no_core] -#![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } - -extern "stdcall" { - fn printf(_: *const u8, ...); - //~^ ERROR: C-variadic function must have a compatible calling convention, - // like C, cdecl, win64, sysv64 or efiapi -} - -extern "C" { - fn foo(f: isize, x: u8, ...); -} - -extern "C" fn bar(f: isize, x: u8) {} - -fn main() { - unsafe { - foo(); //~ ERROR this function takes at least 2 arguments but 0 arguments were supplied - foo(1); //~ ERROR this function takes at least 2 arguments but 1 argument was supplied - - let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~ ERROR mismatched types - let y: extern "C" fn(f: isize, x: u8, ...) = bar; //~ ERROR mismatched types - - foo(1, 2, 3f32); //~ ERROR can't pass - foo(1, 2, true); //~ ERROR can't pass - foo(1, 2, 1i8); //~ ERROR can't pass - foo(1, 2, 1u8); //~ ERROR can't pass - foo(1, 2, 1i16); //~ ERROR can't pass - foo(1, 2, 1u16); //~ ERROR can't pass - } -} diff --git a/src/test/ui/c-variadic/variadic-ffi-1.stderr b/src/test/ui/c-variadic/variadic-ffi-1.stderr deleted file mode 100644 index 4beea83d8..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-1.stderr +++ /dev/null @@ -1,100 +0,0 @@ -error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl` - --> $DIR/variadic-ffi-1.rs:9:5 - | -LL | fn printf(_: *const u8, ...); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention - -error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied - --> $DIR/variadic-ffi-1.rs:22:9 - | -LL | foo(); - | ^^^-- two arguments of type `isize` and `u8` are missing - | -note: function defined here - --> $DIR/variadic-ffi-1.rs:15:8 - | -LL | fn foo(f: isize, x: u8, ...); - | ^^^ -help: provide the arguments - | -LL | foo(/* isize */, /* u8 */); - | ~~~~~~~~~~~~~~~~~~~~~~~ - -error[E0060]: this function takes at least 2 arguments but 1 argument was supplied - --> $DIR/variadic-ffi-1.rs:23:9 - | -LL | foo(1); - | ^^^--- an argument of type `u8` is missing - | -note: function defined here - --> $DIR/variadic-ffi-1.rs:15:8 - | -LL | fn foo(f: isize, x: u8, ...); - | ^^^ -help: provide the argument - | -LL | foo(1, /* u8 */); - | ~~~~~~~~~~~~~ - -error[E0308]: mismatched types - --> $DIR/variadic-ffi-1.rs:25:56 - | -LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; - | ------------------------------------- ^^^ expected non-variadic fn, found variadic function - | | - | expected due to this - | - = note: expected fn pointer `unsafe extern "C" fn(_, _)` - found fn item `unsafe extern "C" fn(_, _, ...) {foo}` - -error[E0308]: mismatched types - --> $DIR/variadic-ffi-1.rs:26:54 - | -LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; - | ----------------------------------- ^^^ expected variadic fn, found non-variadic function - | | - | expected due to this - | - = note: expected fn pointer `extern "C" fn(_, _, ...)` - found fn item `extern "C" fn(_, _) {bar}` - -error[E0617]: can't pass `f32` to variadic function - --> $DIR/variadic-ffi-1.rs:28:19 - | -LL | foo(1, 2, 3f32); - | ^^^^ help: cast the value to `c_double`: `3f32 as c_double` - -error[E0617]: can't pass `bool` to variadic function - --> $DIR/variadic-ffi-1.rs:29:19 - | -LL | foo(1, 2, true); - | ^^^^ help: cast the value to `c_int`: `true as c_int` - -error[E0617]: can't pass `i8` to variadic function - --> $DIR/variadic-ffi-1.rs:30:19 - | -LL | foo(1, 2, 1i8); - | ^^^ help: cast the value to `c_int`: `1i8 as c_int` - -error[E0617]: can't pass `u8` to variadic function - --> $DIR/variadic-ffi-1.rs:31:19 - | -LL | foo(1, 2, 1u8); - | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint` - -error[E0617]: can't pass `i16` to variadic function - --> $DIR/variadic-ffi-1.rs:32:19 - | -LL | foo(1, 2, 1i16); - | ^^^^ help: cast the value to `c_int`: `1i16 as c_int` - -error[E0617]: can't pass `u16` to variadic function - --> $DIR/variadic-ffi-1.rs:33:19 - | -LL | foo(1, 2, 1u16); - | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint` - -error: aborting due to 11 previous errors - -Some errors have detailed explanations: E0045, E0060, E0308, E0617. -For more information about an error, try `rustc --explain E0045`. diff --git a/src/test/ui/c-variadic/variadic-ffi-2.rs b/src/test/ui/c-variadic/variadic-ffi-2.rs deleted file mode 100644 index 96cea8754..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// ignore-arm stdcall isn't supported -#![feature(extended_varargs_abi_support)] -#![feature(abi_efiapi)] - -fn baz(f: extern "stdcall" fn(usize, ...)) { - //~^ ERROR: C-variadic function must have a compatible calling convention, - // like C, cdecl, win64, sysv64 or efiapi - f(22, 44); -} - -fn sysv(f: extern "sysv64" fn(usize, ...)) { - f(22, 44); -} -fn win(f: extern "win64" fn(usize, ...)) { - f(22, 44); -} -fn efiapi(f: extern "efiapi" fn(usize, ...)) { - f(22, 44); -} - -fn main() {} diff --git a/src/test/ui/c-variadic/variadic-ffi-2.stderr b/src/test/ui/c-variadic/variadic-ffi-2.stderr deleted file mode 100644 index 4e74c9d92..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-2.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `win64`, `sysv64` or `efiapi` - --> $DIR/variadic-ffi-2.rs:5:11 - | -LL | fn baz(f: extern "stdcall" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0045`. diff --git a/src/test/ui/c-variadic/variadic-ffi-4.rs b/src/test/ui/c-variadic/variadic-ffi-4.rs deleted file mode 100644 index 806403794..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-4.rs +++ /dev/null @@ -1,38 +0,0 @@ -#![crate_type = "lib"] -#![no_std] -#![feature(c_variadic)] - -use core::ffi::{VaList, VaListImpl}; - -pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaListImpl<'f> { - ap - //~^ ERROR: lifetime may not live long enough - //~| ERROR: lifetime may not live long enough -} - -pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaListImpl<'static> { - ap //~ ERROR: lifetime may not live long enough -} - -pub unsafe extern "C" fn no_escape2(_: usize, ap: ...) { - let _ = ap.with_copy(|ap| ap); //~ ERROR: lifetime may not live long enough -} - -pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - *ap0 = ap1; - //~^ ERROR: lifetime may not live long enough - //~| ERROR: lifetime may not live long enough -} - -pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - ap0 = &mut ap1; - //~^ ERROR: `ap1` does not live long enough - //~| ERROR: lifetime may not live long enough - //~| ERROR: lifetime may not live long enough -} - -pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - *ap0 = ap1.clone(); - //~^ ERROR: lifetime may not live long enough - //~| ERROR: lifetime may not live long enough -} diff --git a/src/test/ui/c-variadic/variadic-ffi-4.stderr b/src/test/ui/c-variadic/variadic-ffi-4.stderr deleted file mode 100644 index 6f8e53298..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-4.stderr +++ /dev/null @@ -1,150 +0,0 @@ -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:8:5 - | -LL | pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaListImpl<'f> { - | -- -- has type `VaListImpl<'1>` - | | - | lifetime `'f` defined here -LL | ap - | ^^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'f` - | - = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant - = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f` - = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:8:5 - | -LL | pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaListImpl<'f> { - | -- -- has type `VaListImpl<'1>` - | | - | lifetime `'f` defined here -LL | ap - | ^^ function was supposed to return data with lifetime `'f` but it is returning data with lifetime `'1` - | - = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant - = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f` - = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:14:5 - | -LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaListImpl<'static> { - | -- has type `VaListImpl<'1>` -LL | ap - | ^^ returning this value requires that `'1` must outlive `'static` - | - = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant - = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f` - = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:18:31 - | -LL | let _ = ap.with_copy(|ap| ap); - | --- ^^ returning this value requires that `'1` must outlive `'2` - | | | - | | return type of closure is VaList<'2, '_> - | has type `VaList<'1, '_>` - -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:22:5 - | -LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - | ------- ------- has type `VaListImpl<'2>` - | | - | has type `&mut VaListImpl<'1>` -LL | *ap0 = ap1; - | ^^^^ assignment requires that `'1` must outlive `'2` - | - = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant - = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f` - = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:22:5 - | -LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - | ------- ------- has type `VaListImpl<'2>` - | | - | has type `&mut VaListImpl<'1>` -LL | *ap0 = ap1; - | ^^^^ assignment requires that `'2` must outlive `'1` - | - = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant - = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f` - = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:28:5 - | -LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - | ------- ------- has type `VaListImpl<'2>` - | | - | has type `&mut VaListImpl<'1>` -LL | ap0 = &mut ap1; - | ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2` - | - = note: requirement occurs because of a mutable reference to `VaListImpl<'_>` - = note: mutable references are invariant over their type parameter - = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:28:5 - | -LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - | ------- ------- has type `VaListImpl<'2>` - | | - | has type `&mut VaListImpl<'1>` -LL | ap0 = &mut ap1; - | ^^^^^^^^^^^^^^ assignment requires that `'2` must outlive `'1` - | - = note: requirement occurs because of a mutable reference to `VaListImpl<'_>` - = note: mutable references are invariant over their type parameter - = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - -error[E0597]: `ap1` does not live long enough - --> $DIR/variadic-ffi-4.rs:28:11 - | -LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - | - let's call the lifetime of this reference `'3` -LL | ap0 = &mut ap1; - | ------^^^^^^^^ - | | | - | | borrowed value does not live long enough - | assignment requires that `ap1` is borrowed for `'3` -... -LL | } - | - `ap1` dropped here while still borrowed - -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:35:12 - | -LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - | ------- ------- has type `VaListImpl<'2>` - | | - | has type `&mut VaListImpl<'1>` -LL | *ap0 = ap1.clone(); - | ^^^^^^^^^^^ argument requires that `'1` must outlive `'2` - | - = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant - = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f` - = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - -error: lifetime may not live long enough - --> $DIR/variadic-ffi-4.rs:35:12 - | -LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaListImpl, mut ap1: ...) { - | ------- ------- has type `VaListImpl<'2>` - | | - | has type `&mut VaListImpl<'1>` -LL | *ap0 = ap1.clone(); - | ^^^^^^^^^^^ argument requires that `'2` must outlive `'1` - | - = note: requirement occurs because of the type `VaListImpl<'_>`, which makes the generic argument `'_` invariant - = note: the struct `VaListImpl<'f>` is invariant over the parameter `'f` - = help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance - -error: aborting due to 11 previous errors - -For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/c-variadic/variadic-ffi-6.rs b/src/test/ui/c-variadic/variadic-ffi-6.rs deleted file mode 100644 index 4dd8a2d45..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-6.rs +++ /dev/null @@ -1,13 +0,0 @@ -#![crate_type="lib"] -#![feature(c_variadic)] - -pub unsafe extern "C" fn use_vararg_lifetime( - x: usize, - y: ... -) -> &usize { //~ ERROR missing lifetime specifier - &0 -} - -pub unsafe extern "C" fn use_normal_arg_lifetime(x: &usize, y: ...) -> &usize { // OK - x -} diff --git a/src/test/ui/c-variadic/variadic-ffi-6.stderr b/src/test/ui/c-variadic/variadic-ffi-6.stderr deleted file mode 100644 index 4c7792d96..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-6.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/variadic-ffi-6.rs:7:6 - | -LL | ) -> &usize { - | ^ expected named lifetime parameter - | - = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from -help: consider using the `'static` lifetime - | -LL | ) -> &'static usize { - | +++++++ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.rs b/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.rs deleted file mode 100644 index 588c15a18..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern "C" { - fn foo(...); -//~^ ERROR C-variadic function must be declared with at least one named argument -} - -fn main() {} diff --git a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr b/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr deleted file mode 100644 index e11ba43ca..000000000 --- a/src/test/ui/c-variadic/variadic-ffi-no-fixed-args.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: C-variadic function must be declared with at least one named argument - --> $DIR/variadic-ffi-no-fixed-args.rs:2:12 - | -LL | fn foo(...); - | ^^^ - -error: aborting due to previous error - diff --git a/src/test/ui/c-variadic/variadic-unreachable-arg-error.rs b/src/test/ui/c-variadic/variadic-unreachable-arg-error.rs deleted file mode 100644 index f60f6f3e8..000000000 --- a/src/test/ui/c-variadic/variadic-unreachable-arg-error.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass - -#![feature(c_variadic)] - -extern "C" { - fn foo(f: isize, x: u8, ...); -} - -fn main() { - unsafe { - // FIXME: Ideally we could give an unreachable warning - foo(1, loop {}, 1usize); - } -} |