Skip to content

Commit f019006

Browse files
committed
update more ui tests
1 parent 2b1b752 commit f019006

21 files changed

Lines changed: 95 additions & 104 deletions

src/tools/miri/tests/pass/c-variadic-ignored-argument.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//@ ignore-target: powerpc # does not ignore ZST arguments
33
//@ ignore-target: s390x # does not ignore ZST arguments
44
//@ ignore-target: sparc # does not ignore ZST arguments
5-
#![feature(c_variadic)]
65

76
// Some platforms ignore ZSTs, meaning that the argument is not passed, even though it is part
87
// of the callee's ABI. Test that this doesn't trip any asserts.

tests/ui/c-variadic/issue-86053-1.stderr

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,61 @@
11
error: expected type, found `,`
2-
--> $DIR/issue-86053-1.rs:6:47
2+
--> $DIR/issue-86053-1.rs:5:47
33
|
44
LL | fn ordering4 < 'a , 'b > ( a : , self , self , self ,
55
| ^ expected type
66

77
error: unexpected `self` parameter in function
8-
--> $DIR/issue-86053-1.rs:6:51
8+
--> $DIR/issue-86053-1.rs:5:51
99
|
1010
LL | fn ordering4 < 'a , 'b > ( a : , self , self , self ,
1111
| ^^^^ must be the first parameter of an associated function
1212

1313
error: unexpected `self` parameter in function
14-
--> $DIR/issue-86053-1.rs:6:58
14+
--> $DIR/issue-86053-1.rs:5:58
1515
|
1616
LL | fn ordering4 < 'a , 'b > ( a : , self , self , self ,
1717
| ^^^^ must be the first parameter of an associated function
1818

1919
error: unexpected `self` parameter in function
20-
--> $DIR/issue-86053-1.rs:6:67
20+
--> $DIR/issue-86053-1.rs:5:67
2121
|
2222
LL | fn ordering4 < 'a , 'b > ( a : , self , self , self ,
2323
| ^^^^ must be the first parameter of an associated function
2424

2525
error: unexpected `self` parameter in function
26-
--> $DIR/issue-86053-1.rs:11:5
26+
--> $DIR/issue-86053-1.rs:10:5
2727
|
2828
LL | self , _: ... , self , self , _: ... ) where F : FnOnce ( & 'a & 'b usize ) {
2929
| ^^^^ must be the first parameter of an associated function
3030

3131
error: unexpected `self` parameter in function
32-
--> $DIR/issue-86053-1.rs:11:23
32+
--> $DIR/issue-86053-1.rs:10:23
3333
|
3434
LL | self , _: ... , self , self , _: ... ) where F : FnOnce ( & 'a & 'b usize ) {
3535
| ^^^^ must be the first parameter of an associated function
3636

3737
error: unexpected `self` parameter in function
38-
--> $DIR/issue-86053-1.rs:11:32
38+
--> $DIR/issue-86053-1.rs:10:32
3939
|
4040
LL | self , _: ... , self , self , _: ... ) where F : FnOnce ( & 'a & 'b usize ) {
4141
| ^^^^ must be the first parameter of an associated function
4242

4343
error: `...` must be the last argument of a C-variadic function
44-
--> $DIR/issue-86053-1.rs:11:12
44+
--> $DIR/issue-86053-1.rs:10:12
4545
|
4646
LL | self , _: ... , self , self , _: ... ) where F : FnOnce ( & 'a & 'b usize ) {
4747
| ^^^^^^
4848

4949
error: `...` is not supported for non-extern functions
50-
--> $DIR/issue-86053-1.rs:11:39
50+
--> $DIR/issue-86053-1.rs:10:39
5151
|
5252
LL | self , _: ... , self , self , _: ... ) where F : FnOnce ( & 'a & 'b usize ) {
5353
| ^^^^^^
5454
|
5555
= help: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
5656

5757
error[E0425]: cannot find type `F` in this scope
58-
--> $DIR/issue-86053-1.rs:11:54
58+
--> $DIR/issue-86053-1.rs:10:54
5959
|
6060
LL | self , _: ... , self , self , _: ... ) where F : FnOnce ( & 'a & 'b usize ) {
6161
| ^

tests/ui/c-variadic/issue-86053-2.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error[E0491]: in type `&'static &'a ()`, reference has a longer lifetime than the data it references
2-
--> $DIR/issue-86053-2.rs:8:39
2+
--> $DIR/issue-86053-2.rs:6:39
33
|
44
LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), _: ...) {}
55
| ^^^^^^^^^^^^^^^^^^
66
|
77
= note: the pointer is valid for the static lifetime
88
note: but the referenced data is only valid for the lifetime `'a` as defined here
9-
--> $DIR/issue-86053-2.rs:8:32
9+
--> $DIR/issue-86053-2.rs:6:32
1010
|
1111
LL | unsafe extern "C" fn ordering4<'a, F: H<&'static &'a ()>>(_: (), _: ...) {}
1212
| ^^

tests/ui/c-variadic/no-closure.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
error: unexpected `...`
2-
--> $DIR/no-closure.rs:6:35
2+
--> $DIR/no-closure.rs:5:35
33
|
44
LL | const F: extern "C" fn(...) = |_: ...| {};
55
| ^^^
66
|
77
= note: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
88

99
error: unexpected `...`
10-
--> $DIR/no-closure.rs:11:14
10+
--> $DIR/no-closure.rs:10:14
1111
|
1212
LL | let f = |...| {};
1313
| ^^^ not a valid pattern
1414
|
1515
= note: only `extern "C"` and `extern "C-unwind"` functions may have a C variable argument list
1616

1717
error: unexpected `...`
18-
--> $DIR/no-closure.rs:16:17
18+
--> $DIR/no-closure.rs:15:17
1919
|
2020
LL | let f = |_: ...| {};
2121
| ^^^

tests/ui/c-variadic/not-async.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: functions cannot be both `async` and C-variadic
2-
--> $DIR/not-async.rs:5:1
2+
--> $DIR/not-async.rs:4:1
33
|
44
LL | async unsafe extern "C" fn fn_cannot_be_async(x: isize, _: ...) {}
55
| ^^^^^ `async` because of this ^^^^^^ C-variadic because of this
66

77
error: functions cannot be both `async` and C-variadic
8-
--> $DIR/not-async.rs:12:5
8+
--> $DIR/not-async.rs:11:5
99
|
1010
LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {}
1111
| ^^^^^ `async` because of this ^^^^^^ C-variadic because of this
1212

1313
error[E0700]: hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds
14-
--> $DIR/not-async.rs:5:65
14+
--> $DIR/not-async.rs:4:65
1515
|
1616
LL | async unsafe extern "C" fn fn_cannot_be_async(x: isize, _: ...) {}
1717
| -^^
@@ -21,7 +21,7 @@ LL | async unsafe extern "C" fn fn_cannot_be_async(x: isize, _: ...) {}
2121
= note: hidden type `{async fn body of fn_cannot_be_async()}` captures lifetime `'_`
2222

2323
error[E0700]: hidden type for `impl Future<Output = ()>` captures lifetime that does not appear in bounds
24-
--> $DIR/not-async.rs:12:73
24+
--> $DIR/not-async.rs:11:73
2525
|
2626
LL | async unsafe extern "C" fn method_cannot_be_async(x: isize, _: ...) {}
2727
| -^^

tests/ui/c-variadic/not-dyn-compatible.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error[E0038]: the trait `Trait` is not dyn compatible
2-
--> $DIR/not-dyn-compatible.rs:27:30
2+
--> $DIR/not-dyn-compatible.rs:26:30
33
|
44
LL | let dyn_object: &dyn Trait = &Struct(64);
55
| ^^^^^ `Trait` is not dyn compatible
66
|
77
note: for a trait to be dyn compatible it needs to allow building a vtable
88
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
9-
--> $DIR/not-dyn-compatible.rs:14:26
9+
--> $DIR/not-dyn-compatible.rs:13:26
1010
|
1111
LL | trait Trait {
1212
| ----- this trait is not dyn compatible...

tests/ui/c-variadic/variadic-ffi-4.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: lifetime may not live long enough
2-
--> $DIR/variadic-ffi-4.rs:8:5
2+
--> $DIR/variadic-ffi-4.rs:7:5
33
|
44
LL | pub unsafe extern "C" fn no_escape0<'f>(_: usize, ap: ...) -> VaList<'f> {
55
| -- -- has type `VaList<'1>`
@@ -9,15 +9,15 @@ LL | ap
99
| ^^ function was supposed to return data with lifetime `'f` but it is returning data with lifetime `'1`
1010

1111
error: lifetime may not live long enough
12-
--> $DIR/variadic-ffi-4.rs:13:5
12+
--> $DIR/variadic-ffi-4.rs:12:5
1313
|
1414
LL | pub unsafe extern "C" fn no_escape1(_: usize, ap: ...) -> VaList<'static> {
1515
| -- has type `VaList<'1>`
1616
LL | ap
1717
| ^^ returning this value requires that `'1` must outlive `'static`
1818

1919
error: lifetime may not live long enough
20-
--> $DIR/variadic-ffi-4.rs:17:5
20+
--> $DIR/variadic-ffi-4.rs:16:5
2121
|
2222
LL | pub unsafe extern "C" fn no_escape3(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
2323
| ------- ------- has type `VaList<'1>`
@@ -27,7 +27,7 @@ LL | *ap0 = ap1;
2727
| ^^^^ assignment requires that `'1` must outlive `'2`
2828

2929
error: lifetime may not live long enough
30-
--> $DIR/variadic-ffi-4.rs:22:5
30+
--> $DIR/variadic-ffi-4.rs:21:5
3131
|
3232
LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
3333
| ------- ------- has type `VaList<'1>`
@@ -41,7 +41,7 @@ LL | ap0 = &mut ap1;
4141
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
4242

4343
error: lifetime may not live long enough
44-
--> $DIR/variadic-ffi-4.rs:22:5
44+
--> $DIR/variadic-ffi-4.rs:21:5
4545
|
4646
LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
4747
| ------- ------- has type `VaList<'1>`
@@ -55,7 +55,7 @@ LL | ap0 = &mut ap1;
5555
= help: see <https://doc.rust-lang.org/nomicon/subtyping.html> for more information about variance
5656

5757
error[E0597]: `ap1` does not live long enough
58-
--> $DIR/variadic-ffi-4.rs:22:11
58+
--> $DIR/variadic-ffi-4.rs:21:11
5959
|
6060
LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
6161
| - ------- binding `ap1` declared here
@@ -71,7 +71,7 @@ LL | }
7171
| - `ap1` dropped here while still borrowed
7272

7373
error: lifetime may not live long enough
74-
--> $DIR/variadic-ffi-4.rs:29:5
74+
--> $DIR/variadic-ffi-4.rs:28:5
7575
|
7676
LL | pub unsafe extern "C" fn no_escape5(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
7777
| ------- ------- has type `VaList<'1>`

tests/ui/c-variadic/variadic-ffi-6.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![crate_type = "lib"]
22

33
pub unsafe extern "C" fn use_vararg_lifetime(x: usize, y: ...) -> &usize {
4-
//~ ERROR missing lifetime specifier
4+
//~^ ERROR missing lifetime specifier
55
&0
66
}
77

tests/ui/c-variadic/variadic-ffi-6.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
error[E0106]: missing lifetime specifier
2-
--> $DIR/variadic-ffi-6.rs:7:6
2+
--> $DIR/variadic-ffi-6.rs:3:67
33
|
4-
LL | ) -> &usize {
5-
| ^ expected named lifetime parameter
4+
LL | pub unsafe extern "C" fn use_vararg_lifetime(x: usize, y: ...) -> &usize {
5+
| ^ expected named lifetime parameter
66
|
77
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
88
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
99
|
10-
LL | ) -> &'static usize {
11-
| +++++++
10+
LL | pub unsafe extern "C" fn use_vararg_lifetime(x: usize, y: ...) -> &'static usize {
11+
| +++++++
1212
help: instead, you are more likely to want to change one of the arguments to be borrowed...
1313
|
14-
LL | x: &usize,
15-
| +
14+
LL | pub unsafe extern "C" fn use_vararg_lifetime(x: &usize, y: ...) -> &usize {
15+
| +
1616
help: ...or alternatively, you might want to return an owned value
1717
|
18-
LL - ) -> &usize {
19-
LL + ) -> usize {
18+
LL - pub unsafe extern "C" fn use_vararg_lifetime(x: usize, y: ...) -> &usize {
19+
LL + pub unsafe extern "C" fn use_vararg_lifetime(x: usize, y: ...) -> usize {
2020
|
2121

2222
error: aborting due to 1 previous error

tests/ui/cmse-nonsecure/cmse-nonsecure-entry/c-variadic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib
44
//@ needs-llvm-components: arm
55
//@ ignore-backends: gcc
6-
#![feature(cmse_nonsecure_entry, c_variadic, no_core, lang_items)]
6+
#![feature(cmse_nonsecure_entry, no_core, lang_items)]
77
#![no_core]
88

99
extern crate minicore;

0 commit comments

Comments
 (0)