Don't ICE on the use of integer addresses for ZST constants in pattern matching
This commit is contained in:
parent
3e0a1c0910
commit
1e40681f50
4 changed files with 63 additions and 12 deletions
|
|
@ -1,7 +1,10 @@
|
|||
// run-pass
|
||||
#![feature(const_transmute)]
|
||||
|
||||
const FOO: isize = 10;
|
||||
const BAR: isize = 3;
|
||||
const ZST: &() = unsafe { std::mem::transmute(1usize) };
|
||||
const ZST_ARR: &[u8; 0] = unsafe { std::mem::transmute(1usize) };
|
||||
|
||||
const fn foo() -> isize { 4 }
|
||||
const BOO: isize = foo();
|
||||
|
|
@ -15,4 +18,14 @@ pub fn main() {
|
|||
_ => 3
|
||||
};
|
||||
assert_eq!(y, 2);
|
||||
let z = match &() {
|
||||
ZST => 9,
|
||||
// FIXME: this should not be required
|
||||
_ => 42,
|
||||
};
|
||||
assert_eq!(z, 9);
|
||||
let z = match b"" {
|
||||
ZST_ARR => 10,
|
||||
};
|
||||
assert_eq!(z, 10);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue