Skip to content

[ICE]: rustdoc unexpected async fn return type #157040

@matthiaskrgr

Description

@matthiaskrgr

Code

rustdoc file.rs --edition=2018
this compiles with rustc but ices rustdoc

#![feature(fn_delegation)]

trait Trait {
    async fn foo(&self) {
        
    }
}
reuse Trait::foo;

fn main() {}

Meta

rustc --version --verbose:

rustdoc 1.98.0-nightly (57d06900f 2026-05-27)
binary: rustdoc
commit-hash: 57d06900fd7d9ee06d3a7f323bb77f17ab3cfaf8
commit-date: 2026-05-27
host: x86_64-unknown-linux-gnu
release: 1.98.0-nightly
LLVM version: 22.1.6

Error output

warning: the feature `fn_delegation` is incomplete and may not be safe to use and/or cause compiler crashes
 --> rustdoc.rs:1:12
  |
1 | #![feature(fn_delegation)]
  |            ^^^^^^^^^^^^^
  |
  = note: see issue #118212 <https://github.com/rust-lang/rust/issues/118212> for more information
  = note: `#[warn(incomplete_features)]` on by default


thread 'rustc' (3518636) panicked at src/librustdoc/clean/types.rs:1585:13:
unexpected async fn return type
stack backtrace:
   0:     0x7f345829a939 - <<std[eaf14822774233d1]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f7871c8529df0cd1]::fmt::Display>::fmt
   1:     0x7f3458a20888 - core[f7871c8529df0cd1]::fmt::write
   2:     0x7f34582b1626 - <std[eaf14822774233d1]::sys::stdio::unix::Stderr as std[eaf14822774233d1]::io::Write>::write_fmt
   3:     0x7f3458270b5e - std[eaf14822774233d1]::panicking::default_hook::{closure#0}
   4:     0x7f345828e273 - std[eaf14822774233d1]::panicking::default_hook
   5:     0x7f345708ade1 - std[eaf14822774233d1]::panicking::update_hook::<alloc[8b32aeac9c6adb]::boxed::Box<rustc_driver_impl[535bed017e0d96c2]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f345828e552 - std[eaf14822774233d1]::panicking::panic_with_hook
   7:     0x7f3458270c54 - std[eaf14822774233d1]::panicking::panic_handler::{closure#0}
   8:     0x7f3458267929 - std[eaf14822774233d1]::sys::backtrace::__rust_end_short_backtrace::<std[eaf14822774233d1]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f345827268d - __rustc[eb98ed7eb95e5295]::rust_begin_unwind
  10:     0x7f3454ebcf2c - core[f7871c8529df0cd1]::panicking::panic_fmt
  11:     0x556d26809bdc - <rustdoc[37593b338b77beff]::clean::types::Type>::sugared_async_return_type
  12:     0x556d2681fcd9 - rustdoc[37593b338b77beff]::clean::clean_function
  13:     0x556d2674ad4a - rustdoc[37593b338b77beff]::clean::clean_maybe_renamed_item::{closure#0}
  14:     0x556d26827340 - rustdoc[37593b338b77beff]::clean::clean_doc_module
  15:     0x556d268191fe - rustdoc[37593b338b77beff]::core::run_global_ctxt
  16:     0x556d2672e481 - rustdoc[37593b338b77beff]::main_args::{closure#2}::{closure#0}
  17:     0x556d26725437 - rustc_interface[83c0f8112acc708a]::interface::run_compiler::<(), rustdoc[37593b338b77beff]::main_args::{closure#2}>::{closure#1}
  18:     0x556d266574a6 - std[eaf14822774233d1]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[83c0f8112acc708a]::util::run_in_thread_with_globals<rustc_interface[83c0f8112acc708a]::util::run_in_thread_pool_with_globals<rustc_interface[83c0f8112acc708a]::interface::run_compiler<(), rustdoc[37593b338b77beff]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  19:     0x556d2676d29d - <std[eaf14822774233d1]::thread::lifecycle::spawn_unchecked<rustc_interface[83c0f8112acc708a]::util::run_in_thread_with_globals<rustc_interface[83c0f8112acc708a]::util::run_in_thread_pool_with_globals<rustc_interface[83c0f8112acc708a]::interface::run_compiler<(), rustdoc[37593b338b77beff]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[f7871c8529df0cd1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  20:     0x7f3459b9d1ec - <std[eaf14822774233d1]::sys::thread::unix::Thread>::new::thread_start
  21:     0x7f34530981b9 - <unknown>
  22:     0x7f345311d21c - <unknown>
  23:                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 `/tmp/im/rustc-ice-2026-05-28T04_29_37-3518627.txt` to your bug report

note: rustc 1.98.0-nightly (57d06900f 2026-05-27) running on x86_64-unknown-linux-gnu

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

<backtrace>

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitC-bugCategory: This is a bug.F-fn_delegation`#![feature(fn_delegation)]`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.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions