Skip to content

Commit d3de333

Browse files
committed
update all UI tests
1 parent cd25fdf commit d3de333

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+211
-241
lines changed

tests/ui/closures/issue-52437.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ fn main() {
22
[(); &(&'static: loop { |x| {}; }) as *const _ as usize]
33
//~^ ERROR: invalid label name `'static`
44
//~| ERROR: type annotations needed
5+
//~| ERROR: mismatched types
56
}

tests/ui/closures/issue-52437.stderr

+11-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ help: consider giving this closure parameter an explicit type
1515
LL | [(); &(&'static: loop { |x: /* Type */| {}; }) as *const _ as usize]
1616
| ++++++++++++
1717

18-
error: aborting due to 2 previous errors
18+
error[E0308]: mismatched types
19+
--> $DIR/issue-52437.rs:2:5
20+
|
21+
LL | fn main() {
22+
| - expected `()` because of default return type
23+
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
24+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `[(); &(&'static: loop { |x| {}; }) as *const _ as usize]`
25+
26+
error: aborting due to 3 previous errors
1927

20-
For more information about this error, try `rustc --explain E0282`.
28+
Some errors have detailed explanations: E0282, E0308.
29+
For more information about an error, try `rustc --explain E0282`.

tests/ui/const-generics/bad-generic-in-copy-impl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[derive(Copy, Clone)]
22
pub struct Foo {
33
x: [u8; SIZE],
4-
//~^ ERROR mismatched types
4+
//~^ ERROR the constant `1` is not of type `usize`
55
}
66

77
const SIZE: u32 = 1;
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
error[E0308]: mismatched types
2-
--> $DIR/bad-generic-in-copy-impl.rs:3:13
1+
error: the constant `1` is not of type `usize`
2+
--> $DIR/bad-generic-in-copy-impl.rs:3:8
33
|
44
LL | x: [u8; SIZE],
5-
| ^^^^ expected `usize`, found `u32`
5+
| ^^^^^^^^^^ expected `usize`, found `u32`
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0308`.

tests/ui/const-generics/bad-subst-const-kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ trait Q {
66
}
77

88
impl<const N: u64> Q for [u8; N] {
9-
//~^ ERROR mismatched types
9+
//~^ ERROR the constant `N` is not of type `usize`
1010
const ASSOC: usize = 1;
1111
}
1212

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
error[E0308]: mismatched types
2-
--> $DIR/bad-subst-const-kind.rs:8:31
1+
error: the constant `N` is not of type `usize`
2+
--> $DIR/bad-subst-const-kind.rs:8:26
33
|
44
LL | impl<const N: u64> Q for [u8; N] {
5-
| ^ expected `usize`, found `u64`
5+
| ^^^^^^^ expected `usize`, found `u64`
66

77
error: aborting due to previous error
88

9-
For more information about this error, try `rustc --explain E0308`.

tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | pub struct SelfDependent<const N: [u8; N]>;
1414
|
1515
= note: const parameters may not be used in the type of const parameters
1616

17-
error: `[u8; N]` is forbidden as the type of a const generic parameter
17+
error: `[u8; [const error]]` is forbidden as the type of a const generic parameter
1818
--> $DIR/const-param-type-depends-on-const-param.rs:11:47
1919
|
2020
LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
@@ -23,7 +23,7 @@ LL | pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
2323
= note: the only supported types are integers, `bool` and `char`
2424
= help: more complex types are supported with `#![feature(adt_const_params)]`
2525

26-
error: `[u8; N]` is forbidden as the type of a const generic parameter
26+
error: `[u8; [const error]]` is forbidden as the type of a const generic parameter
2727
--> $DIR/const-param-type-depends-on-const-param.rs:15:35
2828
|
2929
LL | pub struct SelfDependent<const N: [u8; N]>;

tests/ui/const-generics/const-param-type-depends-on-const-param.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
pub struct Dependent<const N: usize, const X: [u8; N]>([(); N]);
1212
//~^ ERROR: the type of const parameters must not depend on other generic parameters
13-
//[min]~^^ ERROR `[u8; N]` is forbidden
13+
//[min]~^^ ERROR `[u8; [const error]]` is forbidden
1414

1515
pub struct SelfDependent<const N: [u8; N]>;
1616
//~^ ERROR: the type of const parameters must not depend on other generic parameters
17-
//[min]~^^ ERROR `[u8; N]` is forbidden
17+
//[min]~^^ ERROR `[u8; [const error]]` is forbidden
1818

1919
fn main() {}

tests/ui/const-generics/issue-97007.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// check-pass
1+
// known-bug: unknown
2+
// this should pass but currently does not because `generic_const_exprs` is very prone
3+
// to randomly encountering cycle errors on well formed code.
24

35
#![feature(adt_const_params, generic_const_exprs)]
46
#![allow(incomplete_features)]
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
error[E0391]: cycle detected when building an abstract representation for `lib::<impl at $DIR/issue-97007.rs:55:5: 55:81>::proceed_to::{constant#0}`
2+
--> $DIR/issue-97007.rs:58:25
3+
|
4+
LL | ) -> Walk<NEXT, { walk(REMAINING, CURRENT, NEXT) }> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
note: ...which requires building THIR for `lib::<impl at $DIR/issue-97007.rs:55:5: 55:81>::proceed_to::{constant#0}`...
8+
--> $DIR/issue-97007.rs:58:25
9+
|
10+
LL | ) -> Walk<NEXT, { walk(REMAINING, CURRENT, NEXT) }> {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
note: ...which requires type-checking `lib::<impl at $DIR/issue-97007.rs:55:5: 55:81>::proceed_to::{constant#0}`...
13+
--> $DIR/issue-97007.rs:58:25
14+
|
15+
LL | ) -> Walk<NEXT, { walk(REMAINING, CURRENT, NEXT) }> {
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17+
= note: ...which again requires building an abstract representation for `lib::<impl at $DIR/issue-97007.rs:55:5: 55:81>::proceed_to::{constant#0}`, completing the cycle
18+
note: cycle used when checking that `lib::<impl at $DIR/issue-97007.rs:55:5: 55:81>::proceed_to` is well-formed
19+
--> $DIR/issue-97007.rs:56:9
20+
|
21+
LL | / pub fn proceed_to<const NEXT: usize>(
22+
LL | | self,
23+
LL | | ) -> Walk<NEXT, { walk(REMAINING, CURRENT, NEXT) }> {
24+
| |___________________________________________________________^
25+
26+
error: aborting due to previous error
27+
28+
For more information about this error, try `rustc --explain E0391`.

tests/ui/const-generics/issues/issue-62878.min.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn foo<const N: usize, const A: [u8; N]>() {}
66
|
77
= note: const parameters may not be used in the type of const parameters
88

9-
error: `[u8; N]` is forbidden as the type of a const generic parameter
9+
error: `[u8; [const error]]` is forbidden as the type of a const generic parameter
1010
--> $DIR/issue-62878.rs:5:33
1111
|
1212
LL | fn foo<const N: usize, const A: [u8; N]>() {}

tests/ui/const-generics/issues/issue-62878.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
fn foo<const N: usize, const A: [u8; N]>() {}
66
//~^ ERROR the type of const parameters must not
7-
//[min]~| ERROR `[u8; N]` is forbidden as the type of a const generic parameter
7+
//[min]~| ERROR `[u8; [const error]]` is forbidden as the type of a const generic parameter
88

99
fn main() {
1010
foo::<_, { [1] }>();

tests/ui/const-generics/issues/issue-71169.min.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
66
|
77
= note: const parameters may not be used in the type of const parameters
88

9-
error: `[u8; LEN]` is forbidden as the type of a const generic parameter
9+
error: `[u8; [const error]]` is forbidden as the type of a const generic parameter
1010
--> $DIR/issue-71169.rs:5:38
1111
|
1212
LL | fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}

tests/ui/const-generics/issues/issue-71169.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
fn foo<const LEN: usize, const DATA: [u8; LEN]>() {}
66
//~^ ERROR the type of const parameters must not
7-
//[min]~^^ ERROR `[u8; LEN]` is forbidden as the type of a const generic parameter
7+
//[min]~^^ ERROR `[u8; [const error]]` is forbidden as the type of a const generic parameter
88
fn main() {
99
const DATA: [u8; 4] = *b"ABCD";
1010
foo::<4, DATA>();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(transmute_generic_consts)]
2+
#![feature(generic_const_exprs)]
3+
#![allow(incomplete_features)]
4+
5+
fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
6+
//~^ ERROR the constant `W` is not of type `usize`
7+
unsafe {
8+
std::mem::transmute(v)
9+
}
10+
}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: the constant `W` is not of type `usize`
2+
--> $DIR/transmute-fail-2.rs:5:42
3+
|
4+
LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
5+
| ^^^^^^^^^^^^^ expected `usize`, found `bool`
6+
7+
error: aborting due to previous error
8+

tests/ui/const-generics/transmute-fail.rs

-9
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ fn foo<const W: usize, const H: usize>(v: [[u32;H+1]; W]) -> [[u32; W+1]; H] {
99
}
1010
}
1111

12-
fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
13-
//~^ ERROR mismatched types
14-
//~| ERROR mismatched types
15-
unsafe {
16-
std::mem::transmute(v)
17-
//~^ ERROR cannot transmute between types
18-
}
19-
}
20-
2112
fn baz<const W: usize, const H: usize>(v: [[u32; H]; W]) -> [u32; W * H * H] {
2213
unsafe {
2314
std::mem::transmute(v)

tests/ui/const-generics/transmute-fail.stderr

+4-26
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,7 @@ LL | std::mem::transmute(v)
88
= note: target type: `[[u32; W+1]; H]` (generic size [const expr])
99

1010
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
11-
--> $DIR/transmute-fail.rs:16:5
12-
|
13-
LL | std::mem::transmute(v)
14-
| ^^^^^^^^^^^^^^^^^^^
15-
|
16-
= note: source type: `[[u32; H]; W]` (this type does not have a fixed size)
17-
= note: target type: `[[u32; W]; H]` (size can vary because of [u32; W])
18-
19-
error[E0308]: mismatched types
20-
--> $DIR/transmute-fail.rs:12:53
21-
|
22-
LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
23-
| ^ expected `usize`, found `bool`
24-
25-
error[E0308]: mismatched types
26-
--> $DIR/transmute-fail.rs:12:67
27-
|
28-
LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
29-
| ^ expected `usize`, found `bool`
30-
31-
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
32-
--> $DIR/transmute-fail.rs:23:5
11+
--> $DIR/transmute-fail.rs:14:5
3312
|
3413
LL | std::mem::transmute(v)
3514
| ^^^^^^^^^^^^^^^^^^^
@@ -38,15 +17,14 @@ LL | std::mem::transmute(v)
3817
= note: target type: `[u32; W * H * H]` (generic size [const expr])
3918

4019
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
41-
--> $DIR/transmute-fail.rs:30:5
20+
--> $DIR/transmute-fail.rs:21:5
4221
|
4322
LL | std::mem::transmute(v)
4423
| ^^^^^^^^^^^^^^^^^^^
4524
|
4625
= note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[[u32; 8888888]; 9999999]; 777777777]` are too big for the current architecture)
4726
= note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type `[[[u32; 9999999]; 777777777]; 8888888]` are too big for the current architecture)
4827

49-
error: aborting due to 6 previous errors
28+
error: aborting due to 3 previous errors
5029

51-
Some errors have detailed explanations: E0308, E0512.
52-
For more information about an error, try `rustc --explain E0308`.
30+
For more information about this error, try `rustc --explain E0512`.
+2-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
fn foo<const N: usize>() -> [u8; N] {
2-
bar::<N>() //~ ERROR mismatched types
3-
//~^ ERROR the constant `N` is not of type `u8`
2+
bar::<N>()
43
}
54

65
fn bar<const N: u8>() -> [u8; N] {}
7-
//~^ ERROR mismatched types
8-
//~| ERROR mismatched types
6+
//~^ ERROR the constant `N` is not of type `usize`
97

108
fn main() {}
+4-31
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,8 @@
1-
error: the constant `N` is not of type `u8`
2-
--> $DIR/type_mismatch.rs:2:11
3-
|
4-
LL | bar::<N>()
5-
| ^ expected `u8`, found `usize`
6-
|
7-
note: required by a bound in `bar`
8-
--> $DIR/type_mismatch.rs:6:8
9-
|
10-
LL | fn bar<const N: u8>() -> [u8; N] {}
11-
| ^^^^^^^^^^^ required by this bound in `bar`
12-
13-
error[E0308]: mismatched types
14-
--> $DIR/type_mismatch.rs:2:11
15-
|
16-
LL | bar::<N>()
17-
| ^ expected `u8`, found `usize`
18-
19-
error[E0308]: mismatched types
20-
--> $DIR/type_mismatch.rs:6:26
21-
|
22-
LL | fn bar<const N: u8>() -> [u8; N] {}
23-
| --- ^^^^^^^ expected `[u8; N]`, found `()`
24-
| |
25-
| implicitly returns `()` as its body has no tail or `return` expression
26-
27-
error[E0308]: mismatched types
28-
--> $DIR/type_mismatch.rs:6:31
1+
error: the constant `N` is not of type `usize`
2+
--> $DIR/type_mismatch.rs:5:26
293
|
304
LL | fn bar<const N: u8>() -> [u8; N] {}
31-
| ^ expected `usize`, found `u8`
5+
| ^^^^^^^ expected `usize`, found `u8`
326

33-
error: aborting due to 4 previous errors
7+
error: aborting due to previous error
348

35-
For more information about this error, try `rustc --explain E0308`.

tests/ui/consts/const-integer-bool-ops.rs

-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const X: usize = 42 && 39;
66
//~| ERROR mismatched types
77
//~| expected `usize`, found `bool`
88
const ARR: [i32; X] = [99; 34];
9-
//~^ constant
109

1110
const X1: usize = 42 || 39;
1211
//~^ ERROR mismatched types
@@ -16,7 +15,6 @@ const X1: usize = 42 || 39;
1615
//~| ERROR mismatched types
1716
//~| expected `usize`, found `bool`
1817
const ARR1: [i32; X1] = [99; 47];
19-
//~^ constant
2018

2119
const X2: usize = -42 || -39;
2220
//~^ ERROR mismatched types
@@ -26,7 +24,6 @@ const X2: usize = -42 || -39;
2624
//~| ERROR mismatched types
2725
//~| expected `usize`, found `bool`
2826
const ARR2: [i32; X2] = [99; 18446744073709551607];
29-
//~^ constant
3027

3128
const X3: usize = -42 && -39;
3229
//~^ ERROR mismatched types
@@ -36,43 +33,36 @@ const X3: usize = -42 && -39;
3633
//~| ERROR mismatched types
3734
//~| expected `usize`, found `bool`
3835
const ARR3: [i32; X3] = [99; 6];
39-
//~^ constant
4036

4137
const Y: usize = 42.0 == 42.0;
4238
//~^ ERROR mismatched types
4339
//~| expected `usize`, found `bool`
4440
const ARRR: [i32; Y] = [99; 1];
45-
//~^ constant
4641

4742
const Y1: usize = 42.0 >= 42.0;
4843
//~^ ERROR mismatched types
4944
//~| expected `usize`, found `bool`
5045
const ARRR1: [i32; Y1] = [99; 1];
51-
//~^ constant
5246

5347
const Y2: usize = 42.0 <= 42.0;
5448
//~^ ERROR mismatched types
5549
//~| expected `usize`, found `bool`
5650
const ARRR2: [i32; Y2] = [99; 1];
57-
//~^ constant
5851

5952
const Y3: usize = 42.0 > 42.0;
6053
//~^ ERROR mismatched types
6154
//~| expected `usize`, found `bool`
6255
const ARRR3: [i32; Y3] = [99; 0];
63-
//~^ constant
6456

6557
const Y4: usize = 42.0 < 42.0;
6658
//~^ ERROR mismatched types
6759
//~| expected `usize`, found `bool`
6860
const ARRR4: [i32; Y4] = [99; 0];
69-
//~^ constant
7061

7162
const Y5: usize = 42.0 != 42.0;
7263
//~^ ERROR mismatched types
7364
//~| expected `usize`, found `bool`
7465
const ARRR5: [i32; Y5] = [99; 0];
75-
//~^ constant
7666

7767
fn main() {
7868
let _ = ARR;

0 commit comments

Comments
 (0)