Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #![allow(unreachable_code)]
  2.  
  3.  
  4. fn main() {
  5. println!("{:?}", {
  6. unsafe {std::mem::transmute::<(usize, *mut u8)>(&mut [1u8; 2] as *mut [u8])}
  7. });
  8. }
  9.  
  10.  
  11. /* ~~~~=== stderr ===~~~~
  12. Compiling playground v0.0.1 (/playground)
  13. error[E0107]: wrong number of type arguments: expected 2, found 1
  14. --> src/main.rs:6:17
  15. |
  16. 6 | unsafe {std::mem::transmute::<(usize, *mut u8)>(&mut [1u8; 2] as *mut [u8])}
  17. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 2 type arguments
  18.  
  19. error[E0308]: mismatched types
  20. --> src/main.rs:6:57
  21. |
  22. 6 | unsafe {std::mem::transmute::<(usize, *mut u8)>(&mut [1u8; 2] as *mut [u8])}
  23. | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found *-ptr
  24. |
  25. = note: expected type `(usize, *mut u8)`
  26. found type `*mut [u8]`
  27.  
  28. error: aborting due to 2 previous errors
  29.  
  30. Some errors occurred: E0107, E0308.
  31. For more information about an error, try `rustc --explain E0107`.
  32. error: Could not compile `playground`.
  33.  
  34. To learn more, run the command again with --verbose.
  35.  
  36. */
  37.  
  38. /* ~~~~=== stdout ===~~~~
  39.  
  40. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement