diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-10-11 20:08:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-11 20:08:22 +0200 |
| commit | d2139834be6611c846ec24b50ba83a6647d81bd9 (patch) | |
| tree | a8ec6b68d35343094f910c1a8d56df266b3fd4b2 /compiler/rustc_codegen_llvm/src/errors.rs | |
| parent | 3712ea82f3985bb5353bf25d89b7d08765e4ec97 (diff) | |
| parent | 2d37b00e24bfb1051e4a1d587bf766378d19e9b7 (diff) | |
| download | rust-d2139834be6611c846ec24b50ba83a6647d81bd9.tar.gz rust-d2139834be6611c846ec24b50ba83a6647d81bd9.zip | |
Rollup merge of #116597 - GuillaumeGomez:foreign-blanket-impl, r=notriddle
Prevent showing methods from blanket impls of not available foreign traits to show up in the search results
Fixes https://github.com/rust-lang/rust/issues/115480.
In the case that the blanket impl trait is not available in the current crate, we prevent adding its methods in the search index.
Now how I found how to fix the issue: the `equivalent` method is not generated in the documentation pages but was still added to the search index. To render impls, we iterate over `cache.impls` so I took a look at how this was generated. Inside `formats/cache.rs`, we have `CacheBuilder::populate` where we push impls into `impls` but with this condition:
```rust
if cx.cache.traits.contains_key(&trait_did) {
```
I re-used this condition in `CacheBuilder::fold_item` to prevent this method from being added in `cache.search_index` or `cache.orphan_impl_items`.
PS: If you want to double-check if the added test works, just comment the code I added in `cache.rs` and it should fail.
r? ``@notriddle``
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
