Skip to content

ICE in nightly: "Failed to get crate data for crate15" when proc-macro references a dependency in a doc comment #120909

Closed

Description

@parasyte

Code

Minimal repro: https://github.com/parasyte/crash-rustc

This ICE needs a specific project setup with a proc-macro that has a doc-comment referencing one of its crate dependencies. The git repo above is a full example, but this will work, too:

Cargo.toml

[package]
name = "crash-rustc"
version = "0.1.0"
edition = "2021"

[lib]
proc-macro = true

[dependencies]
base64 = "0.21"

lib.rs

//! [`base64`]

The error only seems to happen with crates that do not contain hyphens in the name. I don't know, I haven't really dug into it. base64 is a popular crate, it doesn't have any dependencies, and it exhibits the crash. The git repo above has a totally empty dependency named crashy, so it doesn't really matter what the dependency itself contains.

Meta

rustc --version --verbose:

rustc 1.78.0-nightly (6cc484351 2024-02-10)
binary: rustc
commit-hash: 6cc4843512d613f51ec81aba689180c31b0b28b6
commit-date: 2024-02-10
host: x86_64-pc-windows-msvc
release: 1.78.0-nightly
LLVM version: 17.0.6

Error output

thread 'rustc' panicked at compiler\rustc_metadata\src\creader.rs:195:32:
Failed to get crate data for crate15
stack backtrace:
   0:     0x7ff93f662972 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc99197c9b2d6b3ef
   1:     0x7ff93f69563d - core::fmt::write::h2264ae2ff10f9d05
   2:     0x7ff93f658ff1 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h32e7988c01068207
   3:     0x7ff93f66279a - std::sys_common::backtrace::lock::h4ad46ad9c5ad405f
   4:     0x7ff93f665b59 - std::panicking::default_hook::h0ba92da552d0410c
   5:     0x7ff93f665815 - std::panicking::default_hook::h0ba92da552d0410c
   6:     0x7ff926429b15 - <tracing_subscriber[1a895b7d438f8c1d]::util::TryInitError as core[1a9ca60cf5f5707d]::fmt::Display>::fmt
   7:     0x7ff93f666163 - std::panicking::rust_panic_with_hook::haa5b2a955d6e9910
   8:     0x7ff93f666009 - <std::panicking::begin_panic_handler::StaticStrPayload as core::panic::PanicPayload>::take_box::h1fc7089d2c1f3293
   9:     0x7ff93f663279 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc99197c9b2d6b3ef
  10:     0x7ff93f665cd6 - rust_begin_unwind
  11:     0x7ff93f6bb737 - core::panicking::panic_fmt::h3b76f05d3256bd9f
  12:     0x7ff92516a3db - <rustc_metadata[2f9ed4c92abfca28]::creader::CStore as rustc_session[3bf59b46651f552d]::cstore::CrateStore>::stable_crate_id
  13:     0x7ff9262656fd - <rustc_middle[9193cad70d79b3d1]::ty::visit::LateBoundRegionsCollector as rustc_type_ir[fbb395866ffc979a]::visit::TypeVisitor<rustc_middle[9193cad70d79b3d1]::ty::context::TyCtxt>>::visit_ty
  14:     0x7ff9252a6b00 - <rustc_middle[9193cad70d79b3d1]::query::on_disk_cache::OnDiskCache>::serialize
  15:     0x7ff9252d58a3 - <rustc_middle[9193cad70d79b3d1]::ty::context::TyCtxt>::serialize_query_result_cache
  16:     0x7ff925112dda - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_work_product_index
  17:     0x7ff925116c73 - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_work_product_index
  18:     0x7ff92510ff77 - rustc_incremental[f90b8bd0ccf92d0f]::persist::load::setup_dep_graph
  19:     0x7ff925119c52 - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_work_product_index
  20:     0x7ff9251105b0 - rustc_incremental[f90b8bd0ccf92d0f]::persist::load::setup_dep_graph
  21:     0x7ff925119e0b - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_work_product_index
  22:     0x7ff92511175f - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_dep_graph
  23:     0x7ff9224601de - rustc_driver_impl[b32f8017ee93a888]::main
  24:     0x7ff9224699d1 - rustc_driver_impl[b32f8017ee93a888]::main
  25:     0x7ff92245c48d - rustc_driver_impl[b32f8017ee93a888]::main
  26:     0x7ff92245def8 - rustc_driver_impl[b32f8017ee93a888]::main
  27:     0x7ff92249b74f - rustc_driver_impl[b32f8017ee93a888]::main
  28:     0x7ff92249a678 - rustc_driver_impl[b32f8017ee93a888]::main
  29:     0x7ff93f676b1c - std::sys::pal::windows::thread::Thread::new::h12285e0320d9cc9c
  30:     0x7ff9d256257d - BaseThreadInitThunk
  31:     0x7ff9d420aa58 - RtlUserThreadStart

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: please attach the file at `C:\Users\jay\Desktop\crash-rustc\rustc-ice-2024-02-11T02_19_09-221228.txt` to your bug report

note: compiler flags: --crate-type proc-macro -C prefer-dynamic -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:
end of query stack
Backtrace

stack backtrace:
   0:     0x7ff93f662972 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc99197c9b2d6b3ef
   1:     0x7ff93f69563d - core::fmt::write::h2264ae2ff10f9d05
   2:     0x7ff93f658ff1 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h32e7988c01068207
   3:     0x7ff93f66279a - std::sys_common::backtrace::lock::h4ad46ad9c5ad405f
   4:     0x7ff93f665b59 - std::panicking::default_hook::h0ba92da552d0410c
   5:     0x7ff93f665815 - std::panicking::default_hook::h0ba92da552d0410c
   6:     0x7ff926429b15 - <tracing_subscriber[1a895b7d438f8c1d]::util::TryInitError as core[1a9ca60cf5f5707d]::fmt::Display>::fmt
   7:     0x7ff93f666163 - std::panicking::rust_panic_with_hook::haa5b2a955d6e9910
   8:     0x7ff93f666009 - <std::panicking::begin_panic_handler::StaticStrPayload as core::panic::PanicPayload>::take_box::h1fc7089d2c1f3293
   9:     0x7ff93f663279 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc99197c9b2d6b3ef
  10:     0x7ff93f665cd6 - rust_begin_unwind
  11:     0x7ff93f6bb737 - core::panicking::panic_fmt::h3b76f05d3256bd9f
  12:     0x7ff92516a3db - <rustc_metadata[2f9ed4c92abfca28]::creader::CStore as rustc_session[3bf59b46651f552d]::cstore::CrateStore>::stable_crate_id
  13:     0x7ff9262656fd - <rustc_middle[9193cad70d79b3d1]::ty::visit::LateBoundRegionsCollector as rustc_type_ir[fbb395866ffc979a]::visit::TypeVisitor<rustc_middle[9193cad70d79b3d1]::ty::context::TyCtxt>>::visit_ty
  14:     0x7ff9252a6b00 - <rustc_middle[9193cad70d79b3d1]::query::on_disk_cache::OnDiskCache>::serialize
  15:     0x7ff9252d58a3 - <rustc_middle[9193cad70d79b3d1]::ty::context::TyCtxt>::serialize_query_result_cache
  16:     0x7ff925112dda - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_work_product_index
  17:     0x7ff925116c73 - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_work_product_index
  18:     0x7ff92510ff77 - rustc_incremental[f90b8bd0ccf92d0f]::persist::load::setup_dep_graph
  19:     0x7ff925119c52 - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_work_product_index
  20:     0x7ff9251105b0 - rustc_incremental[f90b8bd0ccf92d0f]::persist::load::setup_dep_graph
  21:     0x7ff925119e0b - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_work_product_index
  22:     0x7ff92511175f - rustc_incremental[f90b8bd0ccf92d0f]::persist::save::save_dep_graph
  23:     0x7ff9224601de - rustc_driver_impl[b32f8017ee93a888]::main
  24:     0x7ff9224699d1 - rustc_driver_impl[b32f8017ee93a888]::main
  25:     0x7ff92245c48d - rustc_driver_impl[b32f8017ee93a888]::main
  26:     0x7ff92245def8 - rustc_driver_impl[b32f8017ee93a888]::main
  27:     0x7ff92249b74f - rustc_driver_impl[b32f8017ee93a888]::main
  28:     0x7ff92249a678 - rustc_driver_impl[b32f8017ee93a888]::main
  29:     0x7ff93f676b1c - std::sys::pal::windows::thread::Thread::new::h12285e0320d9cc9c
  30:     0x7ff9d256257d - BaseThreadInitThunk
  31:     0x7ff9d420aa58 - RtlUserThreadStart

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Feb 11, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Feb 11, 2024
  3. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Feb 11, 2024
  4. saethlin commented on Feb 11, 2024

    @saethlin
    Member

    searched nightlies: from nightly-2024-02-08 to nightly-2024-02-09
    regressed nightly: nightly-2024-02-09
    searched commit range: 8ace7ea...98aa362
    regressed commit: 1280928

    bisected with cargo-bisect-rustc v0.6.7

    Host triple: x86_64-unknown-linux-gnu
    Reproduce with:

    cargo bisect-rustc --start=2024-02-08 --end=2024-02-09 

    This looks similar to #120830

  5. self-assigned this
    on Feb 13, 2024
  6. petrochenkov commented on Feb 15, 2024

    @petrochenkov
    Contributor

    Fixed in #121167.

  7. justsmth commented on Feb 19, 2024

    @justsmth

    We're seeing this panic in our CI as well: https://github.com/aws/aws-lc/actions/runs/7962059507/job/21734658056?pr=1440#step:13:103

    thread 'rustc' panicked at compiler/rustc_metadata/src/creader.rs:195:32:
    Failed to get crate data for crate34
    

    I'm working on reproducing it.

  8. added 3 commits that reference this issue on Feb 20, 2024
  9. added a commit that references this issue on Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions