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

rustc panicked when trying to compile once_cell #101640

Closed
Andy-Python-Programmer opened this issue Sep 10, 2022 · 1 comment · Fixed by #101678
Closed

rustc panicked when trying to compile once_cell #101640

Andy-Python-Programmer opened this issue Sep 10, 2022 · 1 comment · Fixed by #101678
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Andy-Python-Programmer
Copy link
Contributor

Compiler panic when it was trying to compile the crate once_cell:

  Compiling compiler_builtins v0.1.79
  Compiling core v0.0.0 (/home/andy/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
  Compiling autocfg v1.1.0
  Compiling version_check v0.9.4
  Compiling crossbeam-utils v0.8.11
  Compiling proc-macro2 v1.0.43
  Compiling cfg-if v1.0.0
  Compiling once_cell v1.14.0
  Compiling libc v0.2.132
  Compiling quote v1.0.21
  Compiling unicode-ident v1.0.3
  Compiling scopeguard v1.1.0
  Compiling rayon-core v1.9.3
  Compiling syn v1.0.99
  Compiling either v1.8.0
  Compiling log v0.4.17
  Compiling serde v1.0.144
  Compiling cc v1.0.73
  Compiling serde_json v1.0.85
  Compiling proc-macro-error-attr v1.0.4
  Compiling proc-macro-error v1.0.4
  Compiling ahash v0.7.6
  Compiling memoffset v0.6.5
  Compiling crossbeam-epoch v0.9.10
  Compiling rayon v1.5.3
  Compiling memoffset v0.5.6
  Compiling crossbeam-channel v0.5.6
  Compiling crossbeam-deque v0.8.2
  Compiling num_cpus v1.13.1
  Compiling lai v0.1.0 (https://github.com/aero-os/lai-rs#dd82efe6)
  Compiling vte_generate_state_changes v0.1.1 (https://github.com/Andy-Python-Programmer/vte#a9d8bf89)
  Compiling nasm-rs v0.2.4
  Compiling aero_kernel v0.1.0 (/home/andy/aero/src/aero_kernel)
  Compiling aero_proc v0.1.0 (/home/andy/aero/src/aero_proc)
  Compiling rustc-std-workspace-core v1.99.0 (/home/andy/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
  Compiling alloc v0.0.0 (/home/andy/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
  Compiling bitflags v1.3.2
  Compiling zero v0.1.2
  Compiling utf8parse v0.2.0 (https://github.com/Andy-Python-Programmer/vte#a9d8bf89)
  Compiling ryu v1.0.11
  Compiling arrayvec v0.7.2
  Compiling spin v0.5.2
thread 'rustc' panicked at 'identifier: "metadata_std_required", attr: None, args: FluentArgs([("add_info", String("")), ("crate_name", String("std")), ("locator_triple", String("x86_64-aero_os"))]), errors: [ResolverError(Reference(Variable { id: "current_crate" }))]', compiler/rustc_errors/src/translation.rs:91:17
stack backtrace:
  0:     0x7fa8147e9eb0 - std::backtrace_rs::backtrace::libunwind::trace::hd4d72bf9fe10967c
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
  1:     0x7fa8147e9eb0 - std::backtrace_rs::backtrace::trace_unsynchronized::h6503f59b8cbe2ed6
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
  2:     0x7fa8147e9eb0 - std::sys_common::backtrace::_print_fmt::h589945bf8bc39343
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys_common/backtrace.rs:66:5
  3:     0x7fa8147e9eb0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2f4d863594a68c91
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys_common/backtrace.rs:45:22
  4:     0x7fa814844efe - core::fmt::write::h9fd78932fc37b51c
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/core/src/fmt/mod.rs:1202:17
  5:     0x7fa8147da595 - std::io::Write::write_fmt::h6066f9f8807a65d2
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/io/mod.rs:1679:15
  6:     0x7fa8147ecb63 - std::sys_common::backtrace::_print::h355143466bed5429
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys_common/backtrace.rs:48:5
  7:     0x7fa8147ecb63 - std::sys_common::backtrace::print::hb82c149c248573a7
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys_common/backtrace.rs:35:9
  8:     0x7fa8147ecb63 - std::panicking::default_hook::{{closure}}::h9412e92c58f99121
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/panicking.rs:295:22
  9:     0x7fa8147ec84f - std::panicking::default_hook::h1a8b46d36ee22d51
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/panicking.rs:314:9
 10:     0x7fa817050101 - rustc_driver[8f3cca79f91367d]::DEFAULT_HOOK::{closure#0}::{closure#0}
 11:     0x7fa8147ed39d - std::panicking::rust_panic_with_hook::he6adbff8aae13c88
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/panicking.rs:702:17
 12:     0x7fa8147ed1f7 - std::panicking::begin_panic_handler::{{closure}}::hc2cade6d6762c671
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/panicking.rs:588:13
 13:     0x7fa8147ea35c - std::sys_common::backtrace::__rust_end_short_backtrace::h2a054ca94f99dcb2
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys_common/backtrace.rs:138:18
 14:     0x7fa8147ecf12 - rust_begin_unwind
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/panicking.rs:584:5
 15:     0x7fa814841ad3 - core::panicking::panic_fmt::h5894a80f27bddaf0
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/core/src/panicking.rs:142:14
 16:     0x7fa816db51c7 - <rustc_errors[724a1349d7209c57]::emitter::EmitterWriter as rustc_errors[724a1349d7209c57]::translation::Translate>::translate_message
 17:     0x7fa816da9a42 - <rustc_errors[724a1349d7209c57]::emitter::EmitterWriter>::msg_to_buffer
 18:     0x7fa816db23e0 - <rustc_errors[724a1349d7209c57]::emitter::EmitterWriter>::emit_message_default
 19:     0x7fa816da0db4 - <rustc_errors[724a1349d7209c57]::emitter::EmitterWriter as rustc_errors[724a1349d7209c57]::emitter::Emitter>::emit_diagnostic
 20:     0x7fa816d9e39d - <rustc_errors[724a1349d7209c57]::json::Diagnostic>::from_errors_diagnostic
 21:     0x7fa816d9c4be - <rustc_errors[724a1349d7209c57]::json::JsonEmitter as rustc_errors[724a1349d7209c57]::emitter::Emitter>::emit_diagnostic
 22:     0x7fa815a8429d - <rustc_errors[724a1349d7209c57]::HandlerInner>::emit_diagnostic
 23:     0x7fa815a83c51 - <rustc_errors[724a1349d7209c57]::Handler>::emit_diagnostic
 24:     0x7fa81643c91d - <rustc_errors[724a1349d7209c57]::ErrorGuaranteed as rustc_errors[724a1349d7209c57]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
 25:     0x7fa817caf159 - <rustc_session[c1d6deef70235337]::session::Session>::emit_err::<rustc_metadata[d349275093e5e780]::errors::CannotFindCrate>
 26:     0x7fa817c74dc3 - <rustc_metadata[d349275093e5e780]::locator::CrateError>::report
 27:     0x7fa815f3a135 - <rustc_metadata[d349275093e5e780]::creader::CrateLoader>::resolve_crate
 28:     0x7fa8165be83c - <rustc_metadata[d349275093e5e780]::creader::CrateLoader>::process_extern_crate
 29:     0x7fa8165b24f0 - <rustc_resolve[579e1b26d270dc87]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[67ecbb9fd5a6d181]::visit::Visitor>::visit_item
 30:     0x7fa8165c1941 - <rustc_resolve[579e1b26d270dc87]::build_reduced_graph::BuildReducedGraphVisitor as rustc_ast[67ecbb9fd5a6d181]::visit::Visitor>::visit_crate
 31:     0x7fa8165aaa0c - <rustc_resolve[579e1b26d270dc87]::Resolver as rustc_expand[f693658ddb737e69]::base::ResolverExpand>::visit_ast_fragment_with_placeholders
 32:     0x7fa816774130 - <rustc_expand[f693658ddb737e69]::expand::MacroExpander>::fully_expand_fragment
 33:     0x7fa815e640c3 - <rustc_expand[f693658ddb737e69]::expand::MacroExpander>::expand_crate
 34:     0x7fa815e632d3 - <rustc_session[c1d6deef70235337]::session::Session>::time::<core[3035f67f4d4c8105]::result::Result<rustc_ast[67ecbb9fd5a6d181]::ast::Crate, rustc_errors[724a1349d7209c57]::ErrorGuaranteed>, rustc_interface[a2838c864f6eb7ab]::passes::configure_and_expand::{closure#1}>
 35:     0x7fa815e2b843 - rustc_interface[a2838c864f6eb7ab]::passes::configure_and_expand
 36:     0x7fa815e22165 - <rustc_interface[a2838c864f6eb7ab]::queries::Queries>::expansion
 37:     0x7fa815e1eafc - rustc_interface[a2838c864f6eb7ab]::interface::create_compiler_and_run::<core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>, rustc_driver[8f3cca79f91367d]::run_compiler::{closure#1}>
 38:     0x7fa815e1d531 - <scoped_tls[f2fbc1eb2eeeae22]::ScopedKey<rustc_span[5934fe088b167bef]::SessionGlobals>>::set::<rustc_interface[a2838c864f6eb7ab]::interface::run_compiler<core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>, rustc_driver[8f3cca79f91367d]::run_compiler::{closure#1}>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>
 39:     0x7fa815e1d21f - std[dce46a4773fb9772]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a2838c864f6eb7ab]::util::run_in_thread_pool_with_globals<rustc_interface[a2838c864f6eb7ab]::interface::run_compiler<core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>, rustc_driver[8f3cca79f91367d]::run_compiler::{closure#1}>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>
 40:     0x7fa816eba610 - <<std[dce46a4773fb9772]::thread::Builder>::spawn_unchecked_<rustc_interface[a2838c864f6eb7ab]::util::run_in_thread_pool_with_globals<rustc_interface[a2838c864f6eb7ab]::interface::run_compiler<core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>, rustc_driver[8f3cca79f91367d]::run_compiler::{closure#1}>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>::{closure#0}, core[3035f67f4d4c8105]::result::Result<(), rustc_errors[724a1349d7209c57]::ErrorGuaranteed>>::{closure#1} as core[3035f67f4d4c8105]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
 41:     0x7fa8147f7173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2546ce459201572e
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/alloc/src/boxed.rs:1940:9
 42:     0x7fa8147f7173 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha02ec324858dc3c8
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/alloc/src/boxed.rs:1940:9
 43:     0x7fa8147f7173 - std::sys::unix::thread::Thread::new::thread_start::h9bd74d28238bdb06
                              at /rustc/1120c5e01df508de64fe6642f22fadeb574afd6d/library/std/src/sys/unix/thread.rs:108:17
 44:     0x7fa8146b7609 - start_thread
                              at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
  Compiling itoa v1.0.3
  Compiling static_assertions v1.1.0
 45:     0x7fa8145da133 - clone
                              at /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
 46:                0x0 - <unknown>

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.65.0-nightly (1120c5e01 2022-09-08) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C opt-level=3 -C embed-bitcode=no -C debuginfo=2 -Z unstable-options -C force-frame-pointers=yes

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

query stack during panic:
end of query stack
error: could not compile `once_cell`
warning: build failed, waiting for other jobs to finish...
@Andy-Python-Programmer Andy-Python-Programmer 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 Sep 10, 2022
@jannic
Copy link
Contributor

jannic commented Sep 10, 2022

To reproduce this, try to build once_cell for an architecture which doesn't have std. Eg:

once_cell$ cargo +nightly build --target thumbv6m-none-eabi
   Compiling once_cell v1.14.0 (/home/jan/tmp/once_cell)
thread 'rustc' panicked at 'identifier: "metadata_std_required", attr: None, args: FluentArgs([("add_info", String("")), ("crate_name", String("std")), ("locator_triple", String("thumbv6m-none-eabi"))]), errors: [ResolverError(Reference(Variable { id: "current_crate" }))]', compiler/rustc_errors/src/translation.rs:91:17

This was with version 1.65.0-nightly (646e9a0b9 2022-09-02).

For comparison, with stable rust 1.63.0, the error is:

$ cargo +stable build --target thumbv6m-none-eabi
   Compiling once_cell v1.14.0 (/home/jan/tmp/once_cell)
error[E0463]: can't find crate for `std`
  |
  = note: the `thumbv6m-none-eabi` target may not support the standard library
  = note: `std` is required by `once_cell` because it does not declare `#![no_std]`

error[E0463]: can't find crate for `std`
   --> src/lib.rs:354:9
    |
354 |     use std::panic::{RefUnwindSafe, UnwindSafe};

@jyn514 jyn514 added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic labels Sep 11, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Sep 11, 2022
@bors bors closed this as completed in 0d56e34 Sep 11, 2022
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants