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

Clean up rustc_features #116437

Merged
merged 15 commits into from
Oct 7, 2023
Merged

Clean up rustc_features #116437

merged 15 commits into from
Oct 7, 2023

Commits on Oct 4, 2023

  1. Configuration menu
    Copy the full SHA
    53fe37d View commit details
    Browse the repository at this point in the history
  2. Remove set! macro.

    It has a single call site.
    nnethercote committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    043a987 View commit details
    Browse the repository at this point in the history
  3. Split declare_features!.

    It's a macro with four clauses, three of which are doing one thing, and
    the fourth is doing something completely different. This commit splits
    it into two macros, which is more sensible.
    nnethercote committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    3c1b60c View commit details
    Browse the repository at this point in the history
  4. Streamline find_lang_feature_issue.

    It currently processes `ACTIVE_FEATURES` separately from
    `ACCEPTED_FEATURES`, `REMOVED_FEATURES`, and `STABLE_REMOVED_FEATURES`,
    for no good reason. This commit treats them uniformly.
    nnethercote committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    1ddb287 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2023

  1. Add comments to config::features.

    I found this function very confusing, and it took me quite some time to
    work out what it was doing. These comments capture that hard-earned
    knowledge.
    nnethercote committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    e24f394 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9e2cd03 View commit details
    Browse the repository at this point in the history
  3. Inline and remove feature_removed function.

    It has a single call site. This increases consistency because other
    errors within `features` are emitted directly.
    nnethercote committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    5d9559e View commit details
    Browse the repository at this point in the history
  4. Merge STABLE_REMOVED_FEATURES list into REMOVED_FEATURES.

    There is a single features (`no_stack_check`) in
    `STABLE_REMOVED_FEATURES`. But the treatment of
    `STABLE_REMOVED_FEATURES` and `REMOVED_FEATURES` is actually identical.
    So this commit just merges them, and uses a comment to record
    `no_stack_check`'s unique "stable removed" status.
    
    This also lets `State::Stabilized` (which was a terrible name) be
    removed.
    nnethercote committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    8ba9137 View commit details
    Browse the repository at this point in the history
  5. Overhaul config::features.

    The new way of doing things:
    - Avoids some code duplication.
    - Distinguishes the `crate_edition` (which comes from `--edition`) and
      the `features_edition` (which combines `--edition` along with any
      `rustc_20XX_preview` features), which is useful.
    - Has a simpler initial loop, one that just looks for
      `rustc_20XX_preview` features in order to compute `features_edition`.
    - Creates a fallible alternative to `Features::enabled`, which is
      useful.
    
    It's not easy to see how exactly the old and new code are equivalent,
    but it's reassuring to know that the test coverage is quite good for
    this stuff.
    nnethercote committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    b229be0 View commit details
    Browse the repository at this point in the history
  6. Rename Features::active_features.

    The word "active" is currently used in two different and confusing ways:
    - `ACTIVE_FEATURES` actually means "available unstable features"
    - `Features::active_features` actually means "features declared in the
      crate's code", which can include feature within `ACTIVE_FEATURES` but
      also others.
    
    (This is also distinct from "enabled" features which includes declared
    features but also some edition-specific features automatically enabled
    depending on the edition in use.)
    
    This commit changes the `Features::active_features` to
    `Features::declared_features` which actually matches its meaning.
    Likewise, `Features::active` becomes `Features::declared`.
    nnethercote committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    4602d92 View commit details
    Browse the repository at this point in the history
  7. Rename Resolver::active_features.

    For the reasons described in the previous commit.
    nnethercote committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    eb20905 View commit details
    Browse the repository at this point in the history
  8. Record all declared features.

    Currently `rust_20XX_preview` features aren't recorded as declared even
    when they are explicit declared. Similarly, redundant edition-dependent
    features (e.g. `test_2018_feature`) aren't recorded as declared.
    
    This commit marks them as recorded. There is no detectable functional
    change, but it makes things more consistent.
    nnethercote committed Oct 5, 2023
    Configuration menu
    Copy the full SHA
    95d1aa0 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    56fd253 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    9d4e49b View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    81d1f7e View commit details
    Browse the repository at this point in the history