Skip to content

'rustc' panicked at compiler\rustc_hir_analysis\src\collect\predicates_of.rs:396:60 #139048

Closed as duplicate of#133808
@jjl9807

Description

@jjl9807

Code

#![feature(adt_const_params, generic_const_exprs, transmutability)]
#![allow(incomplete_features, unstable_features)]

mod assert {
    use std::mem::TransmuteFrom;

    pub fn is_transmutable<Src, Dst, Context, const ASSUME: alloc::str::Assume>()
    where
        Dst: TransmuteFrom<Src, Context, ASSUME>,
    {
    }
}

fn via_associated_const() {
    struct Context;
    #[repr(C)]
    struct Src;
    #[repr(C)]
    struct Dst;

    trait Trait {
        const FALSE: bool = assert::is_transmutable::<Src, Dst, Context, {}>();
    }
}

pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.87.0-nightly (3f5502370 2025-03-27)
binary: rustc
commit-hash: 3f5502370b8f60e4df98deba4c22ea26f4f6be55
commit-date: 2025-03-27
host: x86_64-pc-windows-msvc
release: 1.87.0-nightly
LLVM version: 20.1.1

Error output

error: the compiler unexpectedly panicked. this is a bug.
error: aborting due to 2 previous errors
Backtrace

thread 'rustc' panicked at compiler\rustc_hir_analysis\src\collect\predicates_of.rs:396:60:
DefId::expect_local: `DefId(2:2243 ~ core[6951]::mem::transmutability::TransmuteFrom::{constant#0})` isn't local
stack backtrace:
   0:     0x7ffdb7b1446e - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ffdb7b1446e - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffdb7b1446e - std::backtrace::Backtrace::create
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\backtrace.rs:331
   3:     0x7ffdb7b143aa - std::backtrace::Backtrace::force_capture
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\backtrace.rs:312
   4:     0x7ffdb9200b36 - core[6951cc9ce47704a6]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[1c27e9719b001612]::Level, &str), usize), <((rustc_lint_defs[1c27e9719b001612]::Level, &str), usize) as core[6951cc9ce47704a6]::cmp::PartialOrd>::lt>
   5:     0x7ffdb7b31e6e - std::panicking::rust_panic_with_hook
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\panicking.rs:841
   6:     0x7ffdb7b31bc9 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\panicking.rs:706
   7:     0x7ffdb7b2db4f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\sys\backtrace.rs:168
   8:     0x7ffdb7b317ce - std::panicking::begin_panic_handler
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\panicking.rs:697
   9:     0x7ffdbac243d1 - core::panicking::panic_fmt
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\core\src\panicking.rs:75
  10:     0x7ffdb97c637c - <rustc_hir_analysis[53088fdb5e3a24a]::collect::predicates_of::const_evaluatable_predicates_of::{closure#0}::ConstCollector as rustc_type_ir[1d13270727f214f2]::visit::TypeVisitor<rustc_middle[683f0d56dd0260db]::ty::context::TyCtxt>>::visit_const
  11:     0x7ffdb7ec4d86 - rustc_hir_analysis[53088fdb5e3a24a]::check_crate
  12:     0x7ffdb7e75f75 - <rustc_hir_analysis[53088fdb5e3a24a]::collect::generics_of::has_late_bound_regions::LateBoundRegionsDetector as rustc_hir[555efff866a708ba]::intravisit::Visitor>::visit_ty
  13:     0x7ffdb8a159b8 - rustc_query_impl[8ea2a02cb5ae03fb]::plumbing::query_key_hash_verify_all
  14:     0x7ffdb88c2353 - RINvNtNtCs6mJDqd3bJZT_18rustc_query_system5query8plumbing17try_execute_queryINtCscff8px9WZxD_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCs8WTPSQCyV4J_12rustc_middle5query5erase6ErasedAhj18_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  15:     0x7ffdb8a1bda6 - rustc_query_impl[8ea2a02cb5ae03fb]::plumbing::query_key_hash_verify_all
  16:     0x7ffdb7ec0ac1 - rustc_hir_analysis[53088fdb5e3a24a]::check_crate
  17:     0x7ffdb8a149f3 - rustc_query_impl[8ea2a02cb5ae03fb]::plumbing::query_key_hash_verify_all
  18:     0x7ffdb88c1ea9 - RINvNtNtCs6mJDqd3bJZT_18rustc_query_system5query8plumbing17try_execute_queryINtCscff8px9WZxD_16rustc_query_impl13DynamicConfigINtNtB4_6caches10DefIdCacheINtNtNtCs8WTPSQCyV4J_12rustc_middle5query5erase6ErasedAhj18_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  19:     0x7ffdb8a19cf6 - rustc_query_impl[8ea2a02cb5ae03fb]::plumbing::query_key_hash_verify_all
  20:     0x7ffdb7e873ec - <rustc_hir_analysis[53088fdb5e3a24a]::collect::CollectItemTypesVisitor as rustc_hir[555efff866a708ba]::intravisit::Visitor>::visit_item
  21:     0x7ffdb7e4b55f - rustc_hir_analysis[53088fdb5e3a24a]::check::wfcheck::check_well_formed
  22:     0x7ffdb8a1524b - rustc_query_impl[8ea2a02cb5ae03fb]::plumbing::query_key_hash_verify_all
  23:     0x7ffdb8950903 - RINvNtNtCs6mJDqd3bJZT_18rustc_query_system5query8plumbing17try_execute_queryINtCscff8px9WZxD_16rustc_query_impl13DynamicConfigINtNtCse4zgBhgXQ6e_21rustc_data_structures9vec_cache8VecCacheNtNtCsa3MvjUvbqm8_10rustc_span6def_id10LocalDefIdINtNtNtCs8WTPSQCyV4J
  24:     0x7ffdb8a255d5 - rustc_query_impl[8ea2a02cb5ae03fb]::plumbing::query_key_hash_verify_all
  25:     0x7ffdb7e5d336 - rustc_hir_analysis[53088fdb5e3a24a]::check::wfcheck::check_mod_type_wf
  26:     0x7ffdb76b627b - <alloc[c1935ac82f55411a]::sync::Arc<rustc_session[86b0e6aff9b9ddb9]::cstore::CrateSource>>::drop_slow
  27:     0x7ffdb760522c - RINvNtNtCs6mJDqd3bJZT_18rustc_query_system5query8plumbing17try_execute_queryINtCscff8px9WZxD_16rustc_query_impl13DynamicConfigINtNtB4_6caches12DefaultCacheNtNtCsa3MvjUvbqm8_10rustc_span6def_id13LocalModDefIdINtNtNtCs8WTPSQCyV4J_12rustc_middle5query5erase6E
  28:     0x7ffdb76c9330 - rustc_query_impl[8ea2a02cb5ae03fb]::query_system
  29:     0x7ffdb7ea6f4a - rustc_hir_analysis[53088fdb5e3a24a]::check_crate
  30:     0x7ffdb7b9d48f - rustc_interface[e58bf693756ea05d]::passes::resolver_for_lowering_raw
  31:     0x7ffdb44a6327 - rustc_interface[e58bf693756ea05d]::passes::analysis
  32:     0x7ffdb76b8dfa - <alloc[c1935ac82f55411a]::sync::Arc<rustc_session[86b0e6aff9b9ddb9]::cstore::CrateSource>>::drop_slow
  33:     0x7ffdb75c34be - RINvNtNtCs6mJDqd3bJZT_18rustc_query_system5query8plumbing17try_execute_queryINtCscff8px9WZxD_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCs8WTPSQCyV4J_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  34:     0x7ffdb76beb13 - rustc_query_impl[8ea2a02cb5ae03fb]::query_system
  35:     0x7ffdb4469cff - RINvNtNtCselrSTJIniB3_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsgCoHrkcJ3cc_5alloc5boxed3BoxDINtNtNtCs92C1Pe9IPd2_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECshzA
  36:     0x7ffdb4463c33 - RINvNtNtCselrSTJIniB3_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsgCoHrkcJ3cc_5alloc5boxed3BoxDINtNtNtCs92C1Pe9IPd2_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECshzA
  37:     0x7ffdb445f063 - RINvNtNtCselrSTJIniB3_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsjHS3rztqHID_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCshzAyllk9fhQ_17rustc_driver_i
  38:     0x7ffdb446e2e0 - RINvNtNtCselrSTJIniB3_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNCINvMNtB6_6threadNtB1h_7Builder16spawn_unchecked_INtNtCsgCoHrkcJ3cc_5alloc5boxed3BoxDINtNtNtCs92C1Pe9IPd2_4core3ops8function6FnOnceuEp6OutputuNtNtB2G_6marker4SendEL_EuEs_000uECshzA
  39:     0x7ffdb7b36cad - alloc::boxed::impl$28::call_once
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\alloc\src\boxed.rs:1966
  40:     0x7ffdb7b36cad - alloc::boxed::impl$28::call_once
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\alloc\src\boxed.rs:1966
  41:     0x7ffdb7b36cad - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/3f5502370b8f60e4df98deba4c22ea26f4f6be55/library\std\src\sys\pal\windows\thread.rs:56
  42:     0x7ffeebce7374 - BaseThreadInitThunk
  43:     0x7ffeedcfcc91 - RtlUserThreadStart


rustc version: 1.87.0-nightly (3f5502370 2025-03-27)
platform: x86_64-pc-windows-msvc

query stack during panic:
#0 [explicit_predicates_of] computing explicit predicates of `assert::is_transmutable`
#1 [predicates_of] computing predicates of `assert::is_transmutable`
#2 [check_well_formed] checking that `assert::is_transmutable` is well-formed
#3 [check_mod_type_wf] checking that types are well-formed in module `assert`
#4 [analysis] running analysis passes on this crate
end of query stack

Metadata

Metadata

Assignees

No one assigned

    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