Guest User

Untitled

a guest
Jun 23rd, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. fn main() {
  2. println!("{:?}", {
  3. let x: i32 = 4; let y: i32 = &x; println!("{:p} {:p} {}", &x, y, y);
  4. });
  5. }
  6.  
  7.  
  8. /* ~~~~=== stderr ===~~~~
  9. Compiling playground v0.0.1 (file:///playground)
  10. error[E0308]: mismatched types
  11. --> src/main.rs:5:38
  12. |
  13. 5 | let x: i32 = 4; let y: i32 = &x; println!("{:p} {:p} {}", &x, y, y);
  14. | ^^
  15. | |
  16. | expected i32, found &i32
  17. | help: consider removing the borrow: `x`
  18. |
  19. = note: expected type `i32`
  20. found type `&i32`
  21.  
  22. error[E0277]: the trait bound `i32: std::fmt::Pointer` is not satisfied
  23. --> src/main.rs:5:71
  24. |
  25. 5 | let x: i32 = 4; let y: i32 = &x; println!("{:p} {:p} {}", &x, y, y);
  26. | ^ the trait `std::fmt::Pointer` is not implemented for `i32`
  27. |
  28. = note: required by `std::fmt::Pointer::fmt`
  29.  
  30. error: aborting due to 2 previous errors
  31.  
  32. Some errors occurred: E0277, E0308.
  33. For more information about an error, try `rustc --explain E0277`.
  34. error: Could not compile `playground`.
  35.  
  36. To learn more, run the command again with --verbose.
  37.  
  38. */
  39.  
  40. /* ~~~~=== stdout ===~~~~
  41.  
  42. */
Add Comment
Please, Sign In to add comment