-
Notifications
You must be signed in to change notification settings - Fork 1.7k
incompatible_msrv doesn't respect #[cfg(version(...))] #14827
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
Comments
Was planning to quickly take care of that but Up for grabs for now, may take another look at it next week if nobody else does in the meanwhile |
I think as a simplification, we can treat As for Can be done via some recursive search. We are interested in the maximum number of this whole tree I guess, and use it as the MSRV of the whole block (if it's larger than the MSRV specified in Cargo.toml, if not then we take that one). @Alexendoo if you did a PR to check for plain |
Opened #14940, handling It picks the minimum version from the tree rather than maximum since that's the lowest version the code might be compiled with |
Great work, thank you! FWIW, I didn't want to make my comment above too complicated, but I think this heuristic would be better than always taking the minimum or always the maximum:
|
Would the lower version(s) in the maximum scenario ever be a useful |
Is the minimum scenario useful? Tbh I think 99% of uses will only have one |
Something like #[cfg(any(
version("1.100"),
all(feature = "hashbrown", version("1.90"))
))] could exist with further |
The
incompatible_msrv
lint doesn't recognize that code is gated by#[cfg(version(...))]
, and complains about the usage anyways.Take this code:
With this toml:
It will lint, even though the code is fine:
cc rust-lang/rust#64796
#[cfg(version(...))]
tracking issueThe text was updated successfully, but these errors were encountered: