Skip to content

Commit 4810e27

Browse files
Fix the remaining tests
Signed-off-by: FedericoBruzzone <[email protected]>
1 parent b12aeeb commit 4810e27

File tree

9 files changed

+52
-29
lines changed

9 files changed

+52
-29
lines changed

compiler/rustc_ty_utils/src/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ fn layout_of_uncached<'tcx>(
317317
if count.has_aliases() {
318318
count = tcx.normalize_erasing_regions(cx.typing_env, count);
319319
if count.has_aliases() {
320-
return Err(error(cx, LayoutError::Unknown(ty)));
320+
return Err(error(cx, LayoutError::TooGeneric(ty)));
321321
}
322322
}
323323

tests/ui/const-generics/transmute_no_gate.stderr

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,80 +4,80 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
44
LL | std::mem::transmute(v)
55
| ^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: source type: `[[u32; H]; W]` (this type does not have a fixed size)
8-
= note: target type: `[[u32; W]; H]` (this type does not have a fixed size)
7+
= note: source type: `[[u32; H]; W]` (`[[u32; H]; W]` is too generic to determine the layout)
8+
= note: target type: `[[u32; W]; H]` (`[[u32; W]; H]` is too generic to determine the layout)
99

1010
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
1111
--> $DIR/transmute_no_gate.rs:20:5
1212
|
1313
LL | std::mem::transmute(v)
1414
| ^^^^^^^^^^^^^^^^^^^
1515
|
16-
= note: source type: `[[u32; H]; W]` (this type does not have a fixed size)
17-
= note: target type: `[u32; W * H]` (this type does not have a fixed size)
16+
= note: source type: `[[u32; H]; W]` (`[[u32; H]; W]` is too generic to determine the layout)
17+
= note: target type: `[u32; W * H]` (`[u32; W * H]` is too generic to determine the layout)
1818

1919
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
2020
--> $DIR/transmute_no_gate.rs:27:5
2121
|
2222
LL | std::mem::transmute(v)
2323
| ^^^^^^^^^^^^^^^^^^^
2424
|
25-
= note: source type: `[u32; H*W]` (this type does not have a fixed size)
26-
= note: target type: `[[u32; W]; H]` (this type does not have a fixed size)
25+
= note: source type: `[u32; H*W]` (`[u32; H*W]` is too generic to determine the layout)
26+
= note: target type: `[[u32; W]; H]` (`[[u32; W]; H]` is too generic to determine the layout)
2727

2828
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
2929
--> $DIR/transmute_no_gate.rs:36:5
3030
|
3131
LL | std::mem::transmute(v)
3232
| ^^^^^^^^^^^^^^^^^^^
3333
|
34-
= note: source type: `[[[u32; D]; H]; W]` (this type does not have a fixed size)
35-
= note: target type: `[u32; D * W * H]` (this type does not have a fixed size)
34+
= note: source type: `[[[u32; D]; H]; W]` (`[[[u32; D]; H]; W]` is too generic to determine the layout)
35+
= note: target type: `[u32; D * W * H]` (`[u32; D * W * H]` is too generic to determine the layout)
3636

3737
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
3838
--> $DIR/transmute_no_gate.rs:45:5
3939
|
4040
LL | std::mem::transmute(v)
4141
| ^^^^^^^^^^^^^^^^^^^
4242
|
43-
= note: source type: `[[[u32; D]; H]; W]` (this type does not have a fixed size)
44-
= note: target type: `[[u32; D * W]; H]` (this type does not have a fixed size)
43+
= note: source type: `[[[u32; D]; H]; W]` (`[[[u32; D]; H]; W]` is too generic to determine the layout)
44+
= note: target type: `[[u32; D * W]; H]` (`[[u32; D * W]; H]` is too generic to determine the layout)
4545

4646
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
4747
--> $DIR/transmute_no_gate.rs:52:5
4848
|
4949
LL | std::mem::transmute(v)
5050
| ^^^^^^^^^^^^^^^^^^^
5151
|
52-
= note: source type: `[u16; L]` (this type does not have a fixed size)
53-
= note: target type: `[u8; L * 2]` (this type does not have a fixed size)
52+
= note: source type: `[u16; L]` (`[u16; L]` is too generic to determine the layout)
53+
= note: target type: `[u8; L * 2]` (`[u8; L * 2]` is too generic to determine the layout)
5454

5555
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
5656
--> $DIR/transmute_no_gate.rs:59:5
5757
|
5858
LL | std::mem::transmute(v)
5959
| ^^^^^^^^^^^^^^^^^^^
6060
|
61-
= note: source type: `[u8; L * 2]` (this type does not have a fixed size)
62-
= note: target type: `[u16; L]` (this type does not have a fixed size)
61+
= note: source type: `[u8; L * 2]` (`[u8; L * 2]` is too generic to determine the layout)
62+
= note: target type: `[u16; L]` (`[u16; L]` is too generic to determine the layout)
6363

6464
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
6565
--> $DIR/transmute_no_gate.rs:66:5
6666
|
6767
LL | std::mem::transmute(v)
6868
| ^^^^^^^^^^^^^^^^^^^
6969
|
70-
= note: source type: `[u8; L]` (this type does not have a fixed size)
71-
= note: target type: `[[u8; 1]; L]` (this type does not have a fixed size)
70+
= note: source type: `[u8; L]` (`[u8; L]` is too generic to determine the layout)
71+
= note: target type: `[[u8; 1]; L]` (`[[u8; 1]; L]` is too generic to determine the layout)
7272

7373
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
7474
--> $DIR/transmute_no_gate.rs:75:5
7575
|
7676
LL | std::mem::transmute(v)
7777
| ^^^^^^^^^^^^^^^^^^^
7878
|
79-
= note: source type: `[[u32; 2 * H]; W + W]` (this type does not have a fixed size)
80-
= note: target type: `[[u32; W + W]; 2 * H]` (this type does not have a fixed size)
79+
= note: source type: `[[u32; 2 * H]; W + W]` (`[[u32; 2 * H]; W + W]` is too generic to determine the layout)
80+
= note: target type: `[[u32; W + W]; 2 * H]` (`[[u32; W + W]; 2 * H]` is too generic to determine the layout)
8181

8282
error: aborting due to 9 previous errors
8383

tests/ui/issues/issue-21174.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
44
LL | let new: T::B = unsafe { std::mem::transmute(value) };
55
| ^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: source type: `<T as Trait<'_>>::A` (this type does not have a fixed size)
8-
= note: target type: `<T as Trait<'_>>::B` (this type does not have a fixed size)
7+
= note: source type: `<T as Trait<'_>>::A` (`<T as Trait<'_>>::A` is too generic to determine the layout)
8+
= note: target type: `<T as Trait<'_>>::B` (`<T as Trait<'_>>::B` is too generic to determine the layout)
99

1010
error: aborting due to 1 previous error
1111

tests/ui/repr/conflicting-repr-hints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub union U { //~ ERROR type has conflicting packed and align representation hin
7474
u: u16
7575
}
7676

77-
static B: U = U { u: 0 };
77+
static B: U = U { u: 0 }; //~ ERROR could not evaluate static initializer
7878
static A: S = S(0);
7979

8080
fn main() {}

tests/ui/repr/conflicting-repr-hints.stderr

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,16 @@ error[E0587]: type has conflicting packed and align representation hints
7777
LL | pub union U {
7878
| ^^^^^^^^^^^
7979

80-
error: aborting due to 12 previous errors
80+
error[E0080]: could not evaluate static initializer
81+
--> $DIR/conflicting-repr-hints.rs:77:1
82+
|
83+
LL | static B: U = U { u: 0 };
84+
| ^^^^^^^^^^^ the type `U` has an unknown layout
85+
86+
error: aborting due to 13 previous errors
8187

82-
Some errors have detailed explanations: E0566, E0587, E0634.
83-
For more information about an error, try `rustc --explain E0566`.
88+
Some errors have detailed explanations: E0080, E0566, E0587, E0634.
89+
For more information about an error, try `rustc --explain E0080`.
8490
Future incompatibility report: Future breakage diagnostic:
8591
error[E0566]: conflicting representation hints
8692
--> $DIR/conflicting-repr-hints.rs:13:8

tests/ui/simd/monomorphize-heterogeneous.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ struct I64x4F64x0([i64; 4], [f64; 0]);
99
//~^ ERROR SIMD vector cannot have multiple fields
1010

1111
static X: I64F64 = I64F64(1, 2.0);
12+
//~^ ERROR could not evaluate static initializer
1213

1314
fn main() {}

tests/ui/simd/monomorphize-heterogeneous.stderr

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ error[E0075]: SIMD vector cannot have multiple fields
1010
LL | struct I64x4F64x0([i64; 4], [f64; 0]);
1111
| ^^^^^^^^^^^^^^^^^ -------- excess field
1212

13-
error: aborting due to 2 previous errors
13+
error[E0080]: could not evaluate static initializer
14+
--> $DIR/monomorphize-heterogeneous.rs:11:1
15+
|
16+
LL | static X: I64F64 = I64F64(1, 2.0);
17+
| ^^^^^^^^^^^^^^^^ the type `I64F64` has an unknown layout
18+
19+
error: aborting due to 3 previous errors
1420

15-
Some errors have detailed explanations: E0075, E0076.
21+
Some errors have detailed explanations: E0075, E0076, E0080.
1622
For more information about an error, try `rustc --explain E0075`.

tests/ui/structs/ice-struct-tail-normalization-113272.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ struct Other {
1313
fn main() {
1414
unsafe {
1515
std::mem::transmute::<Option<()>, Option<&Other>>(None);
16+
//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types
1617
}
1718
}

tests/ui/structs/ice-struct-tail-normalization-113272.stderr

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@ LL | type RefTarget;
1313
LL | impl Trait for () where Missing: Trait {}
1414
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `RefTarget` in implementation
1515

16-
error: aborting due to 2 previous errors
16+
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
17+
--> $DIR/ice-struct-tail-normalization-113272.rs:15:9
18+
|
19+
LL | std::mem::transmute::<Option<()>, Option<&Other>>(None);
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
|
22+
= note: source type: `Option<()>` (8 bits)
23+
= note: target type: `Option<&Other>` (size can vary because of <Other as Pointee>::Metadata)
24+
25+
error: aborting due to 3 previous errors
1726

18-
Some errors have detailed explanations: E0046, E0412.
27+
Some errors have detailed explanations: E0046, E0412, E0512.
1928
For more information about an error, try `rustc --explain E0046`.

0 commit comments

Comments
 (0)