rust-lang / rust-lang/rust

[ICE]: rustdoc: `Deref impl without Target type`

Open
#156,484 0 comments 0 reactions 1 assignee View on GitHub

@GuillaumeGomez is already working on this.

Since Jun 1, 2026.

A-specialization C-bug F-specialization I-ICE needs-triage T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

Code
#![feature(specialization)]
use std::ops::Deref;
struct TagA;
struct Foo<T> {
    data_pd: T,
}
impl<T> Deref for Foo<T> {
    type Target = i32;
    fn deref(&self) -> &Self::Target {
        self
    }
}
impl Deref for Foo<TagA> {}
fn main() {}

Meta

rustc --version --verbose:

rustdoc 1.97.0-nightly (64a965e90 2026-05-11)
binary: rustdoc
commit-hash: 64a965e9013a9d14e83c4d370af26f6be6bf96fb
commit-date: 2026-05-11
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4
Error output
<output>
Backtrace

warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
 --> code.rs:1:12
  |
1 | #![feature(specialization)]
  |            ^^^^^^^^^^^^^^
  |
  = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
  = help: consider using `min_specialization` instead, which is more stable and complete
  = note: `#[warn(incomplete_features)]` on by default


thread 'rustc' (3512757) panicked at src/librustdoc/passes/collect_trait_impls.rs:169:18:
Deref impl without Target type
stack backtrace:
   0:     0x7f09a7897ee9 - <<std[89f22c552bc5066a]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[8ad6c24798842d79]::fmt::Display>::fmt
   1:     0x7f09a801b108 - core[8ad6c24798842d79]::fmt::write
   2:     0x7f09a78aeb06 - <std[89f22c552bc5066a]::sys::stdio::unix::Stderr as std[89f22c552bc5066a]::io::Write>::write_fmt
   3:     0x7f09a786df2e - std[89f22c552bc5066a]::panicking::default_hook::{closure#0}
   4:     0x7f09a788b5a3 - std[89f22c552bc5066a]::panicking::default_hook
   5:     0x7f09a676c511 - std[89f22c552bc5066a]::panicking::update_hook::<alloc[eb280b9ba06e18cf]::boxed::Box<rustc_driver_impl[234634a74b90a67c]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f09a788b882 - std[89f22c552bc5066a]::panicking::panic_with_hook
   7:     0x7f09a786dff2 - std[89f22c552bc5066a]::panicking::panic_handler::{closure#0}
   8:     0x7f09a7864cf9 - std[89f22c552bc5066a]::sys::backtrace::__rust_end_short_backtrace::<std[89f22c552bc5066a]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f09a786fa5d - __rustc[75ff3fde40943ffb]::rust_begin_unwind
  10:     0x7f09a4afc16c - core[8ad6c24798842d79]::panicking::panic_fmt
  11:     0x7f09a537ff64 - core[8ad6c24798842d79]::option::expect_failed
  12:     0x55b583bcbc55 - rustdoc[d2f483044280a0b2]::passes::collect_trait_impls::collect_trait_impls
  13:     0x55b583b6ec6a - rustdoc[d2f483044280a0b2]::core::run_global_ctxt
  14:     0x55b583a88371 - rustdoc[d2f483044280a0b2]::main_args::{closure#2}::{closure#0}
  15:     0x55b583a80b2e - rustc_interface[e735d0cf28bd6984]::interface::run_compiler::<(), rustdoc[d2f483044280a0b2]::main_args::{closure#2}>::{closure#1}
  16:     0x55b5839b70e6 - std[89f22c552bc5066a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[e735d0cf28bd6984]::util::run_in_thread_with_globals<rustc_interface[e735d0cf28bd6984]::util::run_in_thread_pool_with_globals<rustc_interface[e735d0cf28bd6984]::interface::run_compiler<(), rustdoc[d2f483044280a0b2]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  17:     0x55b583ac5ecd - <std[89f22c552bc5066a]::thread::lifecycle::spawn_unchecked<rustc_interface[e735d0cf28bd6984]::util::run_in_thread_with_globals<rustc_interface[e735d0cf28bd6984]::util::run_in_thread_pool_with_globals<rustc_interface[e735d0cf28bd6984]::interface::run_compiler<(), rustdoc[d2f483044280a0b2]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[8ad6c24798842d79]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  18:     0x7f09a913ba2c - <std[89f22c552bc5066a]::sys::thread::unix::Thread>::new::thread_start
  19:     0x7f09a289697a - <unknown>
  20:     0x7f09a291a2bc - <unknown>
  21:                0x0 - <unknown>

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 `/home/matthias/vcs/github/CRED/rustc-ice-2026-05-12T05_30_01-3512748.txt` to your bug report

note: rustc 1.97.0-nightly (64a965e90 2026-05-11) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
warning: 1 warning emitted

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.