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 Nov 19, 2024

  1. Refactor stability structs

    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`.
    dianne committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    27dadd4 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 Nov 19, 2024
    Configuration menu
    Copy the full SHA
    459ff1b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    729ced5 View commit details
    Browse the repository at this point in the history
  4. Make unstable library feature errors translatable

    Translation is in an awkward position, but this provides a similar
    interface for both errors and soft-unstable lints, and enables the use
    of `DiagSymbolList` for simplifying error message construction.
    dianne committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    039e6de View commit details
    Browse the repository at this point in the history
  5. compiler: support multiple stability attributes on items

    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.
    
    This includes the clarified/fixed const-unstable semantics that were
    previously in a different commit.
    dianne committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    67f9341 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    e614f5e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c7968f0 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    a966f5e View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    edf10f8 View commit details
    Browse the repository at this point in the history
  10. Add sanity checks for reason and soft on unstable attributes

    `reason` must appear at most once: it's the reason for the item being unstable, rather than a
    particular feature. This simplifies diagnostic formatting.
    
    `soft` must either be on all or no unstable attributes: it 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.
    dianne committed Nov 19, 2024
    Configuration menu
    Copy the full SHA
    b23f28d View commit details
    Browse the repository at this point in the history