diff options
| author | Adrian Taylor <adetaylor@chromium.org> | 2024-07-12 14:26:35 +0000 |
|---|---|---|
| committer | Adrian Taylor <adetaylor@chromium.org> | 2024-12-11 11:59:12 +0000 |
| commit | 2707f5578da273284770298be9202c0cdd6621b3 (patch) | |
| tree | 68b03f19483064095aa091836f3623ffa39b944a /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 7f7c964e475d36789de0ce1473f696b8b1fc5434 (diff) | |
| download | rust-2707f5578da273284770298be9202c0cdd6621b3.tar.gz rust-2707f5578da273284770298be9202c0cdd6621b3.zip | |
Arbitrary self types v2: deshadowing probe
This is the first part of a series of commits which impact the "deshadowing detection" in the arbitrary self types v2 RFC. This commit should not have any functional changes, but may impact performance. Subsequent commits add back the performance, and add error checking to this new code such that it has a functional effect. Rust prioritizes method candidates in this order: 1. By value; 2. By reference; 3. By mutable reference; 4. By const ptr. 5. By reborrowed pin. Previously, if a suitable candidate was found in one of these earlier categories, Rust wouldn't even move onto probing the other categories. As part of the arbitrary self types work, we're going to need to change that - even if we choose a method from one of the earlier categories, we will sometimes need to probe later categories to search for methods that we may be shadowing. This commit adds those extra searches for shadowing, but it does not yet produce an error when such shadowing problems are found. That will come in a subsequent commit, by filling out the 'check_for_shadowing' method. This commit contains a naive approach to detecting these shadowing problems, which shows what we've functionally looking to do. However, it's too slow. The performance of this approach was explored in this PR: https://github.com/rust-lang/rust/pull/127812#issuecomment-2236911900 Subsequent commits will improve the speed of the search.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
