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

feature request: #[feature] awareness in MSRV-gated lints #14477

Open
tamird opened this issue Mar 26, 2025 · 1 comment
Open

feature request: #[feature] awareness in MSRV-gated lints #14477

tamird opened this issue Mar 26, 2025 · 1 comment

Comments

@tamird
Copy link
Contributor

tamird commented Mar 26, 2025

Some lints, such as borrow_as_ptr have conditional behavior based on MSRV:

let (suggestion, span) = if msrv.meets(cx, msrvs::RAW_REF_OP) {

In Rust-for-Linux, this is not sufficient because we enable a number of unstable features when we are reasonably confident their behavior won't change before stabilization, or because we know they have been stabilized without API change in a version that exceeds our configured MSRV.

It would be extremely helpful if these MSRV checks could be taught to also respect #[feature] attributes that enable unstable features ahead of the MSRV having been met. This is especially tricky when API has actually changed between the configured MSRV and the feature's actual stabilization.

@ojeda
Copy link
Contributor

ojeda commented Mar 26, 2025

Cc Rust-for-Linux/linux#1152.

I assume this could work with a list of unstable features (or perhaps a list of lints that would ignore the msrv behavior).

In any case, if it is tricky to do this, then I guess we could for the time being avoid using the msrv field -- some notes at Rust-for-Linux/linux#1152 (comment). Eventually we will not use unstable features like today, so it is not a critical feature, but it would be nice to be able to use unstable features without having to lose the msrv feature.

because we enable a number of unstable features

To clarify, we also use a few others in https://github.com/Rust-for-Linux/linux/blob/e6ea10d5dbe082c54add289b44f08c9fcfe658af/rust/kernel/lib.rs#L15-L28 (and for derive_coerce_pointee we have to do it conditionally).

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

No branches or pull requests

2 participants