Skip to content

Regression: rustc crashes on Windows trying to build lib/rustlib/x86_64-pc-windows-msvc/lib/libstd.rlib #118754

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
nico opened this issue Dec 8, 2023 · 8 comments
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) 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.

Comments

@nico
Copy link

nico commented Dec 8, 2023

Meta

Trying to update rustc from df0295f to f90f898 in Chromium, we hit an ICE. So far I've only seen it on a bot and don't have a local repro yet.

Error output

The full error log is at https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8762255204440933329/+/u/compile__with_patch_/stdout?format=raw

Excerpt:

Backtrace

FAILED: 444ffa45-8bad-4945-8d57-26a434e09e2b RUST local_rustc_sysroot/lib/rustlib/x86_64-pc-windows-msvc/lib/libstd.rlib
stderr:
error: internal compiler error: compiler\rustc_mir_transform\src\coverage\spans.rs:434:49: invalid attempt to unwrap a None some_prev

thread 'rustc' panicked at C:\b\s\w\ir\cache\builder\src\third_party\rust-src\compiler\rustc_errors\src\lib.rs:1113:75:
Box<dyn Any>
stack backtrace:
   0:     0x7ffb7e23a2f5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd599614fd193bada
   1:     0x7ffb7e26ef8b - core::fmt::write::hda39c3c02411710a
   2:     0x7ffb7e243201 - std::fs::DirBuilder::_create::h5d831723ad01bc5b
   3:     0x7ffb7e23bc24 - std::panicking::default_hook::h66d8ac9069df83d4
   4:     0x7ffb7e23b4ba - std::panicking::default_hook::h66d8ac9069df83d4
   5:     0x7ffb74047612 - once_cell[96842b08614cf476]::imp::initialize_or_wait
   6:     0x7ffb7e23c60d - std::panicking::rust_panic_with_hook::hcc951e9133c0ca78
   7:     0x7ffb73dc5f2a - rustc_errors[4b6d00e9ad1f5418]::markdown::create_stdout_bufwtr
   8:     0x7ffb73dc3cc9 - rustc_errors[4b6d00e9ad1f5418]::markdown::create_stdout_bufwtr
   9:     0x7ffb76f489b9 - rustc_query_system[d461914d3def57f8]::query::job::report_cycle
  10:     0x7ffb73dcb42c - <rustc_errors[4b6d00e9ad1f5418]::diagnostic_builder::Bug as rustc_errors[4b6d00e9ad1f5418]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
  11:     0x7ffb73bedd9e - <rustc_middle[3d57c46152fca3ab]::ty::generic_args::GenericArg as core[834f362b311180d]::fmt::Display>::fmt
  12:     0x7ffb73bc7f94 - <rustc_middle[3d57c46152fca3ab]::ty::typeck_results::UserType as core[834f362b311180d]::fmt::Display>::fmt
  13:     0x7ffb73bc4571 - <rustc_middle[3d57c46152fca3ab]::ty::consts::kind::UnevaluatedConst as rustc_errors[4b6d00e9ad1f5418]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
  14:     0x7ffb73bc450f - <rustc_middle[3d57c46152fca3ab]::ty::consts::kind::UnevaluatedConst as rustc_errors[4b6d00e9ad1f5418]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
  15:     0x7ffb76f37045 - rustc_middle[3d57c46152fca3ab]::util::bug::bug_fmt
  16:     0x7ffb7280d620 - <rustc_mir_transform[b009732a92ad6572]::coverage::InstrumentCoverage as rustc_middle[3d57c46152fca3ab]::mir::MirPass>::run_pass
  17:     0x7ffb72809f95 - <rustc_mir_transform[b009732a92ad6572]::coverage::InstrumentCoverage as rustc_middle[3d57c46152fca3ab]::mir::MirPass>::run_pass
  18:     0x7ffb72855d3f - <rustc_mir_transform[b009732a92ad6572]::elaborate_drops::Elaborator as rustc_mir_dataflow[17d83a6078baa8de]::elaborate_drops::DropElaborator>::drop_style
  19:     0x7ffb72904863 - rustc_mir_transform[b009732a92ad6572]::mir_promoted
  20:     0x7ffb7309fa64 - <rustc_query_impl[835115f851c09ed8]::plumbing::QueryCtxt as rustc_query_system[d461914d3def57f8]::query::QueryContext>::depth_limit_error
  21:     0x7ffb7317c8e1 - rustc_query_impl[835115f851c09ed8]::query_callbacks
  22:     0x7ffb74d4a502 - once_cell[96842b08614cf476]::imp::initialize_or_wait
  23:     0x7ffb74daa86f - once_cell[96842b08614cf476]::imp::initialize_or_wait
  24:     0x7ffb72e21dac - rustc_borrowck[6d4f4eabd77ba1f0]::mir_borrowck
  25:     0x7ffb7309f9ff - <rustc_query_impl[835115f851c09ed8]::plumbing::QueryCtxt as rustc_query_system[d461914d3def57f8]::query::QueryContext>::depth_limit_error
  26:     0x7ffb74bb6bdc - once_cell[96842b08614cf476]::imp::initialize_or_wait
  27:     0x7ffb74d59688 - once_cell[96842b08614cf476]::imp::initialize_or_wait
  28:     0x7ffb730cd43f - rustc_query_impl[835115f851c09ed8]::profiling_support::alloc_self_profile_query_strings
  29:     0x7ffb722e618b - rustc_interface[80035a4c85fe31c5]::passes::start_codegen
  30:     0x7ffb740c4445 - once_cell[96842b08614cf476]::imp::initialize_or_wait
  31:     0x7ffb722e1407 - rustc_interface[80035a4c85fe31c5]::passes::analysis
  32:     0x7ffb730a5f0d - <rustc_query_impl[835115f851c09ed8]::plumbing::QueryCtxt as rustc_query_system[d461914d3def57f8]::query::QueryContext>::depth_limit_error
  33:     0x7ffb731806a8 - rustc_query_impl[835115f851c09ed8]::query_callbacks
  34:     0x7ffb74c78c8a - once_cell[96842b08614cf476]::imp::initialize_or_wait
  35:     0x7ffb74bbd353 - once_cell[96842b08614cf476]::imp::initialize_or_wait
  36:     0x7ffb721a22ef - <unknown>
  37:     0x7ffb7406f674 - once_cell[96842b08614cf476]::imp::initialize_or_wait
  38:     0x7ffb74048b52 - once_cell[96842b08614cf476]::imp::initialize_or_wait
  39:     0x7ffb7403d1ce - once_cell[96842b08614cf476]::imp::initialize_or_wait
  40:     0x7ffb740514c6 - once_cell[96842b08614cf476]::imp::initialize_or_wait
  41:     0x7ffb721a759a - <<rustc_mir_transform[b009732a92ad6572]::const_prop::ConstPropMachine as rustc_const_eval[f5e7a07ec2b18f18]::interpret::machine::Machine>::panic_nounwind::Zst as rustc_middle[3d57c46152fca3ab]::mir::interpret::error::MachineStopType>::add_args
  42:     0x7ffb7e23d02c - std::sys::windows::thread::Thread::new::h74332cb458a081a6
  43:     0x7ffbc6ae7034 - BaseThreadInitThunk
  44:     0x7ffbc82226a1 - RtlUserThreadStart

It looks like https://github.com/rust-lang/rust/commits/master/compiler/rustc_errors/src was edited quite a bit 4 days ago by @nnethercote; maybe the stack trace will make sense to them.

I'll try to add more information as I get it.

@nico nico 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 Dec 8, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 8, 2023
@nico
Copy link
Author

nico commented Dec 8, 2023

@nico
Copy link
Author

nico commented Dec 8, 2023

(Our last update included Rust changes up to Nov 28, so the rustc_errors changes on Dec 1 are in scope too. Apologies if this is some very central code and the bug is likely in a caller than in that code in particular! I don't know very much about rustc's internal structure.)

@nico
Copy link
Author

nico commented Dec 8, 2023

I managed to reproduce the problem locally. Here's the error log that rustc asks me to upload:

rustc-ice-2023-12-08T19_42_07-2444121.txt

@nnethercote
Copy link
Contributor

The relevant parts of the stack trace:

15:     0x7ffb76f37045 - rustc_middle[3d57c46152fca3ab]::util::bug::bug_fmt
16:     0x7ffb7280d620 - <rustc_mir_transform[b009732a92ad6572]::coverage::InstrumentCoverage as rustc_middle[3d57c46152fca3ab]::mir::MirPass>::run_pass
17:     0x7ffb72809f95 - <rustc_mir_transform[b009732a92ad6572]::coverage::InstrumentCoverage as rustc_middle[3d57c46152fca3ab]::mir::MirPass>::run_pass
18:     0x7ffb72855d3f - <rustc_mir_transform[b009732a92ad6572]::elaborate_drops::Elaborator as rustc_mir_dataflow[17d83a6078baa8de]::elaborate_drops::DropElaborator>::drop_style
19:     0x7ffb72904863 - rustc_mir_transform[b009732a92ad6572]::mir_promoted

This looks like a problem in InstrumentCoverage, which is a MIR pass. I don't know anything about it beyond that. Maybe @saethlin or @cjgillot might know?

@Urgau
Copy link
Member

Urgau commented Dec 8, 2023

Seems like a duplicate of #118643.
Which I think will be fixed by #118666.

cc @Zalathar

@saethlin saethlin added A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 8, 2023
@Zalathar
Copy link
Contributor

Zalathar commented Dec 8, 2023

Yeah, from the panic message this looks like the same issue.

@Zalathar
Copy link
Contributor

This should now be fixed in 1.76.0-nightly (06e02d5b2 2023-12-09).

@nico
Copy link
Author

nico commented Dec 12, 2023

Yes, we're no longer seeing this, thanks!

@nico nico closed this as completed Dec 12, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) 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.
Projects
None yet
Development

No branches or pull requests

6 participants