-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #2125 - RalfJung:ref-validity, r=RalfJung
test for validity of references pointing to uninhabited types The new tests for rust-lang/rust#97116
- Loading branch information
Showing
3 changed files
with
15 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
e1ec3260d79497080ca86540562d410ba67d2a95 | ||
77972d2d0134fb597249b3b64dcf9510a790c34e |
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,7 @@ | ||
#![feature(never_type)] | ||
use std::mem::{transmute, forget}; | ||
|
||
fn main() { unsafe { | ||
let x: Box<!> = transmute(&mut 42); //~ERROR encountered a box pointing to uninhabited type ! | ||
forget(x); | ||
} } |
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,7 @@ | ||
use std::mem::transmute; | ||
|
||
enum Void {} | ||
|
||
fn main() { unsafe { | ||
let _x: &(i32, Void) = transmute(&42); //~ERROR encountered a reference pointing to uninhabited type (i32, Void) | ||
} } |