Skip to content

Commit

Permalink
Normalize away and fold in a test
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Sep 19, 2024
1 parent 65f132f commit 98c3e20
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
7 changes: 0 additions & 7 deletions tests/ui/const-generics/issue-112505-overflow.rs

This file was deleted.

12 changes: 0 additions & 12 deletions tests/ui/const-generics/issue-112505-overflow.stderr

This file was deleted.

10 changes: 10 additions & 0 deletions tests/ui/const-generics/transmute-fail.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// ignore-tidy-linelength
//@ normalize-stderr-32bit: "values of the type `[^`]+` are too big" -> "values of the type $$REALLY_TOO_BIG are too big"
//@ normalize-stderr-64bit: "values of the type `[^`]+` are too big" -> "values of the type $$REALLY_TOO_BIG are too big"


#![feature(transmute_generic_consts)]
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
Expand Down Expand Up @@ -31,6 +36,11 @@ fn overflow(v: [[[u32; 8888888]; 9999999]; 777777777]) -> [[[u32; 9999999]; 7777
}
}

fn overflow_more(v: [[[u32; 8888888]; 9999999]; 777777777]) -> [[[u32; 9999999]; 777777777]; 239] {
unsafe { std::mem::transmute(v) } //~ ERROR cannot transmute between types of different sizes
}


fn transpose<const W: usize, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
unsafe {
std::mem::transmute(v)
Expand Down
43 changes: 26 additions & 17 deletions tests/ui/const-generics/transmute-fail.stderr
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
error: the constant `W` is not of type `usize`
--> $DIR/transmute-fail.rs:12:42
--> $DIR/transmute-fail.rs:17:42
|
LL | fn bar<const W: bool, const H: usize>(v: [[u32; H]; W]) -> [[u32; W]; H] {
| ^^^^^^^^^^^^^ expected `usize`, found `bool`

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

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

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

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

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/transmute-fail.rs:36:9
--> $DIR/transmute-fail.rs:40:14
|
LL | unsafe { std::mem::transmute(v) }
| ^^^^^^^^^^^^^^^^^^^
|
= note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type $REALLY_TOO_BIG are too big for the current architecture)
= note: target type: `[[[u32; 9999999]; 777777777]; 239]` (values of the type $REALLY_TOO_BIG are too big for the current architecture)

error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> $DIR/transmute-fail.rs:46:9
|
LL | std::mem::transmute(v)
| ^^^^^^^^^^^^^^^^^^^
Expand All @@ -47,7 +56,7 @@ LL | std::mem::transmute(v)
= note: target type: `[[u32; W]; H]` (size can vary because of [u32; W])

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

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

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

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

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

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

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

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

error: aborting due to 14 previous errors
error: aborting due to 15 previous errors

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

0 comments on commit 98c3e20

Please sign in to comment.