diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-23649-1.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-23649-1.rs b/src/test/ui/issues/issue-23649-1.rs new file mode 100644 index 000000000..fc0c9a605 --- /dev/null +++ b/src/test/ui/issues/issue-23649-1.rs @@ -0,0 +1,12 @@ +// run-pass +use std::mem; + +pub struct X([u8]); + +fn _f(x: &X) -> usize { match *x { X(ref x) => { x.len() } } } + +fn main() { + let b: &[u8] = &[11; 42]; + let v: &X = unsafe { mem::transmute(b) }; + assert_eq!(_f(v), 42); +} |