This is a regression in the latest nightly: cargo doc works on stable (1.95.0)
and crashes on nightly 2026-07-01.
We hit this when our CI started failing on cargo doc
(failing job).
The Slint crate depends on wgpu, and wgpu
contains pub extern crate wgpu_core as wgc;. When Slint re-exports wgpu and
rustdoc inlines that re-export, it crashes. The reduced reproducer below has no
dependency on wgpu at all.
Code
The ICE needs two crates: user depends on dep. dep re-exports another crate
with pub extern crate, and user pulls that in with a glob import. Running
cargo doc on user crashes rustdoc.
dep/lib.rs:
// Any `pub extern crate ... as ...;` triggers it. `std` keeps the repro dependency-free.
pub extern crate std as wgc;
user/lib.rs (with dep as a dependency):
Then run:
cargo +nightly doc --no-deps -p user
Meta
rustc --version --verbose:
rustc 1.98.0-nightly (4c9d2bfe4 2026-07-01)
binary: rustc
commit-hash: 4c9d2bfe4ad7a65669098754964aaebe0ec1ced2
commit-date: 2026-07-01
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.8
Error output
Documenting user v0.1.0 (/tmp/pubextern/user)
thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/decoder.rs:1404:17:
assertion `left == right` failed
left: TypeNs("wgc")
right: Ctor
Backtrace
thread 'rustc' panicked at /rustc/4c9d2bfe4ad7a65669098754964aaebe0ec1ced2/compiler/rustc_metadata/src/rmeta/decoder.rs:1404:17:
assertion `left == right` failed
left: TypeNs("wgc")
right: Ctor
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed::<rustc_hir::definitions::DefPathData, rustc_hir::definitions::DefPathData>
4: rustc_metadata::rmeta::decoder::cstore_impl::provide_extern::attrs_for_def
5: <rustc_middle::ty::context::TyCtxt>::get_all_attrs::<rustc_span::def_id::DefId>
6: rustdoc::clean::inline::build_module_items
7: rustdoc::clean::clean_use_statement_inner
8: rustdoc::clean::clean_use_statement
9: rustdoc::clean::clean_doc_module
10: rustdoc::core::run_global_ctxt
11: rustdoc::main_args::{closure#2}::{closure#0}
12: rustc_interface::interface::run_compiler::<(), rustdoc::main_args::{closure#2}>::{closure#1}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [attrs_for_def] collecting attributes of `dep::wgc`
end of query stack
Likely cause
Looking at the recent history, i'd think it was introduced by #158569 (but i haven't confirmed it)
This is a regression in the latest nightly:
cargo docworks on stable (1.95.0)and crashes on nightly
2026-07-01.We hit this when our CI started failing on
cargo doc(failing job).
The Slint crate depends on
wgpu, andwgpucontains
pub extern crate wgpu_core as wgc;. When Slint re-exportswgpuandrustdoc inlines that re-export, it crashes. The reduced reproducer below has no
dependency on
wgpuat all.Code
The ICE needs two crates:
userdepends ondep.depre-exports another cratewith
pub extern crate, anduserpulls that in with a glob import. Runningcargo doconusercrashes rustdoc.dep/lib.rs:user/lib.rs(withdepas a dependency):Then run:
Meta
rustc --version --verbose:Error output
Backtrace
Likely cause
Looking at the recent history, i'd think it was introduced by #158569 (but i haven't confirmed it)