-
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.
Rollup merge of #125466 - compiler-errors:dont-probe-for-ambig-in-sug…
…g, r=jieyouxu Don't continue probing for method if in suggestion and autoderef hits ambiguity The title is somewhat self-explanatory. When we hit ambiguity in method autoderef steps, we previously would continue to probe for methods if we were giving a suggestion. This seems useless, and causes an ICE when we are not able to unify the receiver later on in confirmation. Fixes #125432
- Loading branch information
Showing
3 changed files
with
34 additions
and
2 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
16 changes: 16 additions & 0 deletions
16
tests/ui/methods/suggest-method-on-call-for-ambig-receiver.rs
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,16 @@ | ||
// Fix for <https://github.com/rust-lang/rust/issues/125432>. | ||
|
||
fn separate_arms() { | ||
let mut x = None; | ||
match x { | ||
None => { | ||
x = Some(0); | ||
} | ||
Some(right) => { | ||
consume(right); | ||
//~^ ERROR cannot find function `consume` in this scope | ||
} | ||
} | ||
} | ||
|
||
fn main() {} |
9 changes: 9 additions & 0 deletions
9
tests/ui/methods/suggest-method-on-call-for-ambig-receiver.stderr
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,9 @@ | ||
error[E0425]: cannot find function `consume` in this scope | ||
--> $DIR/suggest-method-on-call-for-ambig-receiver.rs:10:13 | ||
| | ||
LL | consume(right); | ||
| ^^^^^^^ not found in this scope | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0425`. |