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

Move missing_doc_code_examples lint behind its feature gate #112

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

thenorili
Copy link
Contributor

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.

Comment on lines 63 to 64
#![cfg_attr(feature = "rustdoc_missing_doc_code_examples",
warn(rustdoc::missing_doc_code_examples))]
Copy link

@jyn514 jyn514 Nov 5, 2023

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.

Copy link

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

Copy link

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

@thenorili
Copy link
Contributor Author

thenorili commented Nov 5, 2023 via email

@jyn514
Copy link

jyn514 commented Nov 5, 2023

feature = "nightly" will work if you add it explicitly to Cargo.toml :) people will still need to say cargo doc --features nightly though

@thenorili
Copy link
Contributor Author

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

@thenorili
Copy link
Contributor Author

Looks like I didn't run clippy, pardon me! I implemented the suggested change, pushing it now.

eyre/src/lib.rs Outdated Show resolved Hide resolved
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.
@yaahc yaahc merged commit 7fefca5 into eyre-rs:master Nov 7, 2023
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants