Skip to content
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

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

Closed
simeonexo opened this issue Mar 19, 2021 · 4 comments
Closed

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

simeonexo opened this issue Mar 19, 2021 · 4 comments
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@simeonexo
Copy link

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

@simeonexo simeonexo added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 19, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 19, 2021

  • This shows you're using -Z share-generics. Can you replicate the ICE without that?
  • This nightly is a month old, can you replicate with a more recent version?
  • The back trace is really weird - it shows the crate being pretty printed as the top level query?? That doesn't seem to match the query stack though. There's also some error reporting halfway through which seems to indicate the crate doesn't compile. Did you make any changes to bevy? Are you sure the backtrace matches the panic?

@jyn514 jyn514 added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Mar 19, 2021
@simeonexo
Copy link
Author

  • This shows you're using -Z share-generics. Can you replicate the ICE without that?
  • This nightly is a month old, can you replicate with a more recent version?
  • The back trace is really weird - it shows the crate being pretty printed as the top level query?? That doesn't seem to match the query stack though. There's also some error reporting halfway through which seems to indicate the crate doesn't compile. Did you make any changes to bevy? Are you sure the backtrace matches the panic?

I use -Zshare-generics for fast compiling. I have removed this flag andthe ICE disappeared.

@jyn514 jyn514 added the requires-nightly This issue requires a nightly compiler in some way. label Mar 19, 2021
@jyn514 jyn514 changed the title ICE when compiling bevy project ICE when compiling bevy project with -Z share-generics Mar 19, 2021
@fee1-dead
Copy link
Member

#83309 probably is the same issue as this one. Can you verify if my pull request (#83401) would resolve the issue? (you can do it after it is merged)

@Enselic
Copy link
Member

Enselic commented Sep 7, 2023

Triage: I think it is safe to assume by now that this was a duplicate. Closing.

@Enselic Enselic closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants