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: Resolve doc links referring to macro_rules items #96521

Merged
merged 4 commits into from
May 1, 2022

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Apr 28, 2022

cc #81633

UPD: the fallback to considering all macro_rules in the crate for unresolved names is not removed in this PR, it will be removed separately and will be run through crater.

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 28, 2022
@rust-highfive
Copy link
Collaborator

r? @notriddle

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 28, 2022
@rust-log-analyzer

This comment was marked as resolved.

Copy link
Contributor

@notriddle notriddle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I like this change. Using the "real" name resolver, instead of dumping all the macro_rules into a big global hash map, is definitely a bug fix. The rustdoc name resolver should act like the regular one as much as is reasonable.

But (1) this is a breaking change, and (2) even though I was assigned to it, I'm still not really the best expert on this kind of change.

@@ -640,6 +640,8 @@ macro_rules! unreachable {
///
/// Like `panic!`, this macro has a second form for displaying custom values.
///
/// [`todo!`]: crate::todo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes like this imply the need for a Crater run and rel-notes tag. Right?

@petrochenkov
Copy link
Contributor Author

petrochenkov commented Apr 29, 2022

Only removal of the fn resolve_macro_rules fallback can cause a noticeable breakage here.
I can move it to a separate PR so it doesn't block landing the remaining changes here (I plan to do some more work on top of them).

@notriddle
Copy link
Contributor

Only removal of the fn resolve_macro_rules fallback can cause a noticeable breakage here. I can move it to a separate PR so it doesn't block landing the remaining changes here (I plan to do some more work on top of them).

That sounds great. I actually do want to land this change. It's just that we know there's going to be breakage, and we know docs.rs doesn't make warnings very visible, so anyone publishing there might not even notice.

@petrochenkov
Copy link
Contributor Author

we know docs.rs doesn't make warnings very visible, so anyone publishing there might not even notice

Then crater won't catch them either?
Only crates with deny(rustdoc::broken_intra_doc_links) will regress in both cases.

@notriddle
Copy link
Contributor

That's a good point. 😐

Is there any clear way to identify or mitigate the breakage here? I'd like to use a backcompat warning, but anyone using docs.rs won't actually see it. I thought maybe a crater run could be made with deny(rustdoc::broken_intra_doc_links) temporarily turned on by default, but that will probably surface a bunch of false positives.

Maybe a crater run with a tweaked version that, instead of making the fallback fill in a resolution, the "fallback" is tweaked to produce a hard error whenever it actually runs and resolves something?

@petrochenkov
Copy link
Contributor Author

Maybe a crater run with a tweaked version that, instead of making the fallback fill in a resolution, the "fallback" is tweaked to produce a hard error whenever it actually runs and resolves something?

Ok, that should be possible.

I'd like to use a backcompat warning, but anyone using docs.rs won't actually see it.

rustdoc::broken_intra_doc_links is already a warning, so reporting another warning saying that we are going to report this warning is a bit strange.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 29, 2022
@petrochenkov
Copy link
Contributor Author

Updated the PR, removal of the fn resolve_macro_rules fallback is reverted now.
@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 30, 2022
@GuillaumeGomez
Copy link
Member

So unless I missed something, we need a crater run here, right?

@petrochenkov
Copy link
Contributor Author

No, crater run is no longer needed.
It will be needed in the next PR that will attempt to remove the resolve_macro_rules fallback.

@GuillaumeGomez
Copy link
Member

Then let's go. Thanks!

@bors: r=notriddle,GuillaumeGomez

@bors
Copy link
Contributor

bors commented May 1, 2022

📌 Commit 6083db7 has been approved by notriddle,GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 1, 2022
@bors
Copy link
Contributor

bors commented May 1, 2022

⌛ Testing commit 6083db7 with merge 4dd8b42...

@bors
Copy link
Contributor

bors commented May 1, 2022

☀️ Test successful - checks-actions
Approved by: notriddle,GuillaumeGomez
Pushing 4dd8b42 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 1, 2022
@bors bors merged commit 4dd8b42 into rust-lang:master May 1, 2022
@rustbot rustbot added this to the 1.62.0 milestone May 1, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4dd8b42): comparison url.

Summary: This benchmark run did not return any relevant results.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

bors added a commit to rust-lang-ci/rust that referenced this pull request May 16, 2022
rustdoc: Remove doc link resolution fallback to all `macro_rules` in the crate

This is a deny-by-default lint detecting such fallback for crater run, as discussed in rust-lang#96521.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants