Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustdoc: Downstream implementors are not linked to #78615

Closed
camelid opened this issue Oct 31, 2020 · 13 comments
Closed

rustdoc: Downstream implementors are not linked to #78615

camelid opened this issue Oct 31, 2020 · 13 comments
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@camelid
Copy link
Member

camelid commented Oct 31, 2020

Rustdoc doesn't link to implementors of a trait where the implementors are in a downstream crate; e.g., rustc_middle::mir::visit::Visitor:

image

I would think this is a limitation related to #74481, but the implementors are listed, they just aren't linked to, so I'm not sure what the cause is.

@camelid camelid added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-trait-system Area: Trait system C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Oct 31, 2020
@jyn514
Copy link
Member

jyn514 commented Nov 1, 2020

I think this is a duplicate of #76736.

@jyn514
Copy link
Member

jyn514 commented Nov 1, 2020

If you can reproduce outside of rustc, that's a bug though.

@camelid
Copy link
Member Author

camelid commented Nov 1, 2020

I can reproduce it in a private project, but I'd rather not share the sources. I'll see if I can get an MCVE.

camelid added a commit to camelid/rust-issue-78615 that referenced this issue Nov 1, 2020
@camelid
Copy link
Member Author

camelid commented Nov 1, 2020

@jyn514
Copy link
Member

jyn514 commented Nov 1, 2020

The code from that repo:

// crate a
pub trait MyTrait {}

pub struct MyLocalStruct;

impl MyTrait for MyLocalStruct {}

// crate b
use crate_a::MyTrait;

pub struct MyStruct;

impl MyTrait for MyStruct {}

@camelid
Copy link
Member Author

camelid commented Nov 1, 2020

Yeah, I just wanted to provide a repo that you can just clone and build to reproduce :)

@camelid
Copy link
Member Author

camelid commented Nov 1, 2020

Weirdly, the issue seems to be spurious: Sometimes I see impl MyTrait for MyStruct in the "Implementors" list, sometimes I see nothing.

EDIT: Never mind, I was sometimes running with --document-private-items. I'll make MyStruct public to fix this.

@camelid
Copy link
Member Author

camelid commented Nov 1, 2020

The output for camelid/rust-issue-78615@3dfc5ea:

image

@camelid
Copy link
Member Author

camelid commented Nov 1, 2020

This partially worked as of nightly-2020-04-08:

image

Note that MyTrait is linked to for the MyStruct impl, but not for the MyLocalStruct impl. Also note that there is only a source link for MyLocalStruct.

@camelid camelid added C-bug Category: This is a bug. and removed C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Nov 1, 2020
@camelid
Copy link
Member Author

camelid commented Nov 1, 2020

searched nightlies: from nightly-2019-01-01 to nightly-2020-11-01
regressed nightly: nightly-2020-07-31
searched commits: from db0492a to cfc572c
regressed commit: 6b269e4

bisected with cargo-bisect-rustc v0.6.0

Host triple: x86_64-apple-darwin
Reproduce with:

cargo bisect-rustc --preserve --prompt --start=2019-01-01 -- doc 

This was caused by #73767.

@camelid camelid added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Nov 1, 2020
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Nov 1, 2020
@camelid camelid changed the title rustdoc: Link to downstream implementors rustdoc: Links to downstream implementors are broken Nov 1, 2020
@camelid camelid changed the title rustdoc: Links to downstream implementors are broken rustdoc: Downstream implementors are not linked to Nov 1, 2020
@camelid
Copy link
Member Author

camelid commented Nov 1, 2020

I think this is unrelated, but I want to note that running cargo doc after making MyStruct private still shows it as an implementor. You have to run cargo clean to get it to go away.

I'm guessing this is because rustdoc isn't re-documenting crate_a when crate_b changes and thus it has stale data?

Interestingly, though, the reverse is not true: making MyStruct public and then running cargo doc will show it in the output... Some weird state bug I guess 🤷

@camelid camelid added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Nov 1, 2020
@camelid
Copy link
Member Author

camelid commented Nov 1, 2020

cc @rust-lang/rustdoc

@camelid
Copy link
Member Author

camelid commented Nov 6, 2021

This appears to be fixed now, both in the rustc API docs and my MCVE! 🎉

@camelid camelid closed this as completed Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system C-bug Category: This is a bug. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants