Skip to content

thread 'rustc' panicked at compiler/rustc_resolve/src/macros.rs:749:2 #142009

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

Open
GlenDC opened this issue Jun 4, 2025 · 12 comments
Open

thread 'rustc' panicked at compiler/rustc_resolve/src/macros.rs:749:2 #142009

GlenDC opened this issue Jun 4, 2025 · 12 comments
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically C-external-bug Category: issue that is caused by bugs in software beyond our control I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-AArch64 Armv8-A or later processors in AArch64 mode O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@GlenDC
Copy link
Contributor

GlenDC commented Jun 4, 2025

Seen in: https://github.com/plabayo/rama/actions/runs/15433552048/job/43435739684

And only there. None of our other CI targets trigger it and locally (despite being on macOS as well)
we do not see it either.

Meta

rustc --version --verbose:

 stable-aarch64-apple-darwin unchanged - rustc 1.87.0 (17067e9ac 2025-05-09)

Error output

Run cargo test --all-features --examples --workspace
    Updating crates.io index
   Compiling proc-macro2 v1.0.95
   Compiling unicode-ident v1.0.18
   Compiling libc v0.2.172
   Compiling cfg-if v1.0.0
   Compiling autocfg v1.4.0
   Compiling smallvec v1.15.0
   Compiling pin-project-lite v0.2.16
   Compiling portable-atomic v1.11.0
   Compiling memchr v2.7.4
   Compiling quote v1.0.40
   Compiling syn v2.0.101

thread 'rustc' panicked at compiler/rustc_resolve/src/macros.rs:749:21:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0:        0x112dc04bc - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h92dda645f072dcaf
   1:        0x110473bbc - core::fmt::write::hbc92919d8e8f9a96
   2:        0x112db5310 - std::io::Write::write_fmt::hcee3b5dc9ab531be
   3:        0x112dc037c - std::sys::backtrace::BacktraceLock::print::h0f497abce563e5d2
   4:        0x112dc297c - std::panicking::default_hook::{{closure}}::h62595143a6c21f05
   5:        0x112dc2648 - std::panicking::default_hook::hd800536ed1df5085
   6:        0x110f4baf0 - std[dece160403b877c5]::panicking::update_hook::<alloc[b2f5842f192e62d9]::boxed::Box<rustc_driver_impl[10b09d078f964436]::install_ice_hook::{closure#1}>>::{closure#0}
   7:        0x112dc3368 - std::panicking::rust_panic_with_hook::h1882a30575fbb763
   8:        0x112dc2f5c - std::panicking::begin_panic_handler::{{closure}}::h39275ef3005e6337
   9:        0x112dc094c - std::sys::backtrace::__rust_end_short_backtrace::h6ede323c05a76849
  10:        0x112dc2c24 - __rustc[95feac21a9532783]::rust_begin_unwind
  11:        0x115a1c144 - core::panicking::panic_fmt::h529fda7ea817ba4f
  12:        0x115a1c2c4 - core::panicking::panic_bounds_check::he315898ba5b8216d
  13:        0x11270cee4 - <rustc_resolve[c12e87a1ee516b9]::Resolver>::resolve_macro_or_delegation_path
  14:        0x112734ce0 - <rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor>::smart_resolve_path_fragment
  15:        0x1126fcd68 - <rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor>::resolve_expr
  16:        0x1126fcaf4 - <rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor>::resolve_expr
  17:        0x1126fb538 - <rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor>::resolve_expr
  18:        0x1126f91cc - <rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor>::resolve_block
  19:        0x1126dfb5c - <rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor as rustc_ast[d8ab2fd52514a3a0]::visit::Visitor>::visit_fn
  20:        0x1125f8904 - rustc_ast[d8ab2fd52514a3a0]::visit::walk_item_ctxt::<rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor, rustc_ast[d8ab2fd52514a3a0]::ast::AssocItemKind>
  21:        0x1126f3d94 - <rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor>::resolve_implementation::{closure#0}::{closure#0}::{closure#0}::{closure#0}::{closure#0}::{closure#0}::{closure#0}
  22:        0x1126d38c8 - <rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor as rustc_ast[d8ab2fd52514a3a0]::visit::Visitor>::visit_item
  23:        0x1125f9bf0 - rustc_ast[d8ab2fd52514a3a0]::visit::walk_item_ctxt::<rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor, rustc_ast[d8ab2fd52514a3a0]::ast::ItemKind>
  24:        0x1126c948c - <rustc_resolve[c12e87a1ee516b9]::late::LateResolutionVisitor as rustc_ast[d8ab2fd52514a3a0]::visit::Visitor>::visit_item
  25:        0x11271c07c - <rustc_resolve[c12e87a1ee516b9]::Resolver>::resolve_crate::{closure#0}
  26:        0x1127187e8 - <rustc_resolve[c12e87a1ee516b9]::Resolver>::resolve_crate
  27:        0x11180b834 - rustc_interface[36d0dc89b6111b4f]::passes::resolver_for_lowering_raw
  28:        0x112520784 - rustc_query_impl[ddeb1b8cb2654587]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ddeb1b8cb2654587]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[19a1a29194537e3]::query::erase::Erased<[u8; 16usize]>>
  29:        0x1122ef924 - rustc_query_system[5bcf2b842147579]::query::plumbing::try_execute_query::<rustc_query_impl[ddeb1b8cb2654587]::DynamicConfig<rustc_query_system[5bcf2b842147579]::query::caches::SingleCache<rustc_middle[19a1a29194537e3]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[ddeb1b8cb2654587]::plumbing::QueryCtxt, false>
  30:        0x112528014 - rustc_query_impl[ddeb1b8cb2654587]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  31:        0x110ef8fa4 - rustc_interface[36d0dc89b6111b4f]::passes::create_and_enter_global_ctxt::<core[7ef867844175194f]::option::Option<rustc_interface[36d0dc89b6111b4f]::queries::Linker>, rustc_driver_impl[10b09d078f964436]::run_compiler::{closure#0}::{closure#2}>
  32:        0x110f4894c - rustc_interface[36d0dc89b6111b4f]::interface::run_compiler::<(), rustc_driver_impl[10b09d078f964436]::run_compiler::{closure#0}>::{closure#1}
  33:        0x110f38dcc - std[dece160403b877c5]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[36d0dc89b6111b4f]::util::run_in_thread_with_globals<rustc_interface[36d0dc89b6111b4f]::util::run_in_thread_pool_with_globals<rustc_interface[36d0dc89b6111b4f]::interface::run_compiler<(), rustc_driver_impl[10b09d078f964436]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  34:        0x110f4f7f8 - <<std[dece160403b877c5]::thread::Builder>::spawn_unchecked_<rustc_interface[36d0dc89b6111b4f]::util::run_in_thread_with_globals<rustc_interface[36d0dc89b6111b4f]::util::run_in_thread_pool_with_globals<rustc_interface[36d0dc89b6111b4f]::interface::run_compiler<(), rustc_driver_impl[10b09d078f964436]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[7ef867844175194f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  35:        0x112dc73fc - std::sys::pal::unix::thread::Thread::new::thread_start::he7774aa0ca446eef
  36:        0x19a8caf94 - __pthread_joiner_wake

error: 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.87.0 (17067e9ac 2025-05-09) running on aarch64-apple-darwin

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

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

query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: could not compile `syn` (lib)

Caused by:
  process didn't exit successfully: `/Users/runner/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc --crate-name syn --edition=2021 /Users/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/syn-2.0.101/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debug-assertions=on --cfg 'feature="clone-impls"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="extra-traits"' --cfg 'feature="fold"' --cfg 'feature="full"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="proc-macro"' --cfg 'feature="visit"' --cfg 'feature="visit-mut"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("clone-impls", "default", "derive", "extra-traits", "fold", "full", "parsing", "printing", "proc-macro", "test", "visit", "visit-mut"))' -C metadata=98b74af06e92695d -C extra-filename=-2f3ac4538c18e747 --out-dir /Users/runner/work/rama/rama/target/debug/deps -C strip=debuginfo -L dependency=/Users/runner/work/rama/rama/target/debug/deps --extern proc_macro2=/Users/runner/work/rama/rama/target/debug/deps/libproc_macro2-0304af4502360ec7.rmeta --extern quote=/Users/runner/work/rama/rama/target/debug/deps/libquote-a8a650f1e3baf9ce.rmeta --extern unicode_ident=/Users/runner/work/rama/rama/target/debug/deps/libunicode_ident-a75bc21b0a010fdc.rmeta --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)
warning: build failed, waiting for other jobs to finish...
Backtrace

<backtrace>

@GlenDC GlenDC added 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. C-bug Category: This is a bug. labels Jun 4, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 4, 2025
@workingjubilee
Copy link
Member

how odd.

@workingjubilee workingjubilee added O-AArch64 Armv8-A or later processors in AArch64 mode O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) A-resolve Area: Name/path resolution done by `rustc_resolve` specifically labels Jun 4, 2025
@workingjubilee
Copy link
Member

@GlenDC Does this repro if you change the runner to use nightly?

@GlenDC
Copy link
Contributor Author

GlenDC commented Jun 4, 2025

@GlenDC Does this repro if you change the runner to use nightly?

Not sure, it's not even that consistent, it only happened once that I know so far, for a PR of a contributor. But a retry of the failed job made it succeed immediately, so it might be a hard one to track down.

@workingjubilee
Copy link
Member

oh.

incr comp...?

@GlenDC
Copy link
Contributor Author

GlenDC commented Jun 4, 2025

oh.

incr comp...?

Yes that must be it. But it's also the first time that I see this happening, despite 1.87 already out for a while, so must be an edge case

@lqd
Copy link
Member

lqd commented Jun 4, 2025

This looks to be in a release build where incremental compilation is disabled.

@jieyouxu jieyouxu added S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jun 5, 2025
@madsmtm
Copy link
Contributor

madsmtm commented Jun 6, 2025

Looking at the difference in the CI logs between the failed and the successful build, it seems that it failed while uncompressing the cache (the cache is as far as I can tell the exact same in both builds):

... Restoring cache ...
Cache hit for: v0-rust-test-examples-macos-Darwin-arm64-609b7926-6d0f3eb1
Received 213909504 of 469511203 (45.6%), 202.0 MBs/sec
Received 457179136 of 469511203 (97.4%), 215.1 MBs/sec
Received 469511203 of 469511203 (100.0%), 212.6 MBs/sec
Cache Size: ~448 MB (469511203 B)
/opt/homebrew/bin/gtar -xf /Users/runner/work/_temp/93cae71b-f169-4878-a31e-4eb50b418ecb/cache.tzst -P -C /Users/runner/work/rama/rama --delay-directory-restore --use-compress-program unzstd
/*stdin*\ : Decoding error (36) : Data corruption detected 
/opt/homebrew/bin/gtar: Unexpected EOF in archive
/opt/homebrew/bin/gtar: Error is not recoverable: exiting now
Warning: Failed to restore: "/opt/homebrew/bin/gtar" failed with error: The process '/opt/homebrew/bin/gtar' failed with exit code 2
No cache found.

Since the job continued after this, perhaps rustc tried to use the partly extracted files, and that's why we get the ICE?

@workingjubilee
Copy link
Member

wild.

@workingjubilee
Copy link
Member

And we're not in charge of that gtar invocation so we can't error on seeing that stdio, right?

@madsmtm
Copy link
Contributor

madsmtm commented Jun 7, 2025

No, this is from GitHub's actions/cache. There's been a similar issue about it in the past, see actions/cache#403.

@madsmtm
Copy link
Contributor

madsmtm commented Jun 7, 2025

If gtar fails here, they should IMO reset the cached directories.

@workingjubilee
Copy link
Member

....wild.

@workingjubilee workingjubilee added C-external-bug Category: issue that is caused by bugs in software beyond our control and removed C-bug Category: This is a bug. S-needs-repro Status: This issue has no reproduction and needs a reproduction to make progress. labels Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name/path resolution done by `rustc_resolve` specifically C-external-bug Category: issue that is caused by bugs in software beyond our control I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ O-AArch64 Armv8-A or later processors in AArch64 mode O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) 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