Skip to content

ICE: type mismatch comparing repeat and repeat #45044

Closed
@arielb1

Description

@arielb1

STR

$ rustc --version
rustc 1.22.0-nightly (185cc5f26 2017-10-02)
const X: [u8; 1] = [0; 1];

fn main() {
    match &X {
        &X => println!("a"),
        _ => println!("b"),
    };
}

Expected Result

code compiles and runs

Actual Result

warning: unreachable pattern
 --> x.rs:6:9
  |
6 |         &X => println!("a"),
  |         ^^
  |
  = note: #[warn(unreachable_patterns)] on by default

error: internal compiler error: type mismatch comparing Aggregate(Repeat(Const { ty: u8, val: Integral(U8(0)) }, 1)) and Aggregate(Repeat(Const { ty: u8, val: Integral(U8(0)) }, 1))
 --> x.rs:6:10
  |
6 |         &X => println!("a"),
  |          ^

error: aborting due to previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions