forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't typecheck suggested method call
Only make the use-dot-operator-to-call-method suggestion, but do not double down and use the recovered type to perform method call typechecking as it will produce confusing diagnostics on the "fixed" code.
- Loading branch information
Showing
3 changed files
with
42 additions
and
32 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
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,13 @@ | ||
struct Client; | ||
|
||
impl Client { | ||
fn post<T: std::ops::Add>(&self, _: T, _: T) {} | ||
} | ||
|
||
fn f() { | ||
let c = Client; | ||
post(c, ()); | ||
//~^ ERROR cannot find function `post` in this scope | ||
} | ||
|
||
fn main() {} |
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,15 @@ | ||
error[E0425]: cannot find function `post` in this scope | ||
--> $DIR/issue-106929.rs:9:5 | ||
| | ||
LL | post(c, ()); | ||
| ^^^^ not found in this scope | ||
| | ||
help: use the `.` operator to call the method `post` on `&Client` | ||
| | ||
LL - post(c, ()); | ||
LL + c.post(()); | ||
| | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0425`. |