Closed as not planned
Closed as not planned
Description
When using shred-derive to #[derive(SystemData)]
, I am encountering this error:
error: internal compiler error: librustc/traits/codegen/mod.rs:169: Encountered errors `[FulfillmentError(Obligation(predicate=Binder(TraitPredicate(<Thing as std::default::Default>)),depth=2),Unimplemented)]` resolving bounds after type-checking
Implementing Default
for Thing
does allow the program to compile.
I tried this code:
src/lib.rs:
extern crate specs;
extern crate shred;
#[macro_use] extern crate shred_derive;
use specs::prelude::*;
struct Thing;
#[derive(SystemData)]
struct Container<'a> {
current_scene: Write<'a, Thing>,
}
Cargo.toml:
[package]
name = "test"
version = "0.1.0"
[lib]
name = "test"
path = "src/lib.rs"
[dependencies]
specs = "0.11"
shred = "0.7"
shred-derive = "0.5"
specs-derive = "0.2"
I expected to see this happen: Compile (or at least a compile error)
Instead, this happened: Compiler panicked!
Meta
rustc 1.28.0-nightly (952f344cd 2018-05-18)
binary: rustc
commit-hash: 952f344cdc0bca58d9f6c54dcfbae0890246e886
commit-date: 2018-05-18
host: x86_64-unknown-linux-gnu
release: 1.28.0-nightly
LLVM version: 6.0
Backtrace:
thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:499:9
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
1: std::sys_common::backtrace::print
at libstd/sys_common/backtrace.rs:71
at libstd/sys_common/backtrace.rs:59
2: std::panicking::default_hook::{{closure}}
at libstd/panicking.rs:211
3: std::panicking::default_hook
at libstd/panicking.rs:227
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at libstd/panicking.rs:467
6: std::panicking::begin_panic
7: rustc_errors::Handler::span_bug
8: rustc::session::opt_span_bug_fmt::{{closure}}
9: rustc::ty::context::tls::with_opt::{{closure}}
10: rustc::ty::context::tls::with_context_opt
11: rustc::ty::context::tls::with_opt
12: rustc::session::opt_span_bug_fmt
13: rustc::session::span_bug_fmt
14: rustc::traits::codegen::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::drain_fulfillment_cx_or_panic
15: rustc::ty::context::tls::with_related_context
16: rustc::traits::codegen::codegen_fulfill_obligation
17: rustc::ty::maps::<impl rustc::ty::maps::config::QueryConfig<'tcx> for rustc::ty::maps::queries::codegen_fulfill_obligation<'tcx>>::compute
18: rustc::ty::context::tls::with_context
19: rustc::dep_graph::graph::DepGraph::with_task_impl
20: rustc::ty::context::tls::with_related_context
21: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
22: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
23: rustc::ty::instance::Instance::resolve
24: <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator_kind
25: rustc_mir::monomorphize::collector::collect_items_rec
26: rustc_mir::monomorphize::collector::collect_crate_mono_items
27: rustc::util::common::time
28: rustc_codegen_llvm::base::collect_and_partition_mono_items
29: rustc::ty::context::tls::with_context
30: rustc::dep_graph::graph::DepGraph::with_task_impl
31: rustc::ty::context::tls::with_related_context
32: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
33: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
34: rustc_codegen_llvm::back::symbol_export::exported_symbols_provider_local
35: rustc::ty::context::tls::with_context
36: rustc::dep_graph::graph::DepGraph::with_task_impl
37: rustc::ty::context::tls::with_related_context
38: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job
39: rustc::ty::maps::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
40: rustc_metadata::encoder::encode_metadata
41: rustc_metadata::cstore_impl::<impl rustc::middle::cstore::CrateStore for rustc_metadata::cstore::CStore>::encode_metadata
42: rustc::ty::context::TyCtxt::encode_metadata
43: rustc_codegen_llvm::base::write_metadata
44: rustc::util::common::time
45: rustc_codegen_llvm::base::codegen_crate
46: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
47: rustc::util::common::time
48: rustc_driver::driver::phase_4_codegen
49: rustc_driver::driver::compile_input::{{closure}}
50: rustc::ty::context::tls::enter_context
51: <std::thread::local::LocalKey<T>>::with
52: rustc::ty::context::TyCtxt::create_and_enter
53: rustc_driver::driver::compile_input
54: rustc_driver::run_compiler_with_pool
55: syntax::with_globals
56: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
57: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:105
58: rustc_driver::run
59: rustc_driver::main
60: std::rt::lang_start::{{closure}}
61: std::panicking::try::do_call
at libstd/rt.rs:59
at libstd/panicking.rs:310
62: __rust_maybe_catch_panic
at libpanic_unwind/lib.rs:105
63: std::rt::lang_start_internal
at libstd/panicking.rs:289
at libstd/panic.rs:374
at libstd/rt.rs:58
64: main
65: __libc_start_main
66: <unknown>
query stack during panic:
#0 [codegen_fulfill_obligation] checking if `specs::SystemData` fulfills its obligations
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
#2 [exported_symbols] exported_symbols
end of query stack
Metadata
Metadata
Assignees
Labels
Area: Type inferenceCategory: This is a bug.Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.