about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-05 18:21:11 +0200
committerGitHub <noreply@github.com>2024-06-05 18:21:11 +0200
commit9abf8b105e22dd876834bf5094c77b0f2702f974 (patch)
tree8aaedcb59eb93d128b29d3d8596d1f67cc97855a /compiler/rustc_pattern_analysis/src
parent69a8c139f1d7c97dc8b9bc0086e042fa6c79a389 (diff)
parentffb1b2c14809ae5d15a078a9cce5299865d7dd73 (diff)
downloadrust-9abf8b105e22dd876834bf5094c77b0f2702f974.tar.gz
rust-9abf8b105e22dd876834bf5094c77b0f2702f974.zip
Rollup merge of #125622 - oli-obk:define_opaque_types15, r=compiler-errors
Winnow private method candidates instead of assuming any candidate of the right name will apply

partially reverts https://github.com/rust-lang/rust/pull/60721

My original motivation was just to avoid the `delay_span_bug` (by attempting to thread the `ErrorGuaranteed` through to here). But then I realized that the error message is wrong. It refers to the `Foo<A>::foo` instead of `Foo<B>::foo`. This is almost invisible, because both functions are the same, but on different lines, so `-Zui-testing` makes it so the test is the same no matter which of these two functions is referenced.

But there's a much more obvious bug: If `Foo<B>` does not have a `foo` method at all, but `Foo<A>` has a private `foo` method, then we'll refer to that one. This has now been fixed, and we report a normal `method not found` error.

The way this is done is by creating a list of all possible private functions (just like we create a list of the public functions that can actually be called), and then winnowing it by analyzing where bounds and `Self` types to see if any of the found methods can actually apply (again, just like with the list of public functions).

I wonder if there is room for doing the same thing with unstable functions instead of running all of method resolution twice.

r? ``@compiler-errors`` for method resolution stuff
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions