Guest User

Untitled

a guest
May 25th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. fn main() {
  2. println!("{:?}", {
  3. enum E { A, B } 0 as E
  4. });
  5. }
  6.  
  7.  
  8. /* ~~~~=== stderr ===~~~~
  9. Compiling playground v0.0.1 (file:///playground)
  10. error[E0277]: `main::E` doesn't implement `std::fmt::Debug`
  11. --> src/main.rs:4:22
  12. |
  13. 4 | println!("{:?}", {
  14. | ______________________^
  15. 5 | | enum E { A, B } 0 as E
  16. 6 | | });
  17. | |_____^ `main::E` cannot be formatted using `:?`; add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
  18. |
  19. = help: the trait `std::fmt::Debug` is not implemented for `main::E`
  20. = note: required by `std::fmt::Debug::fmt`
  21.  
  22. error[E0605]: non-primitive cast: `{integer}` as `main::E`
  23. --> src/main.rs:5:25
  24. |
  25. 5 | enum E { A, B } 0 as E
  26. | ^^^^^^
  27. |
  28. = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
  29.  
  30. error: aborting due to 2 previous errors
  31.  
  32. Some errors occurred: E0277, E0605.
  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