-
Notifications
You must be signed in to change notification settings - Fork 13.4k
redundant_explicit_links rustdoc lint should have macro guard #141553
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
Comments
|
cc @rust-lang/rustdoc Seems like this lint isn't actually new, but it started firing here anew? Not sure what's going on here. |
Tagging as a regression since it's an unsilenceable lint issue, in context. |
#136400 seems potentially relevant, if it affected this lint too. |
Ah, it probbaly made this lint trigger where it didn't before because the lint previously didn't handle macro fragments. Makes sense. The redundant links lint should just get a macro check, I think. |
Adding a fix. |
Maybe I talked too fast. After looking at it for way too long, I tried on this code: macro_rules! mac1 {
() => {
"provided by a [`BufferProvider`](crate::BufferProvider)."
};
}
macro_rules! mac2 {
() => {
#[doc = mac1!()]
pub struct BufferProvider;
}
}
#[doc = mac1!()]
pub struct Foo;
mac2!{} To check that both doc spans were from expansion... Except both are considered to not be from expansion. It comes from this. Removing this line breaks a few other things and make the output a bit less good, so I decided to instead check if the item itself was from expansion... and once again I'm deeply surprised to discover that Anyway, I'll try to take a deeper look to what I missed because I'm sure it's something obvious. |
I think we need to keep the "is expanded" information when converting the spans. Gonna give it a try tomorrow. |
On ICU4X main, with nightly,
cargo doc --all-features
inprovider/core
These docs are macro-generated, which means even if that import is around in some contexts, it isn't around in all of them, and we can't fix that in the macro.
https://github.com/unicode-org/icu4x/blob/f47044e3de1ba0c47a43b95968bd503902328188/provider/core/src/constructors.rs#L107
Given that they are macro generated docs, it is not possible to stick an
allow()
statement in the macro to silence the lint (without enabling attributes-on-expressions). So this code is permabroken.This lint should probably get a macro guard, or even be reverted until this can be figured out: the lint is mostly a cleanup lint and should not cause such problems.
The text was updated successfully, but these errors were encountered: