Skip to content

Random ICE when playing with match #25579

Closed
@arielb1

Description

@arielb1

On Rust 1.0

#[derive(Debug)]
enum Sexpression {
  Id(String),
  Num(f64),
  Cons(Box<(Sexpression, Sexpression)>)
}

fn mutate_each_float<F>(l: &mut Sexpression, f: &mut F)
    where F: FnMut(&mut f64)
{
    let mut l = l;
    loop { match l {
        &mut Sexpression::Id(..) => {},
        &mut Sexpression::Num(ref mut n) => f(n),
        &mut Sexpression::Cons(ref mut expr) => {
            let &mut (ref mut car, ref mut cdr) = &mut **expr;
            mutate_each_float(cdr, f);
            l = car;
        }
    }}
}

fn main() {
}
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: `(left == right)` (left: `TyS { sty: ty_float(f64), flags: 0, region_depth: 0 }`, right: `TyS { sty: ty_uniq(TyS { sty: ty_tup([TyS { sty: ty_enum(DefId { krate: 0, node: 4 }, Substs { types: VecPerParamSpace {TypeSpace: [], SelfSpace: [], FnSpace: [], }, regions: NonerasedRegions(VecPerParamSpace {TypeSpace: [], SelfSpace: [], FnSpace: [], }) }), flags: 0, region_depth: 0 }, TyS { sty: ty_enum(DefId { krate: 0, node: 4 }, Substs { types: VecPerParamSpace {TypeSpace: [], SelfSpace: [], FnSpace: [], }, regions: NonerasedRegions(VecPerParamSpace {TypeSpace: [], SelfSpace: [], FnSpace: [], }) }), flags: 0, region_depth: 0 }]), flags: 0, region_depth: 0 }), flags: 0, region_depth: 0 }`)', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc_borrowck/borrowck/mod.rs:438

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions