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

Support multiple stability attributes on items #131824

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Commits on Oct 17, 2024

  1. move stability structs' feature fields into StabilityLevel::Unstable

    This is a refactor for supporting 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`.
    dianne committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    6f4aa4d View commit details
    Browse the repository at this point in the history
  2. 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.
    dianne committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    f559f57 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    487f740 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    42b461e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a8a36a9 View commit details
    Browse the repository at this point in the history
  6. 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.
    dianne committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    4a8a6cc View commit details
    Browse the repository at this point in the history
  7. 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.
    dianne committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    35fd749 View commit details
    Browse the repository at this point in the history
  8. use backticks instead of single quotes when reporting "use of unstabl…

    …e library feature `feature`"
    
    This is consistent with all other diagnostics I could find containing features and enables the use
    of `DiagSymbolList` for generalizing diagnostics for unstable library features to multiple features.
    dianne committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    8f284de View commit details
    Browse the repository at this point in the history
  9. 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
    dianne committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    2434969 View commit details
    Browse the repository at this point in the history
  10. rustc_const_eval: remove old FIXME, per review comment on previous PR

    At least one test relies on this behavior, so I think the description is still correct.
    dianne committed Oct 17, 2024
    Configuration menu
    Copy the full SHA
    14b8556 View commit details
    Browse the repository at this point in the history