-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
703603a
commit cef0482
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
struct Foo { i: i32 } | ||
|
||
impl Foo { | ||
fn bar(&self) {} | ||
} | ||
|
||
fn foo() -> Foo { | ||
Foo { i: 1 } | ||
} | ||
|
||
fn main() { | ||
foo.bar(); | ||
//~^ ERROR no method named `bar` | ||
//~| HELP use parentheses to call this function | ||
|
||
foo.i; | ||
//~^ ERROR no field `i` | ||
//~| HELP use parentheses to call this function | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
error[E0599]: no method named `bar` found for fn item `fn() -> Foo {foo}` in the current scope | ||
--> $DIR/call-on-missing.rs:12:9 | ||
| | ||
LL | foo.bar(); | ||
| ^^^ method not found in `fn() -> Foo {foo}` | ||
| | ||
help: use parentheses to call this function | ||
| | ||
LL | foo().bar(); | ||
| ++ | ||
|
||
error[E0609]: no field `i` on type `fn() -> Foo {foo}` | ||
--> $DIR/call-on-missing.rs:16:9 | ||
| | ||
LL | foo.i; | ||
| ^ | ||
| | ||
help: use parentheses to call this function | ||
| | ||
LL | foo().i; | ||
| ++ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0599, E0609. | ||
For more information about an error, try `rustc --explain E0599`. |