Guest User

Untitled

a guest
May 26th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. fn main() {
  2. println!("{:?}", {
  3. struct S<T>(T); trait Tr { } impl<T> Tr for S<T> { } fn foo<T: std::fmt::Debug>(t: T) -> impl Tr + std::fmt::Debug { S(t) }
  4. });
  5. }
  6.  
  7.  
  8. /* ~~~~=== stderr ===~~~~
  9. Compiling playground v0.0.1 (file:///playground)
  10. error[E0277]: `main::S<T>` doesn't implement `std::fmt::Debug`
  11. --> src/main.rs:5:98
  12. |
  13. 5 | struct S<T>(T); trait Tr { } impl<T> Tr for S<T> { } fn foo<T: std::fmt::Debug>(t: T) -> impl Tr + std::fmt::Debug { S(t) }
  14. | ^^^^^^^^^^^^^^^^^^^^^^^^^ `main::S<T>` cannot be formatted using `:?`; add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
  15. |
  16. = help: the trait `std::fmt::Debug` is not implemented for `main::S<T>`
  17. = note: the return type of a function must have a statically known size
  18.  
  19. error: aborting due to previous error
  20.  
  21. For more information about this error, try `rustc --explain E0277`.
  22. error: Could not compile `playground`.
  23.  
  24. To learn more, run the command again with --verbose.
  25.  
  26. */
  27.  
  28. /* ~~~~=== stdout ===~~~~
  29.  
  30. */
Add Comment
Please, Sign In to add comment