Closed
Description
Consider this code:
#![feature(no_core, lang_items,start)]
#![no_std]
#![no_core]
#[lang="sized"] trait Sized {}
#[lang="copy"] trait Copy {}
#[repr(u64)]
enum A {
A = 0u64,
B = !0u64,
}
fn cmp() -> A {
A::B
}
#[start]
fn main(b:isize, a: *const *const u8)->isize { 0 }
if compiled targetting i686
target, this ICEs with
error: internal compiler error: ../src/librustc_trans/mir/operand.rs:82: impossible case reached
This is because ABI code claims that this u64 enum has to be returned via value (i.e. ret i64 %smth
):
FnType { args: [], ret: ArgType { kind: Direct, original_ty: i64, ty: i64, signedness: Some(false), cast: None, ... }
Whereas MIR only has OperandRef(Ref(...))
because the common::is_immediate_type
returns false for this enum. Calling immediate()
on this OperandRef
then causes this ICE.
This is a regression from the old->MIR trans move.