Skip to content

ICE: rustdoc: Ty::fn_sig() called on non-fn type, Znormalize-docs #102828

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

trait CallableStr {
    type T: Fn(&str);
}
impl CallableStr for () {
    type T = fn(&str);

}
impl CallableStr for i32 {
    type T = <() as CallableStr>::T;
}

fn main() {}

Meta

rustc --version --verbose:

rustdoc 1.66.0-nightly (8b0c05d9a 2022-10-07)
binary: rustdoc
commit-hash: 8b0c05d9ad7121cdb97600f261bcd5f04c8db20d
commit-date: 2022-10-07
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.2

Error output

rustdoc explicit_auto_deref.rs -Znormalize-docs

<output>
Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:1940:18: Ty::fn_sig() called on non-fn type: <() as CallableStr>::T

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/compiler/rustc_errors/src/lib.rs:1503:9
stack backtrace:
   0:     0x7fe4d7a554a0 - std::backtrace_rs::backtrace::libunwind::trace::h6ac107c909471c28
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7fe4d7a554a0 - std::backtrace_rs::backtrace::trace_unsynchronized::h9d8f9eecf7bd07b4
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe4d7a554a0 - std::sys_common::backtrace::_print_fmt::h497e45f993ba65f9
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fe4d7a554a0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb86c5b29999790ac
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fe4d7ab032e - core::fmt::write::hfa389bebc6557ad1
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/core/src/fmt/mod.rs:1209:17
   5:     0x7fe4d7a46005 - std::io::Write::write_fmt::hae87a048d5d5f2ab
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/io/mod.rs:1679:15
   6:     0x7fe4d7a58243 - std::sys_common::backtrace::_print::hc9485c72afd62dd5
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fe4d7a58243 - std::sys_common::backtrace::print::h21591f55a523af14
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fe4d7a58243 - std::panicking::default_hook::{{closure}}::h2b5b922e97dd7c0a
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/panicking.rs:267:22
   9:     0x7fe4d7a57f1a - std::panicking::default_hook::hadbb6bfa14961c76
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/panicking.rs:286:9
  10:     0x7fe4da373061 - <rustc_driver[4acbed0556003bfe]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[bf92a9d07a1f82ee]::ops::function::FnOnce<(&core[bf92a9d07a1f82ee]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fe4d7a58a7b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h13a690e73c3b0f86
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/alloc/src/boxed.rs:1952:9
  12:     0x7fe4d7a58a7b - std::panicking::rust_panic_with_hook::ha1226a1207c3700c
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/panicking.rs:673:13
  13:     0x7fe4db35ade1 - std[23582998930d05ca]::panicking::begin_panic::<rustc_errors[a8ca28330ed09613]::ExplicitBug>::{closure#0}
  14:     0x7fe4db359b16 - std[23582998930d05ca]::sys_common::backtrace::__rust_end_short_backtrace::<std[23582998930d05ca]::panicking::begin_panic<rustc_errors[a8ca28330ed09613]::ExplicitBug>::{closure#0}, !>
  15:     0x7fe4db342816 - std[23582998930d05ca]::panicking::begin_panic::<rustc_errors[a8ca28330ed09613]::ExplicitBug>
  16:     0x7fe4db3568b6 - std[23582998930d05ca]::panic::panic_any::<rustc_errors[a8ca28330ed09613]::ExplicitBug>
  17:     0x7fe4db35567f - <rustc_errors[a8ca28330ed09613]::HandlerInner>::bug::<&alloc[8141def0e225a9f6]::string::String>
  18:     0x7fe4db3551b0 - <rustc_errors[a8ca28330ed09613]::Handler>::bug::<&alloc[8141def0e225a9f6]::string::String>
  19:     0x7fe4db3ace3d - rustc_middle[f6337bff637f89d4]::ty::context::tls::with_context_opt::<rustc_middle[f6337bff637f89d4]::ty::context::tls::with_opt<rustc_middle[f6337bff637f89d4]::util::bug::opt_span_bug_fmt<rustc_span[6b1d43e36522c861]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  20:     0x7fe4db3aed76 - rustc_middle[f6337bff637f89d4]::util::bug::opt_span_bug_fmt::<rustc_span[6b1d43e36522c861]::span_encoding::Span>
  21:     0x7fe4d8cd5263 - rustc_middle[f6337bff637f89d4]::util::bug::bug_fmt
  22:     0x7fe4d918e9f7 - <rustc_middle[f6337bff637f89d4]::ty::Ty>::fn_sig
  23:     0x55f82248543d - rustdoc[cb5b26687d9b8e87]::clean::clean_middle_ty
  24:     0x55f822378454 - <rustdoc[cb5b26687d9b8e87]::core::DocContext>::with_param_env::<rustdoc[cb5b26687d9b8e87]::clean::types::Item, rustdoc[cb5b26687d9b8e87]::clean::clean_impl_item::{closure#0}>
  25:     0x55f8222f4620 - <alloc[8141def0e225a9f6]::vec::Vec<rustdoc[cb5b26687d9b8e87]::clean::types::Item> as alloc[8141def0e225a9f6]::vec::spec_from_iter::SpecFromIter<rustdoc[cb5b26687d9b8e87]::clean::types::Item, core[bf92a9d07a1f82ee]::iter::adapters::map::Map<core[bf92a9d07a1f82ee]::iter::adapters::filter::Filter<core[bf92a9d07a1f82ee]::iter::adapters::map::Map<core[bf92a9d07a1f82ee]::slice::iter::Iter<rustc_hir[a50390e77d36584]::hir::ImplItemRef>, rustdoc[cb5b26687d9b8e87]::clean::inline::build_impl::{closure#0}>, rustdoc[cb5b26687d9b8e87]::clean::inline::build_impl::{closure#1}>, rustdoc[cb5b26687d9b8e87]::clean::inline::build_impl::{closure#2}>>>::from_iter
  26:     0x55f8222759ff - rustdoc[cb5b26687d9b8e87]::clean::inline::build_impl
  27:     0x55f82237ca1a - <rustdoc[cb5b26687d9b8e87]::core::DocContext>::with_all_trait_impls::<rustdoc[cb5b26687d9b8e87]::passes::collect_trait_impls::collect_trait_impls::{closure#4}>
  28:     0x55f822451771 - rustdoc[cb5b26687d9b8e87]::passes::collect_trait_impls::collect_trait_impls
  29:     0x55f8223b215d - <rustc_session[df7db77a8315053d]::session::Session>::time::<rustdoc[cb5b26687d9b8e87]::clean::types::Crate, rustdoc[cb5b26687d9b8e87]::core::run_global_ctxt::{closure#7}>
  30:     0x55f822380913 - rustdoc[cb5b26687d9b8e87]::core::run_global_ctxt
  31:     0x55f8223b243f - <rustc_session[df7db77a8315053d]::session::Session>::time::<(rustdoc[cb5b26687d9b8e87]::clean::types::Crate, rustdoc[cb5b26687d9b8e87]::config::RenderOptions, rustdoc[cb5b26687d9b8e87]::formats::cache::Cache), rustdoc[cb5b26687d9b8e87]::main_options::{closure#0}::{closure#0}::{closure#1}::{closure#0}>
  32:     0x55f82241c0f1 - <rustc_interface[5877257fd8df9790]::passes::QueryContext>::enter::<rustdoc[cb5b26687d9b8e87]::main_options::{closure#0}::{closure#0}::{closure#1}, core[bf92a9d07a1f82ee]::result::Result<(), rustc_errors[a8ca28330ed09613]::ErrorGuaranteed>>
  33:     0x55f8221d2b4b - <rustc_interface[5877257fd8df9790]::interface::Compiler>::enter::<rustdoc[cb5b26687d9b8e87]::main_options::{closure#0}::{closure#0}, core[bf92a9d07a1f82ee]::result::Result<(), rustc_errors[a8ca28330ed09613]::ErrorGuaranteed>>
  34:     0x55f82251bff0 - rustc_span[6b1d43e36522c861]::with_source_map::<core[bf92a9d07a1f82ee]::result::Result<(), rustc_errors[a8ca28330ed09613]::ErrorGuaranteed>, rustc_interface[5877257fd8df9790]::interface::create_compiler_and_run<core[bf92a9d07a1f82ee]::result::Result<(), rustc_errors[a8ca28330ed09613]::ErrorGuaranteed>, rustdoc[cb5b26687d9b8e87]::main_options::{closure#0}>::{closure#1}>
  35:     0x55f82221aa47 - rustdoc[cb5b26687d9b8e87]::main_options
  36:     0x55f8223b433b - <scoped_tls[c0dfc978a3163caa]::ScopedKey<rustc_span[6b1d43e36522c861]::SessionGlobals>>::set::<rustdoc[cb5b26687d9b8e87]::main_args::{closure#0}, core[bf92a9d07a1f82ee]::result::Result<(), rustc_errors[a8ca28330ed09613]::ErrorGuaranteed>>
  37:     0x55f8224baf80 - std[23582998930d05ca]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5877257fd8df9790]::util::run_in_thread_pool_with_globals<rustdoc[cb5b26687d9b8e87]::main_args::{closure#0}, core[bf92a9d07a1f82ee]::result::Result<(), rustc_errors[a8ca28330ed09613]::ErrorGuaranteed>>::{closure#0}, core[bf92a9d07a1f82ee]::result::Result<(), rustc_errors[a8ca28330ed09613]::ErrorGuaranteed>>
  38:     0x55f8223ccdfc - <<std[23582998930d05ca]::thread::Builder>::spawn_unchecked_<rustc_interface[5877257fd8df9790]::util::run_in_thread_pool_with_globals<rustdoc[cb5b26687d9b8e87]::main_args::{closure#0}, core[bf92a9d07a1f82ee]::result::Result<(), rustc_errors[a8ca28330ed09613]::ErrorGuaranteed>>::{closure#0}, core[bf92a9d07a1f82ee]::result::Result<(), rustc_errors[a8ca28330ed09613]::ErrorGuaranteed>>::{closure#1} as core[bf92a9d07a1f82ee]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7fe4d7a62553 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h520747421226f12a
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/alloc/src/boxed.rs:1938:9
  40:     0x7fe4d7a62553 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc2e6353edcc9fbc4
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/alloc/src/boxed.rs:1938:9
  41:     0x7fe4d7a62553 - std::sys::unix::thread::Thread::new::thread_start::hd4575adfecf32595
                               at /rustc/8b0c05d9ad7121cdb97600f261bcd5f04c8db20d/library/std/src/sys/unix/thread.rs:108:17
  42:     0x7fe4d779a74d - <unknown>
  43:     0x7fe4d781c700 - <unknown>
  44:                0x0 - <unknown>

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.66.0-nightly (8b0c05d9a 2022-10-07) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z normalize-docs

query stack during panic:
end of query stack
error: aborting due to previous error

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.T-rustdocRelevant to the rustdoc 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