Skip to content

(nightly) internal compiler error: union fields that need dropping should be impossible #99375

Description

@papricasix

While compiling rlua using a nightly build of rust, I triggered the following bug (in https://github.com/amethyst/rlua/blob/10c95b7ffa8ad1a64f755a05c7cf806211f3f27f/src/util.rs#L129):

Code

    unsafe extern "C" fn do_call<F, R>(state: *mut ffi::lua_State) -> c_int
    where
        R: Copy,
        F: Fn(*mut ffi::lua_State) -> R,
    {
        let params = ffi::lua_touserdata(state, -1) as *mut Params<F, R>;
        ffi::lua_pop(state, 1);

        (*params).result.init = ((*params).function)(state);

        if (*params).nresults == ffi::LUA_MULTRET {
            ffi::lua_gettop(state)
        } else {
            (*params).nresults
        }
    }

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (d5e7f4782 2022-07-16)
binary: rustc
commit-hash: d5e7f4782e4b699728d0a08200ecd1a54d56a85d
commit-date: 2022-07-16
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6

Error output

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: union fields that need dropping should be impossible
   --> /home/micha/.cargo/registry/src/github.com-1ecc6299db9ec823/rlua-0.19.2/src/util.rs:129:9
    |
129 |         (*params).result.init = ((*params).function)(state);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: delayed at compiler/rustc_mir_transform/src/check_unsafety.rs:227:39

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1425:13
Backtrace

stack backtrace:
   0:     0x7fca884a3710 - std::backtrace_rs::backtrace::libunwind::trace::he2b7f064c6c8ebd8
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7fca884a3710 - std::backtrace_rs::backtrace::trace_unsynchronized::h6c5848816085cb4d
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fca884a3710 - std::sys_common::backtrace::_print_fmt::h05ef0be136010689
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fca884a3710 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h10c19668734af2a3
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fca884fd81c - core::fmt::write::hb483b6baf6f08a60
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/core/src/fmt/mod.rs:1198:17
   5:     0x7fca88494b75 - std::io::Write::write_fmt::hf77bd6f7d58fef0e
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/io/mod.rs:1672:15
   6:     0x7fca884a63e1 - std::sys_common::backtrace::_print::h03f34c62e5bfdc80
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fca884a63e1 - std::sys_common::backtrace::print::he0f61808579de256
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fca884a63e1 - std::panicking::default_hook::{{closure}}::h03e5cc363b5f6eb0
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/panicking.rs:295:22
   9:     0x7fca884a60b3 - std::panicking::default_hook::h2bb8a9d1f237276a
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/panicking.rs:314:9
  10:     0x7fca88d4f7f1 - rustc_driver[8f049ba7ec2fe4e]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fca884a6bb6 - std::panicking::rust_panic_with_hook::h2b6418ec29aa433e
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/panicking.rs:702:17
  12:     0x7fca89f27531 - std[c33fd1b84eff1e1b]::panicking::begin_panic::<rustc_errors[2e7ae59e55ccb0de]::ExplicitBug>::{closure#0}
  13:     0x7fca89f272c6 - std[c33fd1b84eff1e1b]::sys_common::backtrace::__rust_end_short_backtrace::<std[c33fd1b84eff1e1b]::panicking::begin_panic<rustc_errors[2e7ae59e55ccb0de]::ExplicitBug>::{closure#0}, !>
  14:     0x7fca89f210c6 - std[c33fd1b84eff1e1b]::panicking::begin_panic::<rustc_errors[2e7ae59e55ccb0de]::ExplicitBug>
  15:     0x7fca89f243b6 - std[c33fd1b84eff1e1b]::panic::panic_any::<rustc_errors[2e7ae59e55ccb0de]::ExplicitBug>
  16:     0x7fca8b81c0e3 - <rustc_errors[2e7ae59e55ccb0de]::HandlerInner as core[8559c76fbb49d2ec]::ops::drop::Drop>::drop
  17:     0x7fca8af46cab - core[8559c76fbb49d2ec]::ptr::drop_in_place::<rustc_session[f28dbaef20431e1d]::parse::ParseSess>
  18:     0x7fca8af491e3 - <alloc[34fcb9634b68b8d8]::rc::Rc<rustc_session[f28dbaef20431e1d]::session::Session> as core[8559c76fbb49d2ec]::ops::drop::Drop>::drop
  19:     0x7fca8af2b64d - core[8559c76fbb49d2ec]::ptr::drop_in_place::<rustc_interface[d0628200c9d01d52]::interface::Compiler>
  20:     0x7fca8af29804 - rustc_span[1b79d0b79e871695]::with_source_map::<core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>, rustc_interface[d0628200c9d01d52]::interface::create_compiler_and_run<core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>, rustc_driver[8f049ba7ec2fe4e]::run_compiler::{closure#1}>::{closure#1}>
  21:     0x7fca8af45aa0 - rustc_interface[d0628200c9d01d52]::interface::create_compiler_and_run::<core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>, rustc_driver[8f049ba7ec2fe4e]::run_compiler::{closure#1}>
  22:     0x7fca8af59be2 - <scoped_tls[1595f96802d8f51d]::ScopedKey<rustc_span[1b79d0b79e871695]::SessionGlobals>>::set::<rustc_interface[d0628200c9d01d52]::interface::run_compiler<core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>, rustc_driver[8f049ba7ec2fe4e]::run_compiler::{closure#1}>::{closure#0}, core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>>
  23:     0x7fca8af2bbcf - std[c33fd1b84eff1e1b]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d0628200c9d01d52]::util::run_in_thread_pool_with_globals<rustc_interface[d0628200c9d01d52]::interface::run_compiler<core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>, rustc_driver[8f049ba7ec2fe4e]::run_compiler::{closure#1}>::{closure#0}, core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>>::{closure#0}, core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>>
  24:     0x7fca8af45ef9 - <<std[c33fd1b84eff1e1b]::thread::Builder>::spawn_unchecked_<rustc_interface[d0628200c9d01d52]::util::run_in_thread_pool_with_globals<rustc_interface[d0628200c9d01d52]::interface::run_compiler<core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>, rustc_driver[8f049ba7ec2fe4e]::run_compiler::{closure#1}>::{closure#0}, core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>>::{closure#0}, core[8559c76fbb49d2ec]::result::Result<(), rustc_errors[2e7ae59e55ccb0de]::ErrorGuaranteed>>::{closure#1} as core[8559c76fbb49d2ec]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7fca884b0923 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6d78f1dcc4e189b8
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/alloc/src/boxed.rs:1935:9
  26:     0x7fca884b0923 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc462dd82c109fc34
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/alloc/src/boxed.rs:1935:9
  27:     0x7fca884b0923 - std::sys::unix::thread::Thread::new::thread_start::h671a7ad89d56ef6e
                               at /rustc/d5e7f4782e4b699728d0a08200ecd1a54d56a85d/library/std/src/sys/unix/thread.rs:108:17
  28:     0x7fca8808c54d - <unknown>
  29:     0x7fca88111874 - clone
  30:                0x0 - <unknown>

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.64.0-nightly (d5e7f4782 2022-07-16) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C linker=clang -C link-arg=-fuse-ld=lld -Z share-generics=y -C link-arg=-Wl,--no-rosegment

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `rlua`

Activity

  1. added
    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.
    on Jul 17, 2022
  2. changed the title [-]internal compiler error: union fields that need dropping should be impossible[/-] [+](nightly) internal compiler error: union fields that need dropping should be impossible[/+] on Jul 17, 2022
  3. carbotaniuman commented on Jul 17, 2022

    @carbotaniuman
    Contributor

    This looks related to #97995.

  4. added 2 commits that reference this issue on Jul 18, 2022
    ab0b75d
    3147392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

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