Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![allow(unreachable_code)]
- fn main() {
- println!("{:?}", {
- /* please don't */ let buf = &[0_u8; 16]; let slice = &buf[..]; let ary = unsafe { *std::mem::transmute::<*u8, &[u8;16]>(slice.as_ptr()) }; ary
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (/playground)
- error: expected mut or const in raw pointer type (use `*mut T` or `*const T` as appropriate)
- --> src/main.rs:6:115
- |
- 6 | /* please don't */ let buf = &[0_u8; 16]; let slice = &buf[..]; let ary = unsafe { *std::mem::transmute::<*u8, &[u8;16]>(slice.as_ptr()) }; ary
- | ^
- error: aborting due to previous error
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Add Comment
Please, Sign In to add comment