Skip to content

ICE when compiling bevy project with -Z share-generics #83292

Closed as not planned
Closed as not planned
@simeonexo

Description

@simeonexo

Code

pub fn delete_system(commands: &mut Commands, keyboard_inputs: Res<Input<KeyCode>>, mut query: Query<&Selectable>) {
    for mut selectable in query.iter_mut(){
        if selectable.selected == true {
            if keyboard_inputs.just_pressed(KeyCode::R){
                // setting selectable.selected to either true of false will cause this ICE
                // removing this line avoids ICE
                selectable.selected = false;
                
                commands.remove_one::<Selectable>(selectable.entity)
                    .remove_one::<CanHaveCamera>(selectable.entity)
                    .remove_one::<TargetIndicator>(selectable.entity)
                    .remove_one::<SelectionCircle>(selectable.entity)
                    .remove::<UnitBundle>(selectable.entity)
                    .remove::<WalkerBundle>(selectable.entity)
                    .despawn(selectable.entity);
            }
        }     
    }
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (3e826bb11 2021-02-21)
binary: rustc
commit-hash: 3e826bb11228508fbe749e594038d6727208aa94
commit-date: 2021-02-21
host: x86_64-pc-windows-msvc
release: 1.52.0-nightly
LLVM version: 11.0.1

Error output

thread 'rustc' panicked at 'assertion failed: !self.substitutions.is_empty()', compiler\rustc_errors\src\lib.rs:189:9
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.52.0-nightly (3e826bb11 2021-02-21) running on x86_64-pc-windows-msvc

note: compiler flags: -Z share-generics=y -C opt-level=1 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on -C linker=rust-lld.exe -C incremental --crate-type bin

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `delete_system`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `rts_prototype`

To learn more, run the command again with --verbose.
The terminal process "C:\Windows\SysNative\WindowsPowerShell\v1.0\powershell.exe -Command cargo run --package rts_prototype --bin rts_prototype" terminated with exit code: 1.
Backtrace

<backtrace>
stack backtrace:
   0:     0x7fff2b4185fe - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h160322fcc0f12a19
   1:     0x7fff2b44444b - core::fmt::write::ha3ea633b18d2da75
   2:     0x7fff2b40b798 - <std::io::IoSlice as core::fmt::Debug>::fmt::h0a7d0dda807c93f1
   3:     0x7fff2b41c7cd - std::panicking::take_hook::h7c389d310fc84231
   4:     0x7fff2b41c299 - std::panicking::take_hook::h7c389d310fc84231
   5:     0x7ffef29d0b57 - rustc_driver::report_ice::h1a74db21cb8754b8
   6:     0x7fff2b41d232 - std::panicking::rust_panic_with_hook::h13af0da83034d6f3
   7:     0x7fff2b41ccf3 - rust_begin_unwind
   8:     0x7fff2b418f8f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h160322fcc0f12a19
   9:     0x7fff2b41cc79 - rust_begin_unwind
  10:     0x7fff2b4404d0 - core::panicking::panic_fmt::h45da916c710b88f7
  11:     0x7fff2b44041c - core::panicking::panic::h3a7a516f2be28c18
  12:     0x7ffef6a77bbe - <rustc_errors::emitter::EmitterWriter as rustc_errors::emitter::Emitter>::emit_diagnostic::h3d02e1f0f59cd00e
  13:     0x7ffef6a9bd88 - <rustc_errors::json::JsonEmitter as rustc_errors::emitter::Emitter>::should_show_explain::h304a686fdaf07deb
  14:     0x7ffef6a9b57f - <rustc_errors::json::JsonEmitter as rustc_errors::emitter::Emitter>::emit_diagnostic::h41961d9f7a2940fa
  15:     0x7ffef6a623ac - rustc_errors::HandlerInner::emit_diagnostic::h49c6c3d27e650aba
  16:     0x7ffef6a619e2 - rustc_errors::Handler::emit_diagnostic::h9d28a42dfbc52bf8
  17:     0x7ffef5bfb345 - rustc_mir::borrow_check::provide::hd481a5c3e83b7064
  18:     0x7ffef58d02ab - <rustc_mir_build::thir::pattern::check_match::check_legality_of_bindings_in_at_patterns::AtBindingPatternVisitor as rustc_hir::intravisit::Visitor>::visit_pat::h00634e74098b1747
  19:     0x7ffef5bf5c2f - rustc_mir::borrow_check::provide::hd481a5c3e83b7064
  20:     0x7ffef5bc54d6 - <rustc_mir::util::spanview::SpanViewable as core::fmt::Debug>::fmt::haad94ddad8c3d62d
  21:     0x7ffef568c6f9 - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::h04a5c01b997422ca
  22:     0x7ffef559106e - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::h04a5c01b997422ca
  23:     0x7ffef56bef5e - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::h04a5c01b997422ca
  24:     0x7ffef5426113 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h37509061c5671665
  25:     0x7ffef531b222 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h37509061c5671665
  26:     0x7ffef5504912 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::hd7ef9b9141614b59
  27:     0x7ffef2b384a8 - rustc_interface::passes::BoxedResolver::complete::h7e7f5bc5e0a60b7a
  28:     0x7ffef2b37276 - rustc_interface::passes::BoxedResolver::to_resolver_outputs::h07a0552f8efe1194
  29:     0x7ffef568daf9 - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::h04a5c01b997422ca
  30:     0x7ffef5595d8b - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::h04a5c01b997422ca
  31:     0x7ffef56ac0d0 - <rustc_span::def_id::DefIndex as rustc_query_impl::profiling_support::SpecIntoSelfProfilingString>::spec_to_self_profile_string::h04a5c01b997422ca
  32:     0x7ffef542bd03 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h37509061c5671665
  33:     0x7ffef530cb34 - <rustc_ast_lowering::item::ItemLowerer as rustc_ast::visit::Visitor>::visit_foreign_item::h37509061c5671665
  34:     0x7ffef55003b2 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::try_print_query_stack::hd7ef9b9141614b59
  35:     0x7ffef2a3600a - <rustc_driver::args::Error as core::fmt::Debug>::fmt::hfcb8bb2e4252d407
  36:     0x7ffef29e9387 - <rustc_driver::pretty::IdentifiedAnnotation as rustc_driver::pretty::HirPrinterSupport>::hir_map::h50179616964d5d46
  37:     0x7ffef2a47a5c - <rustc_hir::intravisit::ErasedMap as rustc_hir::intravisit::Map>::foreign_item::h87adf510683c1e5e
  38:     0x7ffef29ea799 - <rustc_driver::pretty::IdentifiedAnnotation as rustc_driver::pretty::HirPrinterSupport>::hir_map::h50179616964d5d46
  39:     0x7ffef29e2824 - chalk_engine::TableIndex::increment::h47398d140422999d
  40:     0x7ffef29e42ae - <aho_corasick::prefilter::StartBytesThree as aho_corasick::prefilter::Prefilter>::heap_bytes::h403331bfe6e7287f
  41:     0x7ffef2a0b74d - rustc_driver::pretty::print_after_hir_lowering::h2b3710020259b375
  42:     0x7fff2b42c81a - std::sys::windows::thread::Thread::new::hd38a560d738a063d
  43:     0x7fff6ff47974 - BaseThreadInitThunk
  44:     0x7fff7226a2d1 - RtlUserThreadStart

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-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.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions