-
Notifications
You must be signed in to change notification settings - Fork 70
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
Move missing_doc_code_examples lint behind its feature gate #112
Conversation
color-spantrace/src/lib.rs
Outdated
#![cfg_attr(feature = "rustdoc_missing_doc_code_examples", | ||
warn(rustdoc::missing_doc_code_examples))] |
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 doesn't actually work. feature = "..."
is a cargo thing, which is different from "nightly features" (the thing it was erroring about).
afaik the only way to do this like you expect is with hacks like compiling a file in build.rs to see if it supports nightly features, or by manually making people say cargo doc --features rustdoc_missing_doc_code_examples
.
you should ask jane if she prefers that latter thing, saying people have to use nightly to document (and adding #![feature()]
unconditionally), or just removing the warning altogether.
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.
some more context - this is what cargo means by "feature" https://doc.rust-lang.org/cargo/reference/features.html
and this is what rustc means https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
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.
oh, one last option is to add this warning in CI only with -Z crate-attr
, but that would be kind of annoying for people building locally since cargo doc
won't show as many warnings as CI
I've seen examples of feature = "nightly", would that not work instead? I
figured that a specific feature gate would be preferable, thanks for
sharing the distinction between cargo and rustc features :]
…On Sun, Nov 5, 2023, 5:00 AM jyn ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In color-spantrace/src/lib.rs
<#112 (comment)>:
> +#![cfg_attr(feature = "rustdoc_missing_doc_code_examples",
+ warn(rustdoc::missing_doc_code_examples))]
this doesn't actually work. feature = "..." is a cargo thing, which is
different from "nightly features" (the thing it was erroring about).
afaik the only way to do this like you expect is with hacks like compiling
a file in build.rs to see if it supports nightly features, or by manually
making people say cargo doc --features rustdoc_missing_doc_code_examples.
you should ask jane if she prefers that latter thing, saying people have
to use nightly to document (and adding #![feature()], or just removing
the warning altogether.
—
Reply to this email directly, view it on GitHub
<#112 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMCVFGQIOYRYYNFGVCKVEYTYC55UHAVCNFSM6AAAAAA66IVJOSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOMJTHE4DAOJUGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
3067f79
to
b01a5af
Compare
I've updated the review with an expansion of the existing build script that definitely checks for nightly and a couple small tests to validate that it's working. No new dependencies by the way! @pksunkara I saw you'd agreed with jyn's critique! I hope you find this update satisfactory :D |
b01a5af
to
f499e2f
Compare
Looks like I didn't run clippy, pardon me! I implemented the suggested change, pushing it now. |
The rustdoc_missing_doc_code_examples lint has been sending warnings and causing CI issues due to being an unstable feature. This change introduces a small build script that detects whether the current toolchain is nightly and, if so, sets the config option "nightly_features". This config option then sets the feature gate for missing_doc_code_examples and turns on 'warn'. It expands the existing code for parsing minor version to parse the rest of the rust --version. This change also introduces a toolchain test that uses rust_version to double-check that the config option was enabled IFF the nightly toolchain is being used.
f499e2f
to
a4666ca
Compare
CI has been failing due to using the nightly-only
rustdoc_missing_doc_code_examples lint unconditionally.
This moves it behind its feature gate and removes many warnings due to unknown lint.