First discovered thanks to bevyengine/bevy#8898: There, the Output type of the cross-crate opaque impl FnMut(…) -> bool gets dropped by rustdoc resulting in impl FnMut(…). This specific bug is caused by rustdoc's opaque bound cleaner not realizing that it can & should utilize the Output assoc ty defined on FnMut's supertrait FnOnce. During further investigations I've discovered more bugs in this area.
In rustdoc there are two three major and distinct places where we resugar bounds. Both All three are flawed but each one exhibits different bugs.
Probably there are some more but less important bugs to be found (e.g. related to bound vars I can imagine).
I'm already deep in the weeds working on a correct & most general fix for this.
Opening this issue to keep the description of the future PR more slender.
@rustbot claim
@rustbot label C-bug T-rustdoc A-cross-crate-reexports
First discovered thanks to bevyengine/bevy#8898: There, the
Outputtype of the cross-crate opaqueimpl FnMut(…) -> boolgets dropped by rustdoc resulting inimpl FnMut(…). This specific bug is caused by rustdoc's opaque bound cleaner not realizing that it can & should utilize theOutputassoc ty defined onFnMut's supertraitFnOnce. During further investigations I've discovered more bugs in this area.In rustdoc there are
twothree major and distinct places where we resugar bounds.BothAll three are flawed but each one exhibits different bugs.clean_middle_opaque_boundsfor bounds of opaques (existential impl-Trait)TraitRefequality while we should also check the super predicates (incl. their substs tho!)clean_ty_genericsfor bounds in where-clauses and APIT (universal impl-Trait)DefIds (of traits) and never the relevant substs which is super incorrect leading rustdoc to move some projection predicates to unrelated trait boundsparam_env_to_genericsinauto_trait.rsfor where-clauses of synthetic implssimplify::{where_clauses,sized_bounds}in #123340simplify::merge_boundsat all unlike the other two placesTr<A = …>andTr<B = …>Fn-family traits are special-cased)Probably there are some more but less important bugs to be found (e.g. related to bound vars I can imagine).
I'm already deep in the weeds working on a correct & most general fix for this.
Opening this issue to keep the description of the future PR more slender.
@rustbot claim
@rustbot label C-bug T-rustdoc A-cross-crate-reexports