Skip to content

Instantly share code, notes, and snippets.

@solson
Last active December 30, 2015 06:57
Show Gist options
  • Select an option

  • Save solson/04e9cbaa582fc34f32a1 to your computer and use it in GitHub Desktop.

Select an option

Save solson/04e9cbaa582fc34f32a1 to your computer and use it in GitHub Desktop.
error: internal compiler error: Type mismatch in function call of (i1 (i32*, i32*)*:
; Function Attrs: inlinehint uwtable
define internal zeroext i1 @_ZN3cmp5impls14i32.PartialOrd2le20h61123ef2ceb20e9d0HAE(i32* noalias readonly dereferenceable(4), i32* noalias readonly dereferenceable(4)) unnamed_addr #1 {
entry-block:
%self = alloca i32*
%other = alloca i32*
store i32* %0, i32** %self, align 8
store i32* %1, i32** %other, align 8
%2 = load i32*, i32** %self, align 8, !nonnull !0
%3 = load i32, i32* %2, align 4
%4 = load i32*, i32** %other, align 8, !nonnull !0
%5 = load i32, i32* %4, align 4
%6 = icmp sle i32 %3, %5
%7 = zext i1 %6 to i8
%8 = trunc i8 %7 to i1
ret i1 %8
}
). Expected i32* for param 0, got i32
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 'Box<Any>', src/libsyntax/errors/mod.rs:230
fn() -> () {
let tmp0: ();
let tmp1: &str;
let tmp2: i32;
let tmp3: bool;
let tmp4: bool;
bb0: {
tmp2 = 42;
tmp3 = core::cmp::PartialOrd::le(1, tmp2) -> [return: bb6, unwind: bb2];
}
bb1: {
return;
}
bb2: {
diverge;
}
bb3: {
tmp1 = Str("bugs");
goto -> bb8;
}
bb4: {
tmp1 = Str("bunny");
goto -> bb8;
}
bb5: {
tmp4 = core::cmp::PartialOrd::le(tmp2, 10) -> [return: bb7, unwind: bb2];
}
bb6: {
if(tmp3) -> [true: bb5, false: bb4];
}
bb7: {
if(tmp4) -> [true: bb3, false: bb4];
}
bb8: {
drop tmp1;
goto -> bb1;
}
}
#![feature(rustc_attrs)]
#[rustc_mir(pretty = "match-range.mir")]
fn main() {
match 42i32 {
// This arm generates MIR essentially equivalent to the following:
// tmp2 = 42i32;
// if <i32 as PartialOrd<i32>>::le(1i32, tmp2) &&
// <i32 as PartialOrd<i32>>::le(tmp2, 10i32) {
// "bugs"
// } else {
// "bunny"
// }
//
// The problem being that it uses `fn le(&i32, &i32) -> bool` with `i32` arguments. It
// should create `&i32` arguments.
1...10 => "bugs",
_ => "bunny",
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment