Skip to content

rustdoc: assertion failed: !name.is_empty() #140026

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

Closed
kpreid opened this issue Apr 19, 2025 · 6 comments · Fixed by #140052
Closed

rustdoc: assertion failed: !name.is_empty() #140026

kpreid opened this issue Apr 19, 2025 · 6 comments · Fixed by #140052
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@kpreid
Copy link
Contributor

kpreid commented Apr 19, 2025

Code

Run cargo +nightly doc on:

/// [`String::`]
pub struct Foo;
Original non-minimal repro
cargo add [email protected]
cargo +nightly rustdoc -p wgpu-types

Meta

rustc --version --verbose:

rustc 1.86.0 (05f9846f8 2025-03-31)
binary: rustc
commit-hash: 05f9846f893b09a1be1fc8560e33fc3c815cfecb
commit-date: 2025-03-31
host: aarch64-apple-darwin
release: 1.86.0
LLVM version: 19.1.7

Error output

thread 'rustc' panicked at compiler/rustc_middle/src/ty/assoc.rs:253:9:
assertion failed: !name.is_empty()
stack backtrace:
   0:        0x1114c4db0 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::ha26fa7c0f8baf7a4
   1:        0x10eb4b510 - core::fmt::write::h8eff90b819ed25ac
   2:        0x1114b9b90 - std::io::Write::write_fmt::hc3767759e8313866
   3:        0x1114c4c70 - std::sys::backtrace::BacktraceLock::print::h5ab5bdfc8c7040c6
   4:        0x1114c94c0 - std::panicking::default_hook::{{closure}}::h3ff3b576237b0679
   5:        0x1114c918c - std::panicking::default_hook::h2517e562906dc496
   6:        0x10f68d2c8 - std[b96ff11cec95bebb]::panicking::update_hook::<alloc[10845a2db80e37c3]::boxed::Box<rustc_driver_impl[1cdaafc69be13d9e]::install_ice_hook::{closure#1}>>::{closure#0}
   7:        0x1114c9eac - std::panicking::rust_panic_with_hook::hdf5ea4a7520fe9b8
   8:        0x1114c9a78 - std::panicking::begin_panic_handler::{{closure}}::h7e667cf4bf22d5a9
   9:        0x1114c5248 - std::sys::backtrace::__rust_end_short_backtrace::h6ac6505b1a15fed1
  10:        0x1114c9768 - __rustc[e5679b3fd213e125]::rust_begin_unwind
  11:        0x114103028 - core::panicking::panic_fmt::h0d9b963f0cbbd487
  12:        0x114103098 - core::panicking::panic::h9fec57903899a361
  13:        0x1102be8fc - <rustc_middle[b00788c921925d5f]::ty::assoc::AssocItems>::filter_by_name_unhygienic
  14:        0x103064668 - rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::filter_assoc_items_by_name_and_namespace
  15:        0x102f099e0 - <core[77d52d671b80b66]::iter::adapters::map::Map<core[77d52d671b80b66]::iter::adapters::flatten::FlatMap<core[77d52d671b80b66]::slice::iter::Iter<rustc_span[5eba1f9f6065b66a]::def_id::DefId>, core[77d52d671b80b66]::iter::adapters::filter::Filter<core[77d52d671b80b66]::iter::adapters::map::Map<core[77d52d671b80b66]::iter::adapters::map_while::MapWhile<core[77d52d671b80b66]::slice::iter::Iter<u32>, <rustc_data_structures[afa636c047cbec44]::sorted_map::index_map::SortedIndexMultiMap<u32, core[77d52d671b80b66]::option::Option<rustc_span[5eba1f9f6065b66a]::symbol::Symbol>, rustc_middle[b00788c921925d5f]::ty::assoc::AssocItem>>::get_by_key_enumerated::{closure#1}>, <rustc_data_structures[afa636c047cbec44]::sorted_map::index_map::SortedIndexMultiMap<u32, core[77d52d671b80b66]::option::Option<rustc_span[5eba1f9f6065b66a]::symbol::Symbol>, rustc_middle[b00788c921925d5f]::ty::assoc::AssocItem>>::get_by_key::{closure#0}>, rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::filter_assoc_items_by_name_and_namespace::{closure#0}>, <rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::LinkCollector>::resolve_associated_item::{closure#2}>, <rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::LinkCollector>::resolve_associated_item::{closure#3}> as core[77d52d671b80b66]::iter::traits::iterator::Iterator>::next
  16:        0x1030671c4 - <rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::LinkCollector>::resolve_associated_item
  17:        0x103065cc0 - <rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::LinkCollector>::resolve
  18:        0x10306abbc - <rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::LinkCollector>::resolve_link
  19:        0x1030b4284 - <rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::LinkCollector>::resolve_links
  20:        0x103091448 - <rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::LinkCollector as rustdoc[535d2b71f692d26c]::visit::DocVisitor>::visit_inner_recur
  21:        0x103091480 - <rustdoc[535d2b71f692d26c]::passes::collect_intra_doc_links::LinkCollector as rustdoc[535d2b71f692d26c]::visit::DocVisitor>::visit_inner_recur
  22:        0x102fb65e8 - rustdoc[535d2b71f692d26c]::core::run_global_ctxt
  23:        0x103099f88 - rustdoc[535d2b71f692d26c]::main_args::{closure#2}::{closure#0}
  24:        0x102e83cb8 - rustc_interface[657d728ad44a5017]::interface::run_compiler::<(), rustdoc[535d2b71f692d26c]::main_args::{closure#2}>::{closure#1}
  25:        0x102e19dfc - std[b96ff11cec95bebb]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[657d728ad44a5017]::util::run_in_thread_with_globals<rustc_interface[657d728ad44a5017]::util::run_in_thread_pool_with_globals<rustc_interface[657d728ad44a5017]::interface::run_compiler<(), rustdoc[535d2b71f692d26c]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  26:        0x102e95e74 - <<std[b96ff11cec95bebb]::thread::Builder>::spawn_unchecked_<rustc_interface[657d728ad44a5017]::util::run_in_thread_with_globals<rustc_interface[657d728ad44a5017]::util::run_in_thread_pool_with_globals<rustc_interface[657d728ad44a5017]::interface::run_compiler<(), rustdoc[535d2b71f692d26c]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[77d52d671b80b66]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:        0x1114cd3b8 - std::sys::pal::unix::thread::Thread::new::thread_start::h9c1a2a521bb44799
  28:        0x19d93dc0c - __pthread_cond_wait

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-rustdoc&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/Users/kpreid/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-types-25.0.0/rustc-ice-2025-04-19T02_38_48-35587.txt` to your bug report

note: compiler flags: --crate-type lib

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

query stack during panic:
end of query stack
error: could not document `wgpu-types`

@rustbot label +regression-from-stable-to-nightly

@kpreid kpreid 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 Apr 19, 2025
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 19, 2025
@jieyouxu jieyouxu added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 19, 2025
@compiler-errors compiler-errors added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Apr 19, 2025
@kpreid
Copy link
Contributor Author

kpreid commented Apr 19, 2025

Minimized to:

/// [`String::`]
pub struct Foo;

@rustbot label -E-needs-mcve

@rustbot rustbot removed the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Apr 19, 2025
@jieyouxu jieyouxu added A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 19, 2025
@apiraino
Copy link
Contributor

apiraino commented Apr 19, 2025

I've bisected that repro just running it with: rustdoc <somefile.rs>. Bisection seems to point at commit f433fa4

cc @nnethercote and @fee1-dead for #139669

bisected with cargo-bisect-rustc v0.6.9

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

cargo bisect-rustc --without-cargo --preserve --start 1.85.0 --script test.sh 

@apiraino
Copy link
Contributor

Assigning priority (discussion on Zulip).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 19, 2025
@fmease
Copy link
Member

fmease commented Apr 19, 2025

cc [@]nnethercote and [@]fmease for [#]139669

mis-ping, I didn't review that one ;-)

@jieyouxu jieyouxu added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 19, 2025
@GuillaumeGomez
Copy link
Member

Taking a look.

@GuillaumeGomez
Copy link
Member

Opened #140052.

jhpratt added a commit to jhpratt/rust that referenced this issue Apr 21, 2025
…ercote

Fix error when an intra doc link is trying to resolve an empty associated item

Fixes rust-lang#140026.

Assigning `@nnethercote` since they're the one who wrote the initial change.

I updated rustdoc code instead of compiler's because I think it makes more sense that the caller ensures on their side that the name they're looking for isn't empty.

r? `@nnethercote`
jieyouxu added a commit to jieyouxu/rust that referenced this issue Apr 21, 2025
…ercote

Fix error when an intra doc link is trying to resolve an empty associated item

Fixes rust-lang#140026.

Assigning ``@nnethercote`` since they're the one who wrote the initial change.

I updated rustdoc code instead of compiler's because I think it makes more sense that the caller ensures on their side that the name they're looking for isn't empty.

r? ``@nnethercote``
@bors bors closed this as completed in 96ac7d8 Apr 21, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 21, 2025
Rollup merge of rust-lang#140052 - GuillaumeGomez:fix-140026, r=nnethercote

Fix error when an intra doc link is trying to resolve an empty associated item

Fixes rust-lang#140026.

Assigning ```@nnethercote``` since they're the one who wrote the initial change.

I updated rustdoc code instead of compiler's because I think it makes more sense that the caller ensures on their side that the name they're looking for isn't empty.

r? ```@nnethercote```
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Apr 22, 2025
Fix error when an intra doc link is trying to resolve an empty associated item

Fixes rust-lang/rust#140026.

Assigning ```@nnethercote``` since they're the one who wrote the initial change.

I updated rustdoc code instead of compiler's because I think it makes more sense that the caller ensures on their side that the name they're looking for isn't empty.

r? ```@nnethercote```
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this issue Apr 24, 2025
Fix error when an intra doc link is trying to resolve an empty associated item

Fixes rust-lang/rust#140026.

Assigning ```@nnethercote``` since they're the one who wrote the initial change.

I updated rustdoc code instead of compiler's because I think it makes more sense that the caller ensures on their side that the name they're looking for isn't empty.

r? ```@nnethercote```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intra-doc-links Area: Intra-doc links, the ability to link to items in docs by name C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants