-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
[intra-doc links] Don't check feature gates of items re-exported across crates #82295
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b4326e5
to
58cc89e
Compare
I would expect us to check the features at definition time; if we're re-exporting from a crate then we can bypass the feature check IMO, rather than re-verifying. |
The problem is that this feature is checked in rustdoc, and rustdoc may not be run on the original crate. Consider a proc-macro that's re-exported into a facade crate, where only the facade is documented. |
Checking this in rustc instead of rustdoc would require moving intra-doc link parsing into rustc proper, which has other problems: #79542 |
Well, this isn't a very good example because rustdoc has to document the proc-macro, it won't be excluded by |
It seems like ultimately this doesn't help much then, because the feature gate can get omitted in the upstream crate (and not noticed as being actually required), and that causes downstream breakage during documentation building. Can we just leave the "loophole" open perhaps, and not check not-local definitions for using enabled features? |
The difference is that there's something the upstream crate can do to fix the breakage (enable the feature gate). Right now the upstream crate can't do anything and each individual crate re-exporting has to enable the feature gate themselves. Concretely, this means since |
This comment has been minimized.
This comment has been minimized.
…ss crates It should be never break another crate to re-export a public item. Note that this doesn't check the feature gate at *all* for other crates: - Feature-gates aren't currently serialized, so the only way to check the gate is with ad-hoc attribute checking. - Checking the feature gate twice (once when documenting the original crate and one when documenting the current crate) seems not great. This should still catch using the feature most of the time though, since people tend to document their own crates.
I reverted this, now it only checks items in the local crate. |
I believe Manish is on break to work on Vaccinate CA, so you probably want to re-assign this PR. |
@camelid do you have time to review? |
Probably not soon, and also this bug seems too tricky for me to feel comfortable reviewing a fix for. |
I'm not "on break" i'm just slower to do reviews, and prefer to not take on large tasks. This is probably okay |
@bors r+ |
📌 Commit fdb32e9 has been approved by |
Seems spurious:
@bors retry |
⌛ Testing commit fdb32e9 with merge c9905c59729e4ca0b67db0917344fea83c368cff... |
💔 Test failed - checks-actions |
😕 @rust-lang/infra do you know why this keeps failing? It's happened twice now. @bors retry |
@bors rollup=never |
☀️ Test successful - checks-actions |
Well, but I guess this is bad in general in case people use it in their own libraries. @rustbot label: +beta-nominated |
Backport approval checklist:
|
cc @rust-lang/rustdoc for backport decision |
[beta] backports This backports some beta-accepted PRs and one additional LLVM fix for s390x. - rustdoc: treat edition 2021 as unstable rust-lang#82207 - Fix popping singleton paths in when generating E0433 rust-lang#82259 - libtest: Fix unwrap panic on duplicate TestDesc rust-lang#82274 - [intra-doc links] Don't check feature gates of items re-exported across crates rust-lang#82295 - rustdoc: Remove duplicate "List of all items" rust-lang#82484 - Substitute erased lifetimes on bad placeholder type rust-lang#82494 - Revert LLVM D81803 because it broke Windows 7 rust-lang#82605 - [SystemZ] Assign the full space for promoted and split outgoing args. rust-lang/llvm-project#95 r? `@Mark-Simulacrum`
It should be never break another crate to re-export a public item.
Note that this doesn't check the feature gate at
all for other crates:
the gate is with ad-hoc attribute checking.
crate and one when documenting the current crate) seems not great.
This should still catch using the feature most of the time though, since
people tend to document their own crates.
Closes #82284.
r? @Manishearth