Skip to content

Commit f04e444

Browse files
Normalize away and fold in a test
The issue-112505-overflow test just extended a case of transmute-fail.rs so simply put them in the same file.
1 parent 65f132f commit f04e444

File tree

4 files changed

+36
-36
lines changed

4 files changed

+36
-36
lines changed

tests/ui/const-generics/issue-112505-overflow.rs

-7
This file was deleted.

tests/ui/const-generics/issue-112505-overflow.stderr

-12
This file was deleted.

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

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// ignore-tidy-linelength
2+
//@ normalize-stderr-32bit: "values of the type `[^`]+` are too big" -> "values of the type $$REALLY_TOO_BIG are too big"
3+
//@ normalize-stderr-64bit: "values of the type `[^`]+` are too big" -> "values of the type $$REALLY_TOO_BIG are too big"
4+
5+
16
#![feature(transmute_generic_consts)]
27
#![feature(generic_const_exprs)]
38
#![allow(incomplete_features)]
@@ -31,6 +36,11 @@ fn overflow(v: [[[u32; 8888888]; 9999999]; 777777777]) -> [[[u32; 9999999]; 7777
3136
}
3237
}
3338

39+
fn overflow_more(v: [[[u32; 8888888]; 9999999]; 777777777]) -> [[[u32; 9999999]; 777777777]; 239] {
40+
unsafe { std::mem::transmute(v) } //~ ERROR cannot transmute between types of different sizes
41+
}
42+
43+
3444
fn transpose<const W: usize, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
3545
unsafe {
3646
std::mem::transmute(v)
+26-17
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: the constant `W` is not of type `usize`
2-
--> $DIR/transmute-fail.rs:12:42
2+
--> $DIR/transmute-fail.rs:17:42
33
|
44
LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
55
| ^^^^^^^^^^^^^ expected `usize`, found `bool`
66

77
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
8-
--> $DIR/transmute-fail.rs:7:9
8+
--> $DIR/transmute-fail.rs:12:9
99
|
1010
LL | std::mem::transmute(v)
1111
| ^^^^^^^^^^^^^^^^^^^
@@ -14,13 +14,13 @@ LL | std::mem::transmute(v)
1414
= note: target type: `[[u32; W + 1]; H]` (size can vary because of [u32; W + 1])
1515

1616
error: the constant `W` is not of type `usize`
17-
--> $DIR/transmute-fail.rs:15:9
17+
--> $DIR/transmute-fail.rs:20:9
1818
|
1919
LL | std::mem::transmute(v)
2020
| ^^^^^^^^^^^^^^^^^^^ expected `usize`, found `bool`
2121

2222
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
23-
--> $DIR/transmute-fail.rs:22:9
23+
--> $DIR/transmute-fail.rs:27:9
2424
|
2525
LL | std::mem::transmute(v)
2626
| ^^^^^^^^^^^^^^^^^^^
@@ -29,16 +29,25 @@ LL | std::mem::transmute(v)
2929
= note: target type: `[u32; W * H * H]` (this type does not have a fixed size)
3030

3131
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
32-
--> $DIR/transmute-fail.rs:29:9
32+
--> $DIR/transmute-fail.rs:34:9
3333
|
3434
LL | std::mem::transmute(v)
3535
| ^^^^^^^^^^^^^^^^^^^
3636
|
37-
= note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[[u32; 8888888]; 9999999]; 777777777]` are too big for the current architecture)
38-
= note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type `[[[u32; 9999999]; 777777777]; 8888888]` are too big for the current architecture)
37+
= note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type $REALLY_TOO_BIG are too big for the current architecture)
38+
= note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type $REALLY_TOO_BIG are too big for the current architecture)
3939

4040
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
41-
--> $DIR/transmute-fail.rs:36:9
41+
--> $DIR/transmute-fail.rs:40:14
42+
|
43+
LL | unsafe { std::mem::transmute(v) }
44+
| ^^^^^^^^^^^^^^^^^^^
45+
|
46+
= note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type $REALLY_TOO_BIG are too big for the current architecture)
47+
= note: target type: `[[[u32; 9999999]; 777777777]; 239]` (values of the type $REALLY_TOO_BIG are too big for the current architecture)
48+
49+
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
50+
--> $DIR/transmute-fail.rs:46:9
4251
|
4352
LL | std::mem::transmute(v)
4453
| ^^^^^^^^^^^^^^^^^^^
@@ -47,7 +56,7 @@ LL | std::mem::transmute(v)
4756
= note: target type: `[[u32; W]; H]` (size can vary because of [u32; W])
4857

4958
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
50-
--> $DIR/transmute-fail.rs:47:9
59+
--> $DIR/transmute-fail.rs:57:9
5160
|
5261
LL | std::mem::transmute(v)
5362
| ^^^^^^^^^^^^^^^^^^^
@@ -56,7 +65,7 @@ LL | std::mem::transmute(v)
5665
= note: target type: `[u32; W * H]` (this type does not have a fixed size)
5766

5867
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
59-
--> $DIR/transmute-fail.rs:54:9
68+
--> $DIR/transmute-fail.rs:64:9
6069
|
6170
LL | std::mem::transmute(v)
6271
| ^^^^^^^^^^^^^^^^^^^
@@ -65,7 +74,7 @@ LL | std::mem::transmute(v)
6574
= note: target type: `[[u32; W]; H]` (size can vary because of [u32; W])
6675

6776
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
68-
--> $DIR/transmute-fail.rs:63:9
77+
--> $DIR/transmute-fail.rs:73:9
6978
|
7079
LL | std::mem::transmute(v)
7180
| ^^^^^^^^^^^^^^^^^^^
@@ -74,7 +83,7 @@ LL | std::mem::transmute(v)
7483
= note: target type: `[u32; D * W * H]` (this type does not have a fixed size)
7584

7685
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
77-
--> $DIR/transmute-fail.rs:72:9
86+
--> $DIR/transmute-fail.rs:82:9
7887
|
7988
LL | std::mem::transmute(v)
8089
| ^^^^^^^^^^^^^^^^^^^
@@ -83,7 +92,7 @@ LL | std::mem::transmute(v)
8392
= note: target type: `[[u32; D * W]; H]` (size can vary because of [u32; D * W])
8493

8594
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
86-
--> $DIR/transmute-fail.rs:79:9
95+
--> $DIR/transmute-fail.rs:89:9
8796
|
8897
LL | std::mem::transmute(v)
8998
| ^^^^^^^^^^^^^^^^^^^
@@ -92,7 +101,7 @@ LL | std::mem::transmute(v)
92101
= note: target type: `[u8; L * 2]` (this type does not have a fixed size)
93102

94103
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
95-
--> $DIR/transmute-fail.rs:86:9
104+
--> $DIR/transmute-fail.rs:96:9
96105
|
97106
LL | std::mem::transmute(v)
98107
| ^^^^^^^^^^^^^^^^^^^
@@ -101,7 +110,7 @@ LL | std::mem::transmute(v)
101110
= note: target type: `[u16; L]` (this type does not have a fixed size)
102111

103112
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
104-
--> $DIR/transmute-fail.rs:93:9
113+
--> $DIR/transmute-fail.rs:103:9
105114
|
106115
LL | std::mem::transmute(v)
107116
| ^^^^^^^^^^^^^^^^^^^
@@ -110,14 +119,14 @@ LL | std::mem::transmute(v)
110119
= note: target type: `[[u8; 1]; L]` (this type does not have a fixed size)
111120

112121
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
113-
--> $DIR/transmute-fail.rs:102:9
122+
--> $DIR/transmute-fail.rs:112:9
114123
|
115124
LL | std::mem::transmute(v)
116125
| ^^^^^^^^^^^^^^^^^^^
117126
|
118127
= note: source type: `[[u32; 2 * H]; W + W]` (size can vary because of [u32; 2 * H])
119128
= note: target type: `[[u32; W + W]; 2 * H]` (size can vary because of [u32; W + W])
120129

121-
error: aborting due to 14 previous errors
130+
error: aborting due to 15 previous errors
122131

123132
For more information about this error, try `rustc --explain E0512`.

0 commit comments

Comments
 (0)