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

Fix variant index / discriminant confusion in uninhabited enum branching #89764

Merged
merged 3 commits into from
Jan 20, 2022

Commits on Nov 20, 2021

  1. Remove redundant check for promoteds

    For some time CTFE has been using a dedicated MIR which is never
    optimized, so the check for promoted became redundant.
    tmiasko committed Nov 20, 2021
    Configuration menu
    Copy the full SHA
    763703c View commit details
    Browse the repository at this point in the history
  2. Use IndexVec::indices instead of reimplementing it

    The change is limited to the iteration over indices instead of using
    `basic_blocks_mut()` directly, in the case the previous implementation
    intentionally avoided invalidating the caches stored in MIR body.
    tmiasko committed Nov 20, 2021
    Configuration menu
    Copy the full SHA
    d5a91f3 View commit details
    Browse the repository at this point in the history
  3. Fix a variant index and variant discriminant confusion

    Previously for enums using the `Variants::Single` layout, the variant
    index was being confused with its discriminant. For example, in the case
    of `enum E { A = 1 }`.
    
    Use `discriminant_for_variant` to avoid the issue.
    tmiasko committed Nov 20, 2021
    Configuration menu
    Copy the full SHA
    c3e71d8 View commit details
    Browse the repository at this point in the history