Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- println!("{:?}", {
- struct S { i: i32 }; impl S { fn foo(&S { i }: &Self) { print!("{} ", i); } } (S { i: 5 }).foo()
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (file:///playground)
- error[E0599]: no method named `foo` found for type `main::S` in the current scope
- --> src/main.rs:5:100
- |
- 5 | struct S { i: i32 }; impl S { fn foo(&S { i }: &Self) { print!("{} ", i); } } (S { i: 5 }).foo()
- | -------- method `foo` not found for this ^^^
- |
- = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
- = help: try with `main::S::foo`
- note: candidate #1 is defined in an impl for the type `main::S`
- --> src/main.rs:5:39
- |
- 5 | struct S { i: i32 }; impl S { fn foo(&S { i }: &Self) { print!("{} ", i); } } (S { i: 5 }).foo()
- | ^^^^^^^^^
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0599`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Add Comment
Please, Sign In to add comment