Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. #![allow(unreachable_code)]
  2.  
  3.  
  4. fn main() {
  5. println!("{:?}", {
  6. enum f { A(Box<String>), B(Box<String>, Box<String>) } use std::mem::size_of; (size_of::<f>, size_of::<Option<f>>())
  7. });
  8. }
  9.  
  10.  
  11. /* ~~~~=== stderr ===~~~~
  12. Compiling playground v0.0.1 (/playground)
  13. warning: type `f` should have an upper camel case name
  14. --> src/main.rs:6:14
  15. |
  16. 6 | enum f { A(Box<String>), B(Box<String>, Box<String>) } use std::mem::size_of; (size_of::<f>, size_of::<Option<f>>())
  17. | ^ help: convert the identifier to upper camel case: `F`
  18. |
  19. = note: #[warn(non_camel_case_types)] on by default
  20.  
  21. error[E0277]: `fn() -> usize {std::mem::size_of::<main::f>}` doesn't implement `std::fmt::Debug`
  22. --> src/main.rs:5:22
  23. |
  24. 5 | println!("{:?}", {
  25. | ______________________^
  26. 6 | | enum f { A(Box<String>), B(Box<String>, Box<String>) } use std::mem::size_of; (size_of::<f>, size_of::<Option<f>>())
  27. 7 | | });
  28. | |_____^ `fn() -> usize {std::mem::size_of::<main::f>}` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
  29. |
  30. = help: the trait `std::fmt::Debug` is not implemented for `fn() -> usize {std::mem::size_of::<main::f>}`
  31. = note: required because of the requirements on the impl of `std::fmt::Debug` for `(fn() -> usize {std::mem::size_of::<main::f>}, usize)`
  32. = note: required by `std::fmt::Debug::fmt`
  33.  
  34. error: aborting due to previous error
  35.  
  36. For more information about this error, try `rustc --explain E0277`.
  37. error: Could not compile `playground`.
  38.  
  39. To learn more, run the command again with --verbose.
  40.  
  41. */
  42.  
  43. /* ~~~~=== stdout ===~~~~
  44.  
  45. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement