You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rustdoc ignores traits implemented inside of a function #52545
After #51952 landed, I attempted to make Diesel compatible with recent nightlies by following the advice of wrapping the output in a function rather than a module. However, we are now unable to build our documentation. The compiler complains that every derived trait within Diesel is not implemented. This only occurs when running cargo doc, the crate otherwise compiles fine. I have tested with 1.26.1, stable, and the most recent nightly.
@Mark-Simulacrum Not sure the reasoning behind tagging things as regressions - this bug has been here for all time, it's just that the hygiene change has brought this to light. Rustdoc has never looked inside functions to document things, and the introduction of everybody-loops made that impossible anyway. To fix this, two things need to happen:
everybody-loops needs to be revamped to somehow exclude trait impls from being removed. Alternately, we can stop doing everybody-loops in rustdoc, but I don't think it's just there for performance. IIRC it was introduced to rustdoc when #[doc(cfg)] was, to prevent trying to resolve things on the wrong platform.
Rustdoc needs to start scanning inside functions for impl blocks. I fear this can start recursing arbitrarily deep, though - imagine a function with an impl, that contains a function with another impl, etc. However, i imagine in practice it won't be a problem.
At some point either rustdoc or everybody-loops needs to filter out types that are only in-scope for that function - rustdoc may already have an easier time at this, though, since it can just treat items declared inside functions to be the equivalent of #[doc(hidden)]. (Meaning that you'd need to use #[doc(no_hidden)] to reveal trait impls inside functions? Seems legit to me.)
I tag things as a regression mostly so that we can keep an eye on them; if we believe this isn't one we can of course untag. However, my reasoning in this case was that @sgrif indicated that Diesel changed in behavior, which feels like a regression to me, though I may have misunderstood.
From the issue description, it sounds like #51952 caused some new warnings to appear (i think? i haven't read too far into it), which @sgrif moved to fix. This caused an interaction with a long-standing behavior in rustdoc (always activating everybody-loops), which makes the crate fail to document. There's also this:
I have tested with 1.26.1, stable, and the most recent nightly.
Which makes me feel like if anything, it's a stable-to-stable regression.
Activity
GuillaumeGomez commentedon Jul 19, 2018
To fix it, I suppose we could "just" remove the "loop" feature of rustdoc but we'd have some huge performance loss...
Do not rebuild documentation
oli-obk commentedon Jul 26, 2018
@GuillaumeGomez can't you do the same trick you did for
dead_codeandunused_import? Or is this an error?QuietMisdreavus commentedon Jul 26, 2018
@Mark-Simulacrum Not sure the reasoning behind tagging things as regressions - this bug has been here for all time, it's just that the hygiene change has brought this to light. Rustdoc has never looked inside functions to document things, and the introduction of
everybody-loopsmade that impossible anyway. To fix this, two things need to happen:everybody-loopsneeds to be revamped to somehow exclude trait impls from being removed. Alternately, we can stop doingeverybody-loopsin rustdoc, but I don't think it's just there for performance. IIRC it was introduced to rustdoc when#[doc(cfg)]was, to prevent trying to resolve things on the wrong platform.At some point either rustdoc or
everybody-loopsneeds to filter out types that are only in-scope for that function - rustdoc may already have an easier time at this, though, since it can just treat items declared inside functions to be the equivalent of#[doc(hidden)]. (Meaning that you'd need to use#[doc(no_hidden)]to reveal trait impls inside functions? Seems legit to me.)Mark-Simulacrum commentedon Jul 26, 2018
I tag things as a regression mostly so that we can keep an eye on them; if we believe this isn't one we can of course untag. However, my reasoning in this case was that @sgrif indicated that Diesel changed in behavior, which feels like a regression to me, though I may have misunderstood.
ollie27 commentedon Jul 26, 2018
This looks like a duplicate of #36922 / #41480.
QuietMisdreavus commentedon Jul 26, 2018
From the issue description, it sounds like #51952 caused some new warnings to appear (i think? i haven't read too far into it), which @sgrif moved to fix. This caused an interaction with a long-standing behavior in rustdoc (always activating
everybody-loops), which makes the crate fail to document. There's also this:Which makes me feel like if anything, it's a
stable-to-stableregression.9 remaining items
Rollup merge of rust-lang#53002 - QuietMisdreavus:brother-may-i-have-…
Auto merge of #53002 - QuietMisdreavus:brother-may-i-have-some-loops,…
QuietMisdreavus commentedon Aug 7, 2018
I've opened #53162 to make those trait impls show up in documentation.
Auto merge of #53162 - QuietMisdreavus:crouching-impl-hidden-trait, r…
Rollup merge of rust-lang#53162 - QuietMisdreavus:crouching-impl-hidd…
Rollup merge of rust-lang#53162 - QuietMisdreavus:crouching-impl-hidd…