-
Notifications
You must be signed in to change notification settings - Fork 635
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
Deny warnings for doc tests #1672
Conversation
@@ -397,9 +405,8 @@ pub trait FutureExt: Future { | |||
/// | |||
/// # Examples | |||
/// | |||
// TODO: minimize and open rust-lang/rust ticket, currently errors: | |||
// 'assertion failed: !value.has_escaping_regions()' |
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.
Also, this seems to have already been fixed.
Could we maybe bypass it by setting |
I'll try it. UPDATE: |
I found this while looking through the rustdoc source trying to figure out why #![doc(test(attr(deny(warnings))))] adding that at the crate root will inject the contained attribute into all tests automatically. EDIT: Although that has what I consider the wrong semantics still, there's no way to trigger it from just CI, it will make the examples fail when building locally. The only workaround I can think of is to use something like |
@Nemo157 Thanks for finding it out.
It seems that it also denies the lints that rustdoc allows by default, so I feel that it is better to allow #![doc(test(attr(deny(warnings), allow(dead_code, unused_assignments, unused_variables))))] I also agree that it is preferable to deny everywhere until it's possible to run the lints against them independently. |
7babf7d
to
e527030
Compare
Nice! Thanks to both of you for the investigation and the fixes. |
515: Deny warnings for doc tests r=jeehoonkang a=taiki-e There are some unused imports/`mut`s. Refs: rust-lang/futures-rs#1672, tokio-rs/tokio#1539 Co-authored-by: Taiki Endo <[email protected]>
We cleaned this up with some PRs (#1590, #1381, etc.),
so we are not warned at the moment, but it will be useful to maintain the quality of the examples. (EDIT: I missedunused
being allowed by default.)It would have been nice if this was supported as a
cargo doc
orclippy
option (maybe likecargo doc --test -- --Dwarnings
?), but it does not seem to be supported yet (rust-lang/rust#56232).