Guest User

Untitled

a guest
Jun 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. fn main() {
  2. println!("{:?}", {
  3. struct S { i: i32 }; impl S { fn foo(&S { i }: &Self) { print!("{} ", i); } } (S { i: 5 }).foo()
  4. });
  5. }
  6.  
  7.  
  8. /* ~~~~=== stderr ===~~~~
  9. Compiling playground v0.0.1 (file:///playground)
  10. error[E0599]: no method named `foo` found for type `main::S` in the current scope
  11. --> src/main.rs:5:100
  12. |
  13. 5 | struct S { i: i32 }; impl S { fn foo(&S { i }: &Self) { print!("{} ", i); } } (S { i: 5 }).foo()
  14. | -------- method `foo` not found for this ^^^
  15. |
  16. = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
  17. = help: try with `main::S::foo`
  18. note: candidate #1 is defined in an impl for the type `main::S`
  19. --> src/main.rs:5:39
  20. |
  21. 5 | struct S { i: i32 }; impl S { fn foo(&S { i }: &Self) { print!("{} ", i); } } (S { i: 5 }).foo()
  22. | ^^^^^^^^^
  23.  
  24. error: aborting due to previous error
  25.  
  26. For more information about this error, try `rustc --explain E0599`.
  27. error: Could not compile `playground`.
  28.  
  29. To learn more, run the command again with --verbose.
  30.  
  31. */
  32.  
  33. /* ~~~~=== stdout ===~~~~
  34.  
  35. */
Add Comment
Please, Sign In to add comment