Closed xu-cheng closed 3 years ago
forbid
is opt-in and basically means "if rustc adds a new warning or an external macro allows lint, a previously released version may not compile". (forbid(unsafe_code)
has another meaning)
And basically, most macros do not guarantee compatibility with forbid
, as lints warn of accidentally (or intentionally) macro-generated code. (In pin-project/pin-project-lite, the only exception is forbid(unsafe_code)
, because compatibility with forbid(unsafe_code)
has another meaning.)
So, as long as there is good reason to allow that lint, I believe this is a problem on the part of the user using forbid
.
FYI: allow(explicit_outlives_requirements)
(added in 0.1.9) is needed to silence rustc's warning on macro-generated code. (Without this, you would have to write #![allow(...)]
at the module level to allow explicit_outlives_requirements
.)
Closing in favor of https://github.com/http-rs/surf/issues/244.
This will be fixed in https://github.com/http-rs/surf/pull/245
forbid is opt-in and basically means "if rustc adds a new warning or an external macro allows lint, a previously released version may not compile"
The "rust 2018" idioms lint should only be cover the rules introduced for the 2018 edition; the plan as I understood it was that during the 2018 edition these opt-in lints would gradually become warnings out of the box. And in the next edition these will become hard errors and disallowed.
Reality is a bit more fluid, and it's unclear what exactly will happen in the 2021 edition. But unless I'm mistaken, the set of rules covered by rust_2018_idioms
was pretty much defined at the start of the 2018 edition, and we don't need to worry about more lints being added to it.
But unless I'm mistaken, the set of rules covered by
rust_2018_idioms
was pretty much defined at the start of the 2018 edition, and we don't need to worry about more lints being added to it.
"Add a new warning" does not mean "Add a new lint". It includes adding warnings to existing lint.
For example:
explicit_outlives_requirements
had a large number of false positives / false negatives at the 1.31, which were significantly improved at 1.37 (https://github.com/rust-lang/rust/pull/61172).unused_imports
did not previously warn redundant imports, but now it can. (https://github.com/rust-lang/rust/pull/58805)Both are "improvements to existing lint", but they are also "adds warnings". So crates released with forbid
/deny
prior to these improvements might not compile with rustc version that contains these improvements.
And in the next edition these will become hard errors and disallowed.
If I remember correctly, this should only happen in parts of rust_2018_idioms
, not all.
So crates released with forbid/deny prior to these improvements might not compile with rustc version that contains these improvements.
Ah yeah, that's very fair. I think you're right that these lints should have been warn
all along; I was wrong in my assumptions around them.
To reproduce the problem, create a new cargo project with the following dependencies:
Run
cargo check
. It will report the following error: