mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
d2139834be
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`` |
||
---|---|---|
.. | ||
assembly | ||
auxiliary | ||
codegen | ||
codegen-units | ||
coverage-map | ||
debuginfo | ||
incremental | ||
mir-opt | ||
pretty | ||
run-coverage | ||
run-coverage-rustdoc | ||
run-make | ||
run-make-fulldeps | ||
run-pass-valgrind | ||
rustdoc | ||
rustdoc-gui | ||
rustdoc-js | ||
rustdoc-js-std | ||
rustdoc-json | ||
rustdoc-ui | ||
ui | ||
ui-fulldeps | ||
COMPILER_TESTS.md |