- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call 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) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Description
ICE occurs whether we use intrinsics::discriminant_value or mem::discriminant. cc #35118 #24263
STR
#![feature(core_intrinsics)]
#![feature(i128_type)]
#[repr(i128)]
enum Big { A, B }
fn main() {
    unsafe {
        println!("{} {:?}",
            std::intrinsics::discriminant_value(&Big::A),
            std::mem::discriminant(&Big::B));
    }
}ICE
thread 'rustc' panicked at 'assertion failed: bits <= 64', src/librustc_trans/adt.rs:368:4
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
   1: std::panicking::default_hook::{{closure}}
   2: std::panicking::default_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic_new
   5: rustc_trans::adt::load_discr
   6: rustc_trans::adt::trans_get_discr
   7: rustc_trans::intrinsic::trans_intrinsic_call
   8: rustc_trans::mir::block::<impl rustc_trans::mir::MirContext<'a, 'tcx>>::trans_terminator
   9: rustc_trans::mir::trans_mir
  10: rustc_trans::trans_item::TransItem::define
  11: rustc_trans::base::trans_crate::module_translation
  12: rustc_trans::base::trans_crate
  13: rustc_driver::driver::phase_4_translate_to_llvm
  14: rustc_driver::driver::compile_input::{{closure}}
  15: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
  16: rustc_driver::driver::phase_3_run_analysis_passes
  17: rustc_driver::driver::compile_input
  18: rustc_driver::run_compiler
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call 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) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️