Skip to content

ICE: rustdoc: body_owned_by: HirId(..) has no associated body #149287

Closed

Description

@matthiaskrgr

Code

//@ check-pass

#![feature(min_generic_const_args)]
#![allow(incomplete_features)]

pub trait Tr<X> {
    #[type_const]
    const SIZE: usize;
}

fn mk_array<T: Tr<bool>>(_x: T) -> [(); <T as Tr<bool>>::SIZE] {
    [(); T::SIZE]
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.93.0-nightly (c23ed3ef2 2025-11-23)
binary: rustc
commit-hash: c23ed3ef28b3cc30658310f771ddc66e5b687cf4
commit-date: 2025-11-23
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5

Error output

<output>
Backtrace

error: internal compiler error: compiler/rustc_middle/src/hir/map.rs:271:13: body_owned_by: HirId(DefId(0:5 ~ assoc_const[46ca]::Tr::SIZE).0) (associated constant `SIZE` in Tr::SIZE) has no associated body
 --> assoc-const.rs:8:5
  |
8 |     const SIZE: usize;
  |     ^^^^^^^^^^^^^^^^^


thread 'rustc' (311726) panicked at compiler/rustc_middle/src/hir/map.rs:271:13:
Box<dyn Any>
stack backtrace:
   0:     0x7f4722e8d0c3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf60079e6fb6edce2
   1:     0x7f47236119c8 - core::fmt::write::h4556407225efd72f
   2:     0x7f4722e42bf6 - std::io::Write::write_fmt::h0ea3249f5299861b
   3:     0x7f4722e59dac - std::panicking::default_hook::{{closure}}::hdc04698b81fca7ef
   4:     0x7f4722e59903 - std::panicking::default_hook::h4ae2716da9aa0620
   5:     0x7f4721ede537 - std[ad4fd56af8a863a2]::panicking::update_hook::<alloc[689149252bbc5bc7]::boxed::Box<rustc_driver_impl[48d5ebda47e4f6c2]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f4722e5a162 - std::panicking::panic_with_hook::h32ebcbf876d2754f
   7:     0x7f4721f1ab51 - std[ad4fd56af8a863a2]::panicking::begin_panic::<rustc_errors[19ae2dbe7f4f67e7]::ExplicitBug>::{closure#0}
   8:     0x7f4721f0b476 - std[ad4fd56af8a863a2]::sys::backtrace::__rust_end_short_backtrace::<std[ad4fd56af8a863a2]::panicking::begin_panic<rustc_errors[19ae2dbe7f4f67e7]::ExplicitBug>::{closure#0}, !>
   9:     0x7f4721f0895a - std[ad4fd56af8a863a2]::panicking::begin_panic::<rustc_errors[19ae2dbe7f4f67e7]::ExplicitBug>
  10:     0x7f4721f383c1 - <rustc_errors[19ae2dbe7f4f67e7]::diagnostic::BugAbort as rustc_errors[19ae2dbe7f4f67e7]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f472247913c - <rustc_errors[19ae2dbe7f4f67e7]::DiagCtxtHandle>::span_bug::<rustc_span[dfef3532b619b891]::span_encoding::Span, alloc[689149252bbc5bc7]::string::String>
  12:     0x7f472249a526 - rustc_middle[796bb5e23d747b35]::util::bug::opt_span_bug_fmt::<rustc_span[dfef3532b619b891]::span_encoding::Span>::{closure#0}
  13:     0x7f472249a6d2 - rustc_middle[796bb5e23d747b35]::ty::context::tls::with_opt::<rustc_middle[796bb5e23d747b35]::util::bug::opt_span_bug_fmt<rustc_span[dfef3532b619b891]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f472248b83b - rustc_middle[796bb5e23d747b35]::ty::context::tls::with_context_opt::<rustc_middle[796bb5e23d747b35]::ty::context::tls::with_opt<rustc_middle[796bb5e23d747b35]::util::bug::opt_span_bug_fmt<rustc_span[dfef3532b619b891]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f4720592fe8 - rustc_middle[796bb5e23d747b35]::util::bug::span_bug_fmt::<rustc_span[dfef3532b619b891]::span_encoding::Span>
  16:     0x7f47241ac919 - <rustc_middle[796bb5e23d747b35]::ty::context::TyCtxt>::hir_body_owned_by
  17:     0x55e29d44fd1a - rustdoc[6004462a24d6e2c7]::clean::utils::print_const
  18:     0x55e29d426379 - rustdoc[6004462a24d6e2c7]::clean::clean_ty
  19:     0x55e29d40da6d - rustdoc[6004462a24d6e2c7]::clean::clean_function
  20:     0x55e29d311a2d - rustdoc[6004462a24d6e2c7]::clean::clean_maybe_renamed_item::{closure#0}
  21:     0x55e29d415715 - rustdoc[6004462a24d6e2c7]::clean::clean_doc_module
  22:     0x55e29d406961 - rustdoc[6004462a24d6e2c7]::core::run_global_ctxt
  23:     0x55e29d2fb210 - rustdoc[6004462a24d6e2c7]::main_args::{closure#2}::{closure#0}
  24:     0x55e29d2f274b - rustc_interface[b4fbb2cc6bda294c]::interface::run_compiler::<(), rustdoc[6004462a24d6e2c7]::main_args::{closure#2}>::{closure#1}
  25:     0x55e29d2433b8 - std[ad4fd56af8a863a2]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b4fbb2cc6bda294c]::util::run_in_thread_with_globals<rustc_interface[b4fbb2cc6bda294c]::util::run_in_thread_pool_with_globals<rustc_interface[b4fbb2cc6bda294c]::interface::run_compiler<(), rustdoc[6004462a24d6e2c7]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  26:     0x55e29d3211bd - <<std[ad4fd56af8a863a2]::thread::Builder>::spawn_unchecked_<rustc_interface[b4fbb2cc6bda294c]::util::run_in_thread_with_globals<rustc_interface[b4fbb2cc6bda294c]::util::run_in_thread_pool_with_globals<rustc_interface[b4fbb2cc6bda294c]::interface::run_compiler<(), rustdoc[6004462a24d6e2c7]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b965173db0298ed8]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  27:     0x7f472471e46f - std::sys::thread::unix::Thread::new::thread_start::hacdf6d1111221eb3
  28:     0x7f471e0969cb - <unknown>
  29:     0x7f471e11aa0c - <unknown>
  30:                0x0 - <unknown>

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-2025-11-24T20_22_06-311689.txt` to your bug report

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

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    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.
    C-bugCategory: This is a bug.
    F-gca_min_const_items`#![feature(gca_min_const_items)]` (previously: `min_generic_const_args`)
    on Nov 24, 2025
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Nov 24, 2025
  3. removed
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Nov 24, 2025
  4. cuviper commented on Dec 18, 2025

    @cuviper
    Member
  5. nazar-pc commented on May 22, 2026

    @nazar-pc

    Just hit it as well: https://github.com/nazar-pc/abundance/actions/runs/26260984275/job/77294129656?pr=683

    Details
    error: internal compiler error: /rustc-dev/20de910db49d3476ccf49ea79a4b22e2b5dface0/compiler/rustc_middle/src/hir/map.rs:270:13: body_owned_by: HirId(DefId(0:20 ~ ab_riscv_interpreter[1090]::basic::BasicRegister::N).0) (associated constant `N` in basic::BasicRegister::N) has no associated body
      --> crates/execution/ab-riscv-interpreter/src/basic.rs:27:5
       |
    27 |     type const N: usize;
       |     ^^^^^^^^^^^^^^^^^^^
    
    
    thread 'rustc' (11957) panicked at /rustc-dev/20de910db49d3476ccf49ea79a4b22e2b5dface0/compiler/rustc_middle/src/hir/map.rs:270:13:
    Box<dyn Any>
    stack backtrace:
       0:     0x7f6882481709 - <<std[e2c2ab1e2966959d]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[ac0e63ef633802cd]::fmt::Display>::fmt
       1:     0x7f6882a17388 - core[ac0e63ef633802cd]::fmt::write
       2:     0x7f6882498136 - <std[e2c2ab1e2966959d]::sys::stdio::unix::Stderr as std[e2c2ab1e2966959d]::io::Write>::write_fmt
       3:     0x7f68824578de - std[e2c2ab1e2966959d]::panicking::default_hook::{closure#0}
       4:     0x7f6882474dc3 - std[e2c2ab1e2966959d]::panicking::default_hook
       5:     0x7f6881470641 - std[e2c2ab1e2966959d]::panicking::update_hook::<alloc[f68d83e1ac4058d9]::boxed::Box<rustc_driver_impl[24ce9c0ef2e331b7]::install_ice_hook::{closure#1}>>::{closure#0}
       6:     0x7f68824750a2 - std[e2c2ab1e2966959d]::panicking::panic_with_hook
       7:     0x7f688149e031 - std[e2c2ab1e2966959d]::panicking::begin_panic::<rustc_errors[de5f5c426fde646b]::ExplicitBug>::{closure#0}
       8:     0x7f6881496f16 - std[e2c2ab1e2966959d]::sys::backtrace::__rust_end_short_backtrace::<std[e2c2ab1e2966959d]::panicking::begin_panic<rustc_errors[de5f5c426fde646b]::ExplicitBug>::{closure#0}, !>
       9:     0x7f6881496d8b - std[e2c2ab1e2966959d]::panicking::begin_panic::<rustc_errors[de5f5c426fde646b]::ExplicitBug>
      10:     0x7f68814a9511 - <rustc_errors[de5f5c426fde646b]::diagnostic::BugAbort as rustc_errors[de5f5c426fde646b]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
      11:     0x7f6881a5190c - <rustc_errors[de5f5c426fde646b]::DiagCtxtHandle>::span_bug::<rustc_span[32e747c325a44c88]::span_encoding::Span, alloc[f68d83e1ac4058d9]::string::String>
      12:     0x7f6881a7d376 - rustc_middle[2a68d57e71e6e8fb]::util::bug::opt_span_bug_fmt::<rustc_span[32e747c325a44c88]::span_encoding::Span>::{closure#0}
      13:     0x7f6881a7d502 - rustc_middle[2a68d57e71e6e8fb]::ty::context::tls::with_opt::<rustc_middle[2a68d57e71e6e8fb]::util::bug::opt_span_bug_fmt<rustc_span[32e747c325a44c88]::span_encoding::Span>::{closure#0}, !>::{closure#0}
      14:     0x7f6881a6bbcb - rustc_middle[2a68d57e71e6e8fb]::ty::context::tls::with_context_opt::<rustc_middle[2a68d57e71e6e8fb]::ty::context::tls::with_opt<rustc_middle[2a68d57e71e6e8fb]::util::bug::opt_span_bug_fmt<rustc_span[32e747c325a44c88]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
      15:     0x7f687f844b18 - rustc_middle[2a68d57e71e6e8fb]::util::bug::span_bug_fmt::<rustc_span[32e747c325a44c88]::span_encoding::Span>
      16:     0x7f68832aa392 - <rustc_middle[2a68d57e71e6e8fb]::ty::context::TyCtxt>::hir_body_owned_by
      17:     0x556dcf77d1ff - rustdoc[feb349d4101319d5]::clean::utils::print_const
      18:     0x556dcf75271c - rustdoc[feb349d4101319d5]::clean::clean_ty
      19:     0x556dcf73bc76 - rustdoc[feb349d4101319d5]::clean::clean_generics
      20:     0x556dcf66a923 - rustdoc[feb349d4101319d5]::clean::clean_maybe_renamed_item::{closure#0}
      21:     0x556dcf7426b0 - rustdoc[feb349d4101319d5]::clean::clean_doc_module
      22:     0x556dcf7422a6 - rustdoc[feb349d4101319d5]::clean::clean_doc_module
      23:     0x556dcf7344d1 - rustdoc[feb349d4101319d5]::core::run_global_ctxt
      24:     0x556dcf6550c1 - rustdoc[feb349d4101319d5]::main_args::{closure#2}::{closure#0}
      25:     0x556dcf64d32e - rustc_interface[ac2c429b8fef476b]::interface::run_compiler::<(), rustdoc[feb349d4101319d5]::main_args::{closure#2}>::{closure#1}
      26:     0x556dcf583766 - std[e2c2ab1e2966959d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[ac2c429b8fef476b]::util::run_in_thread_with_globals<rustc_interface[ac2c429b8fef476b]::util::run_in_thread_pool_with_globals<rustc_interface[ac2c429b8fef476b]::interface::run_compiler<(), rustdoc[feb349d4101319d5]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
      27:     0x556dcf68a36d - <std[e2c2ab1e2966959d]::thread::lifecycle::spawn_unchecked<rustc_interface[ac2c429b8fef476b]::util::run_in_thread_with_globals<rustc_interface[ac2c429b8fef476b]::util::run_in_thread_pool_with_globals<rustc_interface[ac2c429b8fef476b]::interface::run_compiler<(), rustdoc[feb349d4101319d5]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[ac0e63ef633802cd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      28:     0x7f6883b9f46c - <std[e2c2ab1e2966959d]::sys::thread::unix::Thread>::new::thread_start
      29:     0x7f687d69caa4 - <unknown>
      30:     0x7f687d729c6c - <unknown>
      31:                0x0 - <unknown>
    
  6. reddevilmidzy commented on May 23, 2026

    @reddevilmidzy
    Member

    update and smaller:

    //@ check-pass
    #![feature(min_generic_const_args)]
    
    pub trait Tr {
        type const SIZE: usize;
    }
    
    fn mk_array<T: Tr>() -> [(); <T as Tr>::SIZE] {
        [(); T::SIZE]
    }
    
    fn main() {}
  7. added a commit that references this issue on May 26, 2026
  8. added a commit that references this issue on May 26, 2026
  9. added 2 commits that reference this issue on May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-gca_min_const_items`#![feature(gca_min_const_items)]` (previously: `min_generic_const_args`)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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