-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't ICE on unnormalized struct tail in layout computation
- Loading branch information
1 parent
3b2073f
commit dd620aa
Showing
6 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 19 additions & 0 deletions
19
tests/ui/layout/cannot-transmute-unnormalizable-type.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |