about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/errors.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-10-11 20:08:22 +0200
committerGitHub <noreply@github.com>2023-10-11 20:08:22 +0200
commitd2139834be6611c846ec24b50ba83a6647d81bd9 (patch)
treea8ec6b68d35343094f910c1a8d56df266b3fd4b2 /compiler/rustc_codegen_llvm/src/errors.rs
parent3712ea82f3985bb5353bf25d89b7d08765e4ec97 (diff)
parent2d37b00e24bfb1051e4a1d587bf766378d19e9b7 (diff)
downloadrust-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