Closed
Description
Hello,
I am trying to implement this trait:
pub trait JsSerializable {
fn size(&self) -> u32;
fn ser(&self, cursor: &mut Cursor<Vec<u8>>) -> ();
}
impl JsSerializable for &'static Fn() -> (JsSerializable)
I get a compiler panic
thread 'main' panicked at 'assertion failed: !layout.is_unsized()', src\librustc_codegen_ssa\mir\place.rs:45:9
stack backtrace:
0: std::sys_common::alloc::realloc_fallback
1: std::panicking::take_hook
2: std::panicking::take_hook
3: <rustc::ty::sty::Binder<rustc::ty::ProjectionPredicate<'tcx>> as rustc::ty::ToPredicate<'tcx>>::to_predicate
4: std::panicking::rust_panic_with_hook
5: <rustc_codegen_llvm::llvm_::archive_ro::Iter<'a> as core::ops::drop::Drop>::drop
6: <rustc_codegen_llvm::llvm_::ffi::debuginfo::DIFlags as core::fmt::UpperHex>::fmt
7: <rustc_codegen_llvm::llvm_::ffi::debuginfo::DIFlags as core::fmt::UpperHex>::fmt
8: <rustc_codegen_llvm::back::lto::ThinLTOImports as core::fmt::Debug>::fmt
9: <rustc_codegen_llvm::base::ValueIter<'ll> as core::iter::iterator::Iterator>::next
10: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::join_codegen_and_link
11: <rustc_codegen_llvm::base::ValueIter<'ll> as core::iter::iterator::Iterator>::next
12: <rustc_codegen_llvm::back::lto::ThinLTOImports as core::fmt::Debug>::fmt
13: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
14: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
15: rustc_driver::driver::phase_4_codegen
16: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
17: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
18: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
19: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
20: rustc_driver::driver::compile_input
21: rustc_driver::run_compiler
22: <rustc_driver::profile::trace::Query as core::fmt::Debug>::fmt
23: rustc_driver::run_compiler
24: <humantime::duration::Error as std::error::Error>::cause
25: _rust_maybe_catch_panic
26: rustc_driver::profile::dump
27: rustc_driver::main
28: <unknown>
29: std::panicking::update_panic_count
30: _rust_maybe_catch_panic
31: std::rt::lang_start_internal
32: <unknown>
33: <unknown>
34: BaseThreadInitThunk
35: RtlUserThreadStart
query stack during panic:
end of query stack
error: internal compiler error: unexpected panic
I try to compile it for target=wasm32-unknown-unknown
note: rustc 1.32.0 (9fda7c2 2019-01-16) running on x86_64-pc-windows-msvc
note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib