Don't ICE on unnormalized struct tail in layout computation
This commit is contained in:
parent
3b2073f076
commit
dd620aa73a
6 changed files with 65 additions and 12 deletions
|
|
@ -4,8 +4,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
|
|||
LL | unsafe { 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]; 239]` (59484438436515561504 bits)
|
||||
= note: source type: `[[[u32; 8888888]; 9999999]; 777777777]` (values of the type `[[u32; 8888888]; 9999999]` are too big for the current architecture)
|
||||
= note: target type: `[[[u32; 9999999]; 777777777]; 239]` (values of the type `[[u32; 9999999]; 777777777]` are too big for the current architecture)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ error[E0512]: cannot transmute between types of different sizes, or dependently-
|
|||
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 `[[u32; 8888888]; 9999999]` are too big for the current architecture)
|
||||
= note: target type: `[[[u32; 9999999]; 777777777]; 8888888]` (values of the type `[[u32; 9999999]; 777777777]` are too big for the current architecture)
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
22
tests/ui/layout/cannot-transmute-unnormalizable-type.rs
Normal file
22
tests/ui/layout/cannot-transmute-unnormalizable-type.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
trait Trait {
|
||||
type RefTarget;
|
||||
}
|
||||
|
||||
impl Trait for ()
|
||||
where
|
||||
Missing: Trait,
|
||||
//~^ ERROR cannot find type `Missing` in this scope
|
||||
{
|
||||
type RefTarget = ();
|
||||
}
|
||||
|
||||
struct Other {
|
||||
data: <() as Trait>::RefTarget,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
std::mem::transmute::<Option<()>, Option<&Other>>(None);
|
||||
//~^ ERROR cannot transmute between types of different sizes, or dependently-sized types
|
||||
}
|
||||
}
|
||||
19
tests/ui/layout/cannot-transmute-unnormalizable-type.stderr
Normal file
19
tests/ui/layout/cannot-transmute-unnormalizable-type.stderr
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
error[E0412]: cannot find type `Missing` in this scope
|
||||
--> $DIR/cannot-transmute-unnormalizable-type.rs:7:5
|
||||
|
|
||||
LL | Missing: Trait,
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
|
||||
--> $DIR/cannot-transmute-unnormalizable-type.rs:19:9
|
||||
|
|
||||
LL | std::mem::transmute::<Option<()>, Option<&Other>>(None);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: source type: `Option<()>` (8 bits)
|
||||
= note: target type: `Option<&Other>` (unable to determine layout for `Other` because `<Other as Pointee>::Metadata` cannot be normalized)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0412, E0512.
|
||||
For more information about an error, try `rustc --explain E0412`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue