Skip to content

Mir: translation of Lvalue::ReturnPointer ICEs for functions without return type #30480

Closed
@nagisa

Description

@nagisa
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
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:330
stack backtrace:
   1:     0x7f09530f98de - sys::backtrace::tracing::imp::write::h7557e2ce169dfa4119t
   2:     0x7f09531009c5 - panicking::log_panic::closure.41813
   3:     0x7f0953100465 - panicking::log_panic::h56b78895bafbce42lhy
   4:     0x7f09530c78e3 - sys_common::unwind::begin_unwind_inner::h6d6c187a6f5c73b5X0s
   5:     0x7f09530c8267 - sys_common::unwind::begin_unwind_fmt::h4af1494f5de9b7cb3Zs
   6:     0x7f09530f7771 - rust_begin_unwind
   7:     0x7f095311283f - panicking::panic_fmt::h307c1afa6e9b377breJ
   8:     0x7f095310cd48 - panicking::panic::h00907b475580f497YcJ
   9:     0x7f0951b7bb87 - trans::mir::lvalue::MirContext<'bcx, 'tcx>::trans_lvalue::ha96b32c5da76fc05ruO
  10:     0x7f0951a90073 - trans::mir::trans_mir::h96dd1e8056a72b5clNN
  11:     0x7f0951a8a998 - trans::base::trans_closure::h9b514d50ac62ad26vdj
  12:     0x7f0951a92cbc - trans::base::trans_fn::h1126368745048aa2Enj
  13:     0x7f0951a97285 - trans::base::trans_item::ha15e0b1de8fab2e8rNj
  14:     0x7f0951aa38c0 - trans::base::trans_crate::h8f18fa6f69635785zzk
  15:     0x7f095362fe7a - driver::phase_4_translate_to_llvm::hc6d3ed6089be6c3e7Ua
  16:     0x7f0953629c17 - driver::phase_3_run_analysis_passes::closure.23288
  17:     0x7f0953607965 - middle::ty::context::ctxt<'tcx>::create_and_enter::h14213449263107283385
  18:     0x7f09536030c9 - driver::phase_3_run_analysis_passes::h13029203733993090974
  19:     0x7f09535e6c8d - driver::compile_input::h3952c7f29b895d23jca
  20:     0x7f0953748ecb - run_compiler::h1bb4927bc0bc5681Vyc
  21:     0x7f09537460f8 - sys_common::unwind::try::try_fn::h16299814252884817712
  22:     0x7f09530f75d8 - __rust_try
  23:     0x7f09530ee66b - sys_common::unwind::try::inner_try::h5a09ecc8aa81bdabvXs
  24:     0x7f0953746420 - boxed::F.FnBox<A>::call_box::h18362388286111528028
  25:     0x7f09530fec53 - sys::thread::Thread::new::thread_start::h66f81bdcccd0ead1yjx
  26:     0x7f094cdd74a3 - start_thread
  27:     0x7f0952d8c13c - clone
  28:                0x0 - <unknown>

This happens because functions like

fn nil(){}

have no return type, but rustc_trans::mir::lvalue::trans_lvalue unwraps the option when translating the ReturnPointer Lvalue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlI-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