rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
94.88k stars 12.23k forks source link

Internal Compiler Error while building project #99503

Open IgnisDa opened 1 year ago

IgnisDa commented 1 year ago

Please refer to this commit for reproduction: https://github.com/IgnisDa/developrs/tree/418acbcf83d65ecd91cf77408a0175751cd488d2

Code

cargo build -p esteem

Meta

rustc --version --verbose:

binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: x86_64-unknown-linux-gnu
release: 1.62.0
LLVM version: 14.0.5

Error output

Error output

```txt vscode@f956bec04ece /workspace (main)> rustup default stable info: using existing install for 'stable-x86_64-unknown-linux-gnu' info: default toolchain set to 'stable-x86_64-unknown-linux-gnu' stable-x86_64-unknown-linux-gnu unchanged - rustc 1.62.0 (a8314ef7d 2022-06-27) vscode@f956bec04ece /workspace (main)> cargo build -p esteem Compiling esteem v1.0.0 (/workspace/packages/esteem) warning: unused variable: `project_name` --> packages/esteem/src/cli.rs:192:31 | 192 | pub fn utils_get_dependencies(project_name: String) { | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_name` | = note: `#[warn(unused_variables)]` on by default thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_mir_transform/src/check_unsafety.rs:517:36 stack backtrace: 0: 0x7f7176ecbfed - std::backtrace_rs::backtrace::libunwind::trace::hb729d9642bb971eb at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f7176ecbfed - std::backtrace_rs::backtrace::trace_unsynchronized::h373bb774579df5c7 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f7176ecbfed - std::sys_common::backtrace::_print_fmt::hfbd4e92d240c89bb at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:66:5 3: 0x7f7176ecbfed - ::fmt::h8f618991fbf64972 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:45:22 4: 0x7f7176f27c7c - core::fmt::write::hc69b5b640d88cce8 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/fmt/mod.rs:1196:17 5: 0x7f7176ebd6c1 - std::io::Write::write_fmt::h3403cef06a24a303 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/io/mod.rs:1654:15 6: 0x7f7176eced05 - std::sys_common::backtrace::_print::h368f27cdedea0e52 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:48:5 7: 0x7f7176eced05 - std::sys_common::backtrace::print::ha105c9cf5a64cd17 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:35:9 8: 0x7f7176eced05 - std::panicking::default_hook::{{closure}}::h48ed2c3707d5e20e at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:295:22 9: 0x7f7176ece979 - std::panicking::default_hook::h8744fc5cea5e3110 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:314:9 10: 0x7f7177693961 - rustc_driver[cc15f272104f8c81]::DEFAULT_HOOK::{closure#0}::{closure#0} 11: 0x7f71669e26b3 - as core::ops::function::Fn>::call::h5ffde454a69fcb3e at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/alloc/src/boxed.rs:1886:9 12: 0x7f7166a102ed - proc_macro::bridge::client::::enter::{{closure}}::{{closure}}::h419e4872c9776274 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/proc_macro/src/bridge/client.rs:335:21 13: 0x7f7176ecf4d6 - std::panicking::rust_panic_with_hook::hc82286af2030e925 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:702:17 14: 0x7f7176ecf2d7 - std::panicking::begin_panic_handler::{{closure}}::h1c15057c2f09081f at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:588:13 15: 0x7f7176ecc4a4 - std::sys_common::backtrace::__rust_end_short_backtrace::h65de906a5330f8da at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:138:18 16: 0x7f7176ecf009 - rust_begin_unwind at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5 17: 0x7f7176e94283 - core::panicking::panic_fmt::h741cfbfc95bc6112 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14 18: 0x7f7178adee0f - rustc_mir_transform[34692f6d13108f5a]::check_unsafety::unsafety_check_result 19: 0x7f7178ad61b0 - >::call_once 20: 0x7f7177f714ab - ::with_deps::::{closure#1}, &rustc_middle[2b9dbf3985a9058b]::mir::query::UnsafetyCheckResult> 21: 0x7f7179c9abd0 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_load_from_disk_and_cache_in_memory:: 22: 0x7f717915e686 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::> 23: 0x7f7179127d7e - ::unsafety_check_result 24: 0x7f7178ae1efa - rustc_mir_transform[34692f6d13108f5a]::check_unsafety::unsafety_check_result 25: 0x7f7178ad61b0 - >::call_once 26: 0x7f7179bc11c0 - >::with_task:: 27: 0x7f717915e7a6 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::> 28: 0x7f7179c27f46 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::force_query:: 29: 0x7f7179c1d94e - rustc_query_impl[37d320545ae1f097]::query_callbacks::unsafety_check_result::force_from_dep_node 30: 0x7f71795b1401 - ::try_force_from_dep_node 31: 0x7f71790ee9ce - >::try_mark_previous_green:: 32: 0x7f71790ee99c - >::try_mark_previous_green:: 33: 0x7f71790ee99c - >::try_mark_previous_green:: 34: 0x7f717913c935 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::ensure_must_run:: 35: 0x7f7179128392 - ::mir_borrowck 36: 0x7f717897b6e4 - ::par_body_owners:: 37: 0x7f7179733c28 - ::time::<(), rustc_interface[a10bc87377f6ea4]::passes::analysis::{closure#2}> 38: 0x7f717972e515 - rustc_interface[a10bc87377f6ea4]::passes::analysis 39: 0x7f7179bd93b5 - >::with_task::> 40: 0x7f7179c7eca1 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::>> 41: 0x7f7179cbffbe - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::get_query:: 42: 0x7f717970ef97 - ::enter::> 43: 0x7f71796f9fe8 - ::enter::, rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>> 44: 0x7f71797226ef - rustc_span[aeddd698d19619f]::with_source_map::, rustc_interface[a10bc87377f6ea4]::interface::create_compiler_and_run, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}>::{closure#1}> 45: 0x7f717970e024 - rustc_interface[a10bc87377f6ea4]::interface::create_compiler_and_run::, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}> 46: 0x7f71796f84f2 - >::set::, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>> 47: 0x7f717970f61f - std[62a6aef941a414a5]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>> 48: 0x7f717970f759 - <::spawn_unchecked_, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>::{closure#1} as core[6724bec812d80be0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 49: 0x7f7176ed93f3 - as core::ops::function::FnOnce>::call_once::hcbca3baf872b7fe4 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/alloc/src/boxed.rs:1872:9 50: 0x7f7176ed93f3 - as core::ops::function::FnOnce>::call_once::h18790338ce1743e2 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/alloc/src/boxed.rs:1872:9 51: 0x7f7176ed93f3 - std::sys::unix::thread::Thread::new::thread_start::hb1067183bad48893 at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys/unix/thread.rs:108:17 52: 0x7f7176e04ea7 - start_thread 53: 0x7f7176d27def - clone 54: 0x0 - 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.62.0 (a8314ef7d 2022-06-27) running on x86_64-unknown-linux-gnu note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [unsafety_check_result] unsafety-checking `workspace::::get_dependencies_to_remove::{closure#1}` #1 [unsafety_check_result] unsafety-checking `workspace::::get_dependencies_to_remove` #2 [analysis] running analysis passes on this crate end of query stack warning: `esteem` (lib) generated 1 warning error: could not compile `esteem`; 1 warning emitted ```

Backtrace

``` Compiling esteem v1.0.0 (/workspace/packages/esteem) warning: unused variable: `project_name` --> packages/esteem/src/cli.rs:192:31 | 192 | pub fn utils_get_dependencies(project_name: String) { | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_project_name` | = note: `#[warn(unused_variables)]` on by default thread 'rustc' panicked at 'attempted to read from stolen value: rustc_middle::mir::Body', compiler/rustc_mir_transform/src/check_unsafety.rs:517:36 stack backtrace: 0: rust_begin_unwind at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/panicking.rs:142:14 2: rustc_mir_transform::check_unsafety::unsafety_check_result 3: >::call_once 4: ::with_deps::::{closure#1}, &rustc_middle::mir::query::UnsafetyCheckResult> 5: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory:: 6: rustc_query_system::query::plumbing::try_execute_query::> 7: ::unsafety_check_result 8: rustc_mir_transform::check_unsafety::unsafety_check_result 9: >::call_once 10: >::with_task:: 11: rustc_query_system::query::plumbing::try_execute_query::> 12: rustc_query_system::query::plumbing::force_query:: 13: rustc_query_impl::query_callbacks::unsafety_check_result::force_from_dep_node 14: ::try_force_from_dep_node 15: >::try_mark_previous_green:: 16: >::try_mark_previous_green:: 17: >::try_mark_previous_green:: 18: rustc_query_system::query::plumbing::ensure_must_run:: 19: ::mir_borrowck 20: ::par_body_owners:: 21: ::time::<(), rustc_interface::passes::analysis::{closure#2}> 22: rustc_interface::passes::analysis 23: >::with_task::> 24: rustc_query_system::query::plumbing::try_execute_query::>> 25: rustc_query_system::query::plumbing::get_query:: 26: ::enter::> 27: ::enter::, rustc_errors::ErrorGuaranteed>> 28: rustc_span::with_source_map::, rustc_interface::interface::create_compiler_and_run, rustc_driver::run_compiler::{closure#1}>::{closure#1}> 29: rustc_interface::interface::create_compiler_and_run::, rustc_driver::run_compiler::{closure#1}> 30: >::set::, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>> 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.62.0 (a8314ef7d 2022-06-27) running on x86_64-unknown-linux-gnu note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [unsafety_check_result] unsafety-checking `workspace::::get_dependencies_to_remove::{closure#1}` #1 [unsafety_check_result] unsafety-checking `workspace::::get_dependencies_to_remove` #2 [analysis] running analysis passes on this crate end of query stack warning: `esteem` (lib) generated 1 warning error: could not compile `esteem`; 1 warning emitted ```

Additional details

This error does not occur on this nightly version:

rustc 1.64.0-nightly (9a7b7d5e5 2022-07-19)
binary: rustc
commit-hash: 9a7b7d5e50ab0b59c6d349bbf005680a7c880e98
commit-date: 2022-07-19
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6
steffahn commented 1 year ago

Can’t reproduce this; presumably it’s an incremental compilation issue (i.e. the issue goes away with cargo clean and we’d need to do the same kind of modification you did before encountering the issue, building before and after the modification, in order to reproduce the issue). Also there are existing issues with similar ICEs that are incremental compilation issues. @rustbot label A-incr-comp.

kpreid commented 6 months ago

Triage: Relabeling issues which don't have a runnable reproduction (as opposed to having a non-minimized one) to the new label S-needs-repro. @rustbot label +S-needs-repro -E-needs-mcve