Hide warnings from Cargo downloaded subprojects #14035
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In Rust, the equivalent of -W/-D options can be added inside the sources themselves (
#[warn]
,#[deny]
) and therefore it's quite common for a crate to stop building with newer compilers.To avoid this, Cargo hides warnings from non-path dependencies using the special flag
--cap-lints allow
. Do the same for downloaded Cargo subprojects by addingwarning_level=0
to the generated subproject's default options. While warning_level=0 generally means "compiler default", Rust has always used it for the similar but inferior option-A warnings
, so just replace that with--cap-lints allow
.The question is what to do for pure-Meson Rust subprojects. Here I'm leaving them aside, because they can do the check themselves with
meson.is_subproject()
if they wanted and because in general I'm tending to treat pure-Meson Rust subprojects as if they follow more the C standards for diagnostics. Therefore I expect them to do something like "use werror when built from git and disable it for releases", or "use#[deny]
sparingly and rely more on#[warn]
and werror".