-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Deprecate doc(include)
#82539
Deprecate doc(include)
#82539
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,9 +64,12 @@ where | |
} | ||
|
||
macro_rules! declare_rustdoc_lint { | ||
($(#[$attr:meta])* $name: ident, $level: ident, $descr: literal $(,)?) => { | ||
($(#[$attr:meta])* $name: ident, $level: ident, $descr: literal | ||
$(, @future_incompatible = FutureIncompatibleInfo { $($field:ident : $val:expr),* $(,)* }; )? | ||
$(,)?) => { | ||
declare_tool_lint! { | ||
$(#[$attr])* pub rustdoc::$name, $level, $descr | ||
$(, @future_incompatible = FutureIncompatibleInfo { $($field : $val),* };)? | ||
} | ||
} | ||
} | ||
|
@@ -158,6 +161,22 @@ declare_rustdoc_lint! { | |
"detects URLs that could be written using only angle brackets" | ||
} | ||
|
||
declare_rustdoc_lint! { | ||
/// The `doc_include` lint detects when `#[doc(include = ...)]` is used. | ||
/// This feature is scheduled for removal and will give a hard error in a future release. | ||
/// | ||
/// This is a `rustdoc` only lint, see the documentation in the [rustdoc book]. | ||
/// | ||
/// [rustdoc book]: ../../../rustdoc/lints.html#non_autolinks | ||
DOC_INCLUDE, | ||
Warn, | ||
"detects using `#[doc(include = ...)]`", | ||
@future_incompatible = FutureIncompatibleInfo { | ||
reference: "issue #44732 <https://github.com/rust-lang/rust/issues/44732>", | ||
edition: None, | ||
}; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is such an overkill. If you need to guide people to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This will break half of docs.rs, because it uses nightly and a lot of people don't test their documentation on nightly before publishing. If you have a suggestion other than a new lint I'm happy to hear it but I really don't think a hard error is the way to go. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alternatively, those users that don't test their documentation on nightly are unlikely to see this warning; while they are likely to notice that their documentation fails to build on docs.rs and fix it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I grepped for For comparison, 348 of the latest versions use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a compromise would be to add a more general There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jyn514 I still suggest simply removing (FWIW, the numbers from criner look too large, it would be good to manually verify what those 348 uses are.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with @petrochenkov here (the important point here being that |
||
|
||
crate static RUSTDOC_LINTS: Lazy<Vec<&'static Lint>> = Lazy::new(|| { | ||
vec![ | ||
BROKEN_INTRA_DOC_LINKS, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#![crate_name = "inner"] | ||
#![feature(external_doc)] | ||
#[doc(include = "docs.md")] | ||
pub struct HasDocInclude {} | ||
pub struct NoDocs {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Here have some docs |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// aux-build:doc-include-deprecated.rs | ||
// check-pass | ||
#![feature(external_doc)] | ||
#![doc(include = "auxiliary/docs.md")] | ||
//~^ WARNING deprecated | ||
//~| WARNING hard error in a future release | ||
|
||
extern crate inner; | ||
|
||
pub use inner::HasDocInclude; | ||
|
||
#[doc(include = "auxiliary/docs.md")] | ||
//~^ WARNING deprecated | ||
//~| WARNING hard error in a future release | ||
pub use inner::HasDocInclude as _; | ||
|
||
#[doc(include = "auxiliary/docs.md")] | ||
//~^ WARNING deprecated | ||
//~| WARNING hard error in a future release | ||
pub use inner::NoDocs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link is incorrect: