mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-03 09:32:42 +00:00
rustdoc: Only build extern trait impls if needed or, finally remove the `BadImplStripper`! Building inlined impls is expensive, and most of them end up being unneeded and stripped later in this function. So we should filter them ahead of time. This requires inlining external auto traits when we construct auto impls, since this no longer happens as a side effect. We inline external impls when they are * for generics (i.e., blanket impls) * for primitive types (probably this should be handled below really) * for a type (inlined) in the current crate * of a trait (inlined) in the current crate * of `Deref` These rules are based on the existing filtering rules that are applied after building the inlined impls. After doing the filtering ahead of time, we can remove the downstream filtering. Thus, we can finally remove `BadImplStripper` and unused deref-following logic. It appears that all this `Deref` logic was pointless in the first place since following derefs already happens elsewhere in rustdoc, where it is actually needed.