diff options
| author | Jubilee <46493976+workingjubilee@users.noreply.github.com> | 2024-05-26 15:28:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-26 15:28:27 -0700 |
| commit | 09e75921f349d7155694f105e2f86b04087063c7 (patch) | |
| tree | f9c5a2e8e4071956832cff5ef74284e1e457a5be /tests | |
| parent | 5860d43af38fe1160835d72874fd35e0186be10e (diff) | |
| parent | 4bc41b91d7e299b6d0651a8ba48122304beb6820 (diff) | |
| download | rust-09e75921f349d7155694f105e2f86b04087063c7.tar.gz rust-09e75921f349d7155694f105e2f86b04087063c7.zip | |
Rollup merge of #125466 - compiler-errors:dont-probe-for-ambig-in-sugg, 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
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/methods/suggest-method-on-call-for-ambig-receiver.rs | 16 | ||||
| -rw-r--r-- | tests/ui/methods/suggest-method-on-call-for-ambig-receiver.stderr | 9 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.rs b/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.rs new file mode 100644 index 00000000000..fc2c15ee8c6 --- /dev/null +++ b/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.rs @@ -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() {} diff --git a/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.stderr b/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.stderr new file mode 100644 index 00000000000..40d8301c24e --- /dev/null +++ b/tests/ui/methods/suggest-method-on-call-for-ambig-receiver.stderr @@ -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`. |
