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

compile failed while use opt-level=3 after updating to rust 1.74 #163

Closed
CestcaVision opened this issue Nov 17, 2023 · 12 comments
Closed

compile failed while use opt-level=3 after updating to rust 1.74 #163

CestcaVision opened this issue Nov 17, 2023 · 12 comments

Comments

@CestcaVision
Copy link

This is error message:
bevy-inspector-egui-0.21.0/src/bevy_inspector/mod.rs:415:17
|
415 | set_changed();
| ^^^^^^^^^^^

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.74.0 (79e9716c9 2023-11-13) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C debug-assertions=on

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

query stack during panic:
end of query stack
error: could not compile bevy-inspector-egui (lib)

@Retrodad0001
Copy link

same here but on windows

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.74.0 (79e9716c9 2023-11-13) running on x86_64-pc-windows-msvc

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on

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

query stack during panic:
end of query stack
error: could not compile bevy-inspector-egui (lib)

@one-bit
Copy link

one-bit commented Nov 17, 2023

I'm also getting this error on Linux, while compiling a Bevy project that depends on bevy-inspector-egui = "0.21", with Rust 1.74 and opt-level = 3

cargo build output:

 ...
   Compiling bevy-inspector-egui v0.21.0
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: broken MIR in Item(DefId(0:154 ~ bevy_inspector_egui[3725]::bevy_inspector::ui_for_entity_components::{closure#3})) (after phase change to runtime-optimized) at bb5[4]:
                                Alias(Opaque, AliasTy { args: [ReErased, ReErased], def_id: DefId(0:2228 ~ bevy_inspector_egui[3725]::restricted_world_view::{impl#3}::get_entity_component_reflect::{opaque#0}) }) does not have fields
   --> /home/gamac/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy-inspector-egui-0.21.0/src/bevy_inspector/mod.rs:415:17
    |
415 |                 set_changed();
    |                 ^^^^^^^^^^^
    |
note: delayed at compiler/rustc_const_eval/src/transform/validate.rs:94:25
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, alloc::string::String>
         2: <rustc_const_eval::transform::validate::CfgChecker>::fail::<alloc::string::String>
         3: <rustc_const_eval::transform::validate::Validator as rustc_middle::mir::MirPass>::run_pass
         4: rustc_mir_transform::pass_manager::run_passes
         5: rustc_mir_transform::optimized_mir
         6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
         7: <rustc_query_impl::query_impl::optimized_mir::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
         8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
         9: rustc_query_impl::query_impl::optimized_mir::get_query_non_incr::__rust_end_short_backtrace
        10: <rustc_middle::ty::context::TyCtxt>::instance_mir
        11: rustc_monomorphize::collector::collect_used_items
        12: rustc_monomorphize::collector::collect_items_rec
        13: rustc_monomorphize::collector::collect_items_rec
        14: rustc_monomorphize::collector::collect_items_rec
        15: rustc_monomorphize::collector::collect_items_rec
        16: rustc_monomorphize::collector::collect_items_rec
        17: rustc_monomorphize::collector::collect_items_rec
        18: rustc_monomorphize::collector::collect_items_rec
        19: rustc_monomorphize::collector::collect_items_rec
        20: rustc_monomorphize::collector::collect_items_rec
        21: rustc_monomorphize::collector::collect_items_rec
        22: rustc_monomorphize::collector::collect_items_rec
        23: rustc_monomorphize::collector::collect_items_rec
        24: rustc_monomorphize::collector::collect_items_rec
        25: rustc_monomorphize::collector::collect_items_rec
        26: rustc_data_structures::sync::parallel::disabled::par_for_each_in::<alloc::vec::Vec<rustc_middle::mir::mono::MonoItem>, rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}::{closure#0}>
        27: <rustc_session::session::Session>::time::<(), rustc_monomorphize::collector::collect_crate_mono_items::{closure#1}>
        28: rustc_monomorphize::collector::collect_crate_mono_items
        29: rustc_monomorphize::partitioning::collect_and_partition_mono_items
        30: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 24]>>
        31: <rustc_query_impl::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_once
        32: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 24]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        33: rustc_query_impl::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
        34: rustc_codegen_ssa::base::codegen_crate::<rustc_codegen_llvm::LlvmCodegenBackend>
        35: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
        36: <rustc_session::session::Session>::time::<alloc::boxed::Box<dyn core::any::Any>, rustc_interface::passes::start_codegen::{closure#0}>
        37: rustc_interface::passes::start_codegen
        38: <rustc_middle::ty::context::GlobalCtxt>::enter::<<rustc_interface::queries::Queries>::ongoing_codegen::{closure#0}, core::result::Result<alloc::boxed::Box<dyn core::any::Any>, rustc_span::ErrorGuaranteed>>
        39: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
        40: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        41: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        42: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
        43: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/alloc/src/boxed.rs:2007:9
        44: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys/unix/thread.rs:108:17
        45: <unknown>
        46: <unknown>
   --> /home/gamac/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy-inspector-egui-0.21.0/src/bevy_inspector/mod.rs:415:17
    |
415 |                 set_changed();

@jakobhellermann
Copy link
Owner

I'll try to make a more minimal reproduction later and bisect rustc and submit a bug report for this (unless somebody wants to beat me to it)

@jakobhellermann
Copy link
Owner

Something pretty weird is going on, I can reproduce this when explicitly depending on the crates.io version.

Compiling in the repo or depending on it via path works fine.

Also in beta and nightly this issue doesn't seem to exist anymore if anyone needs a workaround.

@jakobhellermann
Copy link
Owner

regression was in rust-lang/rust@c545019 (rust-lang/rust#115759)

@jakobhellermann
Copy link
Owner

rust-lang/rust#117976

@jakobhellermann
Copy link
Owner

the issue is marked as regression-from-stable-to-stable and I-prioritize so it's maybe gonna get a backport into 1.74.1

wagk added a commit to wagk/starstruck that referenced this issue Nov 18, 2023
When building on Rust 1.74, [this] happens. Until a fix is released (via 1.74.1
or similar) building on opt-level = 3 will cause an ICE to occur.

[this]: jakobhellermann/bevy-inspector-egui#163
mikeder added a commit to mikeder/turtletime that referenced this issue Nov 19, 2023
1. Update Bevy to 0.12
2. Update related deps ( ggrs, bevy_ggrs, matchbox, etc. )
3. Log warning if winit cannot find main window to avoid panic - I don't
understand why this changed see below.
4. Switch to `1.72` toolchain due to Rust compiler regression.

### Winit Panic

Some new issue was introduced with the Bevy 0.12 upgrade, this line
started panicking, so we just log a warning and abort if we can't get
the primary window.


https://github.com/mikeder/turtletime/pull/3/files#diff-42cb6807ad74b3e201c5a7ca98b911c5fa08380e942be6e4ac5807f8377f87fcL83

NiklasEi/bevy_game_template#80

### Compiler Regression

I was unable to compile `bevy-egui-inspector` after updating to Rust to
the 1.74 toolchain, it turns out there was a compiler regression so I've
pinned my toolchain to 1.72 ( there was [another
regression](rust-lang/rust#117545) in 1.73
that sounds nasty enough to avoid for now too )

jakobhellermann/bevy-inspector-egui#163
rust-lang/rust#117976

#### Segmentation Fault

Originally I tried to use the `nightly` toolchain as recommended in the
above `bevy-egui-inspector` issue, but when I did, my game instantly
crashed with a segmentation fault. I tried to use the
[sanitizer](https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html)
features to debug it, but the game compiled and ran just fine with the
sanitizer flags. Ultimately I just downgraded to `1.72` and moved on
with my life.
@naomijub naomijub mentioned this issue Nov 22, 2023
7 tasks
ManevilleF added a commit to ManevilleF/bevy_silk that referenced this issue Dec 2, 2023
@valyagolev
Copy link

for reference of whoever finds this:

[profile.release.package."bevy-inspector-egui"]
        opt-level = 1

works as a workaround

@rparrett
Copy link
Contributor

rparrett commented Dec 8, 2023

Rust 1.74.1 was released. rustup update seems to have resolved the issue for me. Can anyone confirm?

@poperigby
Copy link

Can confirm that 1.74.1 fixed the issue.

@muhuk
Copy link

muhuk commented Dec 9, 2023

I can also confirm it is fixed with 1.74.1.

@Retrodad0001
Copy link

I can also confirm it is fixed with 1.74.1.

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

8 participants