Skip to content

error: internal compiler error: get_unique_type_id_of_type() - unexpected type: closure, ty_unboxed_closure #17454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
emk opened this issue Sep 22, 2014 · 1 comment

Comments

@emk
Copy link
Contributor

emk commented Sep 22, 2014

It's September 22, and I just download today's compiler using rustup.sh. I tried to compile this modified version of rust-replace-map, using FnOnce:

#![feature(unboxed_closures, overloaded_calls)]

//! Exposes `replace_map`, for replacing values at mutable memory locations.

use std::ptr;

/// Replace the value at a mutable memory location with the value
/// produced by the passed in closure.
///
/// Does not create an intermediate value, so is more efficient and
/// ergonomic in cases where producing a value to pass to mem::replace
/// is hard.
pub fn replace_map<'a, T, F>(src: &mut T, prod: F)
where F: FnOnce(T) -> T {
    // Read the value, pass it to prod, then write-over src.
    //
    // Safe because the value originally behind src is dropped
    // inside of prod and is then immediately written over.
    unsafe { *src = prod(ptr::read(src as *mut T as *const T)); }
}

#[test] fn test_works() {
    let mut a = 7u;
    let b = &mut a;

    replace_map(b, |: x: uint| x * 2);
    assert_eq!(*b, 14u);
}

…and got:

error: internal compiler error: get_unique_type_id_of_type() - unexpected type: closure, ty_unboxed_closure(syntax::ast::DefId{krate: 0u32, node: 67u32}, ReScope(64u32))
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:169

stack backtrace:
   1:     0x7ff33e8faf00 - rt::backtrace::imp::write::hb40e767174eadc9blLq
   2:     0x7ff33e8fe0c0 - failure::on_fail::hab6209505fea7a58N6q
   3:     0x7ff34300df80 - unwind::begin_unwind_inner::h3a7e8417aad82c7eMTd
   4:     0x7ff33f6a8450 - unwind::begin_unwind::h2392538768877619269
   5:     0x7ff33f6a8bc0 - diagnostic::Handler::bug::hbcf500f6b0a7b557wjF
   6:     0x7ff343660780 - driver::session::Session::bug::h0f635b08aa66c6feeQx
   7:     0x7ff343b05fa0 - middle::trans::debuginfo::TypeMap::get_unique_type_id_of_type::h233deb54704247ccivp
   8:     0x7ff343b0f6d0 - middle::trans::debuginfo::type_metadata::hb53e934b117efcaftOr
   9:     0x7ff343ab60a0 - middle::trans::debuginfo::create_function_debug_context::h7fc6b788d4b1d265rfq
  10:     0x7ff343a2fe60 - middle::trans::base::new_fn_ctxt::h611243317f012711AFe
  11:     0x7ff343aba2b0 - middle::trans::base::trans_closure::hd7b21130af57d114T6e
  12:     0x7ff343a00cf0 - middle::trans::base::trans_fn::hba6c6098eff914846hf
  13:     0x7ff343a013d0 - middle::trans::monomorphize::monomorphic_fn::h111314500f9ac8aadtY
  14:     0x7ff343a383a0 - middle::trans::callee::trans_fn_ref_with_substs::h927366ab2c3f6092XP1
  15:     0x7ff343a35cf0 - middle::trans::callee::trans_fn_ref::h6176864c3298571axE1
  16:     0x7ff343a3db50 - middle::trans::callee::trans_call::closure.123725
  17:     0x7ff343a16130 - middle::trans::callee::trans_call_inner::ha373276fc0d46583Fb2
  18:     0x7ff343a3d8b0 - middle::trans::callee::trans_call::ha3d5b5ce354777b1051
  19:     0x7ff343a4c630 - middle::trans::expr::trans_rvalue_dps_unadjusted::hf457bf80e76e66462i4
  20:     0x7ff343a0e5c0 - middle::trans::expr::trans_into::ha20572ab8748555eMV2
  21:     0x7ff343a0d9c0 - middle::trans::controlflow::trans_stmt_semi::h5634a3e832fd1190x3Y
  22:     0x7ff343a0d0e0 - middle::trans::controlflow::trans_stmt::h669538f418e4814fuZY
  23:     0x7ff343a0ea90 - middle::trans::controlflow::trans_block::h98e6c8ac340121b9q4Y
  24:     0x7ff343aba2b0 - middle::trans::base::trans_closure::hd7b21130af57d114T6e
  25:     0x7ff343a00cf0 - middle::trans::base::trans_fn::hba6c6098eff914846hf
  26:     0x7ff3439fe110 - middle::trans::base::trans_item::h13a70584bb385db8fBf
  27:     0x7ff343ac5510 - middle::trans::base::trans_crate::he94a02318e5d0e54kzg
  28:     0x7ff343ee6b90 - driver::driver::phase_4_translate_to_llvm::hfa5c9eb34e10ce6cchx
  29:     0x7ff343eddf50 - driver::driver::compile_input::h644c4bcdb8d4fa416Nw
  30:     0x7ff343f5fe40 - driver::run_compiler::hd9154f69e0f25652kFA
  31:     0x7ff343f5fd20 - driver::main_args::closure.146572
  32:     0x7ff34368fe70 - task::TaskBuilder<S>::try_future::closure.101814
  33:     0x7ff34368fc60 - task::TaskBuilder<S>::spawn_internal::closure.101785
  34:     0x7ff34335d540 - task::spawn_opts::closure.8457
  35:     0x7ff343064390 - rust_try_inner
  36:     0x7ff343064380 - rust_try
  37:     0x7ff34300b580 - unwind::try::haa9a6e4d3a3bf10cuId
  38:     0x7ff34300b3e0 - task::Task::run::h18e39631c20de002cYc
  39:     0x7ff34335d2b0 - task::spawn_opts::closure.8397
  40:     0x7ff34300cfd0 - thread::thread_start::hfdbefd9910b77f41rid
  41:     0x7ff33dcabdc0 - start_thread
  42:                0x0 - <unknown>
@emk
Copy link
Contributor Author

emk commented Sep 22, 2014

This appears to be a regression of #17021, on almost exactly the same code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant