Skip to content

ICE: rustdoc unwrap None when documenting dependency with GATs #94009 #94683

@MingweiSamuel

Description

@MingweiSamuel

Code

Code here, big project, but only need to run -p kvs or -p relalg to cause the error. Maybe will try to minimize later.
hydro-project/hydro@d39d44d

Minimized example: https://github.com/MingweiSamuel/rustdoc-ice

my_dependency/src/lib.rs

#![feature(generic_associated_types)] pub trait MyTrait { type MyGat<'s> where Self: 's; fn my_fn(&self) -> Self::MyGat<'_>; } impl MyTrait for () { type MyGat<'s> = &'s (); fn my_fn(&self) -> Self::MyGat<'_> { &() } }

my_package/src/lib.rs

use my_dependency;

Command:

cargo doc 

Meta

Error output

See backtrace

Backtrace

$ cargo doc Checking my_dependency v0.1.0 (D:\Projects\rustdoc-ice\my_dependency) Documenting my_dependency v0.1.0 (D:\Projects\rustdoc-ice\my_dependency) Documenting my_package v0.1.0 (D:\Projects\rustdoc-ice\my_package) thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src\librustdoc\clean\mod.rs:409:59 stack backtrace: 0: 0x7ff999ab9740 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1b60d32e13dca2c0 1: 0x7ff999aef5ba - core::fmt::write::h956db761fb8891bc 2: 0x7ff999aabe99 - <std::io::IoSliceMut as core::fmt::Debug>::fmt::h8bae511bb1c52660 3: 0x7ff999abcd0b - std::panicking::default_hook::h400a469cdf1f53e7 4: 0x7ff999abc8ec - std::panicking::default_hook::h400a469cdf1f53e7 5: 0x7ff9912b9726 - rustc_driver[96d5aea7497e3b44]::pretty::print_after_hir_lowering 6: 0x7ff999abd5eb - std::panicking::rust_panic_with_hook::haf3e9c505f20c32c 7: 0x7ff999abd302 - <std::panicking::begin_panic_handler::StrPanicPayload as core::panic::BoxMeUp>::get::hf200192ef50e8b12 8: 0x7ff999aba057 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1b60d32e13dca2c0 9: 0x7ff999abd019 - rust_begin_unwind 10: 0x7ff999b22ab5 - core::panicking::panic_fmt::h600d95c087b9120e 11: 0x7ff999b2295c - core::panicking::panic::h4922a2ba3330589b 12: 0x7ff6c097a9ce - <unknown> 13: 0x7ff6c09d5355 - <unknown> 14: 0x7ff6c0b340ef - <unknown> 15: 0x7ff6c0923cb4 - <unknown> 16: 0x7ff6c0af4249 - <unknown> 17: 0x7ff6c0b373b4 - <unknown> 18: 0x7ff6c0995c86 - <unknown> 19: 0x7ff6c09d9d88 - <unknown> 20: 0x7ff6c0a89f50 - <unknown> 21: 0x7ff6c0a9c98b - <unknown> 22: 0x7ff6c0924e41 - <unknown> 23: 0x7ff6c0ae2059 - <unknown> 24: 0x7ff6c0aa162e - <unknown> 25: 0x7ff6c08e5332 - <unknown> 26: 0x7ff6c0b4ccf5 - <unknown> 27: 0x7ff6c0a5936c - <unknown> 28: 0x7ff6c0b4fd0f - <unknown> 29: 0x7ff6c084ba08 - <unknown> 30: 0x7ff6c0b74247 - <unknown> 31: 0x7ff6c08b7168 - <unknown> 32: 0x7ff999acc6dc - std::sys::windows::thread::Thread::new::h0128d9e8937707db 33: 0x7ffa02817034 - BaseThreadInitThunk 34: 0x7ffa02c02651 - RtlUserThreadStart error: internal compiler error: unexpected panic note: 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.61.0-nightly (c274e4969 2022-03-05) running on x86_64-pc-windows-msvc 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 `my_package` Caused by: process didn't exit successfully: `rustdoc --edition=2021 --crate-type lib --crate-name my_package 'my_package\src\lib.rs' -o 'D:\Projects\rustdoc-ice\target\doc' --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat -C metadata=3198935b0623bdb3 -L 'dependency=D:\Projects\rustdoc-ice\target\debug\deps' --extern 'my_dependency=D:\Projects\rustdoc-ice\target\debug\deps\libmy_dependency-190dee38e23bdfd7.rmeta' --crate-version 0.1.0` (exit code: 101) 

Metadata

Metadata

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