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

expect_unstable lint for feature instability assertions #13330

Open
onkoe opened this issue Sep 1, 2024 · 3 comments
Open

expect_unstable lint for feature instability assertions #13330

onkoe opened this issue Sep 1, 2024 · 3 comments
Labels
A-lint Area: New lints

Comments

@onkoe
Copy link

onkoe commented Sep 1, 2024

What it does

This lint notifies a user when a given feature is stable. It lets users mark blocks, items, and statements with an expectation: #[expect_unstable("some_unstable_feature")]

Configuration

  • follow-msrv: Whether the crate's MSRV should be considered when checking for this lint. If the feature is stable, but the MSRV is set to something lower than the stabilized version, the lint will not apply. (default: true)

Advantage

  • Avoids confusing (and difficult-to-track) TODOs and FIXMEs where unstable features would improve source code.
  • Allows users to get rid of manual checks in CI.
  • Refines project quality as Rust contributors refine the language.

Drawbacks

No response

Example

// FIXME: make sure to use `core::error::Error` when stable!
// i sure hope someone notices this after 1.81..!
use std::error::Error;

Could be written as:

#[expect_unstable("error_in_core")]
use std::error::Error;
@onkoe onkoe added the A-lint Area: New lints label Sep 1, 2024
@Jarcho Jarcho added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Sep 11, 2024
@Jarcho
Copy link
Contributor

Jarcho commented Sep 11, 2024

Just since I was confused when I read this the first time, this is intended to label code which is supposed to be changed once a feature becomes stable?

Nominated as this is related to a potential change to how we handle MSRVs.

@onkoe
Copy link
Author

onkoe commented Sep 11, 2024

@Jarcho Yes, you have it right! It's intended to alert users when unstable features are stabilized.

@Jarcho Jarcho added I-nominated Issue: Nominated to be discussed at the next Clippy meeting and removed beta-nominated Nominated for backporting to the compiler in the beta channel. I-nominated Issue: Nominated to be discussed at the next Clippy meeting labels Sep 17, 2024
@Jarcho
Copy link
Contributor

Jarcho commented Sep 19, 2024

Discussed this briefly at the last meeting. There were no objections to doing this. This won't need a config option for MSRV handling since #13416 would handle that in a more general way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints
Projects
None yet
Development

No branches or pull requests

2 participants