Skip to content

EarlyOtherwiseBranch transformation is incorrect #78496

@tmiasko

Description

@tmiasko
Contributor

For details see #77163 (comment), opening an issue since PR was closed:

pub enum E<'a> {
    Empty,
    Some(&'a E<'a>),
}

fn f(e: &E) -> u32 {
   if let E::Some(E::Some(_)) = e { 1 } else { 2 }
}

fn main() {
   println!("{:?}", f(&E::Empty));
}
rustc b.rs -Zmir-opt-level=2 && ./b
"./b" terminated by signal SIGSEGV (Address boundary error)

Activity

added
A-mir-optArea: MIR optimizations
I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
requires-nightlyThis issue requires a nightly compiler in some way.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Oct 28, 2020
added a commit that references this issue on Dec 16, 2020

Rollup merge of rust-lang#79882 - wecing:master, r=oli-obk

c382492
added a commit that references this issue on Dec 16, 2020

Rollup merge of rust-lang#79882 - wecing:master, r=oli-obk

864d804
added a commit that references this issue on Dec 16, 2020

Rollup merge of rust-lang#79882 - wecing:master, r=oli-obk

bd93050
added a commit that references this issue on Dec 17, 2020

Rollup merge of rust-lang#79882 - wecing:master, r=oli-obk

a611f8d

15 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-mir-optArea: MIR optimizationsC-bugCategory: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @wecing@jonas-schievink@tmiasko

      Issue actions

        EarlyOtherwiseBranch transformation is incorrect · Issue #78496 · rust-lang/rust