-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Support multiple stability attributes on items #131824
base: master
Are you sure you want to change the base?
Commits on Nov 6, 2024
-
This moves stability structs' `feature` fields into `StabilityLevel::Unstable` and `ConstStabilityLevel::Unstable`, in preparation to support multiple unstable attributes on items. Seemingly, the `feature` field isn't used with the `StabilityLevel::Stable` variant, so I haven't included it. `rustc_passes::lib_features` uses the 'feature' meta-item for 'stable' attributes, but it extracts them itself, rather than relying on `rustc_attr`. In order to support the new const stability check rules, this additionally introduces `ConstStabilityLevel` and moves the case of `feature` being `None` to the `Implicit` variant for clarity; having it correspond to an empty `unstables` vec seems like it would be a footgun.
Configuration menu - View commit details
-
Copy full SHA for 9e13239 - Browse repository at this point
Copy the full SHA 9e13239View commit details -
factor out some commonalities in the
find_stability
family of funct……ions the logic for adding unstable attrs gets a bit messier when supporting multiple instances thereof. this keeps that from being duplicated in 3 places.
Configuration menu - View commit details
-
Copy full SHA for bbcb69a - Browse repository at this point
Copy the full SHA bbcb69aView commit details -
Configuration menu - View commit details
-
Copy full SHA for cf6adc1 - Browse repository at this point
Copy the full SHA cf6adc1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 3500be9 - Browse repository at this point
Copy the full SHA 3500be9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 7317353 - Browse repository at this point
Copy the full SHA 7317353View commit details -
find_stability
: don't give up when emitting "multiple stability lev……els" errors this makes things a little cleaner. since multiple stability levels are allowed, I think it makes sense too.
Configuration menu - View commit details
-
Copy full SHA for 8c7c0fa - Browse repository at this point
Copy the full SHA 8c7c0faView commit details -
support multiple stability attributes (a mix of stable and unstable)
An item is unstable if it has any unstable attributes, to make it easier to track which features library items depended on as they stabilize. This changes the text for E0544. Unfortunately, the example doesn't make much sense anymore. The way this merges stability levels together is made to work for stability-checking and rustdoc; as far as I can tell, only `rustc_passes::lib_features` needs them separate, and it extracts them itself.
Configuration menu - View commit details
-
Copy full SHA for 22fcdf9 - Browse repository at this point
Copy the full SHA 22fcdf9View commit details -
Improve diagnostics for the use of unstable library features
- only emits one error/lint (instead of one per missing feature) per usage of unstable and body-unstable items - only emits one future-name-collision lint (instead of one per missing feature) for unstable trait items - makes diagnostics for unstable, soft-unstable, const-unstable, and body-unstable library features translatable, using common subdiagnostic structs. - adds notes with features, reasons, and issue links to const-unstability errors - adds notes with issue links to soft_unstable lints - on nightly, adds `#![feature]` crate attr help to soft_unstable lints - on nightly, adds compiler-upgrade-suggestion notes to const-unstable and soft_unstable diagnostics
Configuration menu - View commit details
-
Copy full SHA for ac6041e - Browse repository at this point
Copy the full SHA ac6041eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3e86a5e - Browse repository at this point
Copy the full SHA 3e86a5eView commit details -
Configuration menu - View commit details
-
Copy full SHA for c4ac551 - Browse repository at this point
Copy the full SHA c4ac551View commit details -
Simplify unstable language feature use diagnostics
Reasons provided on `#[unstable]` attributes are now per-item rather than per-feature. This is how they mostly are used anyway, and it simplifies both the implementation and the diagnostics themselves.
Configuration menu - View commit details
-
Copy full SHA for de1fbaf - Browse repository at this point
Copy the full SHA de1fbafView commit details -
Add sanity check for inconsistent
soft
usage on soft-unstable itemsIt doesn't make sense for something to be partially soft, and allowing inconsistent softness markers would risk an item accidentally becoming properly unstable as its features stabilize.
Configuration menu - View commit details
-
Copy full SHA for ac1f9f7 - Browse repository at this point
Copy the full SHA ac1f9f7View commit details -
Suppress redundant listing of unstable library features used on nightly
On nightly, there's a suggestion/help containing the `#![feature(..)]` attribute required to enable any required unstable features, so the note listing the features is unnecessary. This only applies to const-unstable and default-body-unstable errors. Normal "use of unstable library feature" errors list the features in the error message, so it doesn't feel redundant.
Configuration menu - View commit details
-
Copy full SHA for d9915da - Browse repository at this point
Copy the full SHA d9915daView commit details -
Configuration menu - View commit details
-
Copy full SHA for b9af36e - Browse repository at this point
Copy the full SHA b9af36eView commit details