Skip to content

[ICE]: failed to resolve instance for <bool as Droppable>::drop #154073

Closed as duplicate

Description

@Anonymous1-design

Code

trait Bar: Send + Sync + Droppable {}
impl<T: Send + > Bar for T {}
trait Droppable {
    fn drop(& self);
}
const fn yeet_principal_4(x: & Bar) -> &( Send + Sync) {
    x
}
static BAR: &( Send + Sync) = yeet_principal_4(&false);
fn main(){}

Affected release channels

  • Previous Stable
  • Current Stable
  • Current Beta
  • Current Nightly

Rust Version

rustc 1.94.0 (4a4ef493e 2026-03-02)
binary: rustc
commit-hash: 4a4ef493e3a1488c6e321570238084b38948f6db
commit-date: 2026-03-02
host: x86_64-unknown-linux-gnu
release: 1.94.0
LLVM version: 21.1.8

Current error output

error[E0277]: the trait bound `T: Droppable` is not satisfied
 --> bug.rs:2:26
  |
2 | impl<T: Send + > Bar for T {}
  |                          ^ the trait `Droppable` is not implemented for `T`
  |
note: required by a bound in `Bar`
 --> bug.rs:1:26
  |
1 | trait Bar: Send + Sync + Droppable {}
  |                          ^^^^^^^^^ required by this bound in `Bar`
help: consider further restricting type parameter `T` with trait `Droppable`
  |
2 | impl<T: Send + Droppable + > Bar for T {}
  |              +++++++++++

error[E0277]: `T` cannot be shared between threads safely
 --> bug.rs:2:26
  |
2 | impl<T: Send + > Bar for T {}
  |                          ^ `T` cannot be shared between threads safely
  |
note: required by a bound in `Bar`
 --> bug.rs:1:19
  |
1 | trait Bar: Send + Sync + Droppable {}
  |                   ^^^^ required by this bound in `Bar`
help: consider further restricting type parameter `T` with trait `Sync`
  |
2 | impl<T: Send + std::marker::Sync + > Bar for T {}
  |              +++++++++++++++++++

warning: trait objects without an explicit `dyn` are deprecated
 --> bug.rs:6:32
  |
6 | const fn yeet_principal_4(x: & Bar) -> &( Send + Sync) {
  |                                ^^^
  |
  = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
  = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
  = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default
help: if this is a dyn-compatible trait, use `dyn`
  |
6 | const fn yeet_principal_4(x: & dyn Bar) -> &( Send + Sync) {
  |                                +++

warning: trait objects without an explicit `dyn` are deprecated
 --> bug.rs:6:43
  |
6 | const fn yeet_principal_4(x: & Bar) -> &( Send + Sync) {
  |                                           ^^^^^^^^^^^
  |
  = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
  = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: if this is a dyn-compatible trait, use `dyn`
  |
6 | const fn yeet_principal_4(x: & Bar) -> &( dyn Send + Sync) {
  |                                           +++

warning: trait objects without an explicit `dyn` are deprecated
 --> bug.rs:9:16
  |
9 | static BAR: &( Send + Sync) = yeet_principal_4(&false);
  |                ^^^^^^^^^^^
  |
  = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
  = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: if this is a dyn-compatible trait, use `dyn`
  |
9 | static BAR: &( dyn Send + Sync) = yeet_principal_4(&false);
  |                +++

Backtrace

error: internal compiler error: /rustc-dev/4a4ef493e3a1488c6e321570238084b38948f6db/compiler/rustc_middle/src/ty/instance.rs:579:21: failed to resolve instance for <bool as Droppable>::drop
 --> bug.rs:4:5
  |
4 |     fn drop(& self);
  |     ^^^^^^^^^^^^^^^^


thread 'rustc' (1932416) panicked at /rustc-dev/4a4ef493e3a1488c6e321570238084b38948f6db/compiler/rustc_middle/src/ty/instance.rs:579:21:
Box<dyn Any>
stack backtrace:
   0:     0x7f1f5015f603 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h93773fc827e3113d
   1:     0x7f1f50711488 - core::fmt::write::hed7b5c73d82ecb7c
   2:     0x7f1f51bfb142 - std::io::Write::write_fmt::h6f0185aecf0ed75f
   3:     0x7f1f5012cb65 - std::panicking::default_hook::{{closure}}::h2be84df4f189ae36
   4:     0x7f1f5012c993 - std::panicking::default_hook::hf0ea8939246f43a9
   5:     0x7f1f4f113aea - std[765ed69a96918746]::panicking::update_hook::<alloc[7a43974b6697a11c]::boxed::Box<rustc_driver_impl[252c3262fddb99f]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f1f5012ce92 - std::panicking::panic_with_hook::hb4bd9ac1123582a0
   7:     0x7f1f4f150e01 - std[765ed69a96918746]::panicking::begin_panic::<rustc_errors[45351c624685c6c4]::ExplicitBug>::{closure#0}
   8:     0x7f1f4f141226 - std[765ed69a96918746]::sys::backtrace::__rust_end_short_backtrace::<std[765ed69a96918746]::panicking::begin_panic<rustc_errors[45351c624685c6c4]::ExplicitBug>::{closure#0}, !>
   9:     0x7f1f4f140ebf - std[765ed69a96918746]::panicking::begin_panic::<rustc_errors[45351c624685c6c4]::ExplicitBug>
  10:     0x7f1f4f16eb41 - <rustc_errors[45351c624685c6c4]::diagnostic::BugAbort as rustc_errors[45351c624685c6c4]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f1f4f7016bc - <rustc_errors[45351c624685c6c4]::DiagCtxtHandle>::span_bug::<rustc_span[56e001752d96add4]::span_encoding::Span, alloc[7a43974b6697a11c]::string::String>
  12:     0x7f1f4f724246 - rustc_middle[f9db403ed88df217]::util::bug::opt_span_bug_fmt::<rustc_span[56e001752d96add4]::span_encoding::Span>::{closure#0}
  13:     0x7f1f4f7243f2 - rustc_middle[f9db403ed88df217]::ty::context::tls::with_opt::<rustc_middle[f9db403ed88df217]::util::bug::opt_span_bug_fmt<rustc_span[56e001752d96add4]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f1f4f715a1b - rustc_middle[f9db403ed88df217]::ty::context::tls::with_context_opt::<rustc_middle[f9db403ed88df217]::ty::context::tls::with_opt<rustc_middle[f9db403ed88df217]::util::bug::opt_span_bug_fmt<rustc_span[56e001752d96add4]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f1f4d773498 - rustc_middle[f9db403ed88df217]::util::bug::span_bug_fmt::<rustc_span[56e001752d96add4]::span_encoding::Span>
  16:     0x7f1f50dce1e3 - <rustc_middle[f9db403ed88df217]::ty::instance::Instance>::expect_resolve
  17:     0x7f1f515eee21 - <rustc_middle[f9db403ed88df217]::ty::instance::Instance>::expect_resolve_for_vtable
  18:     0x7f1f515ee30d - rustc_trait_selection[f276006b73549ef0]::traits::vtable::vtable_entries::{closure#0}
  19:     0x7f1f515efa77 - rustc_trait_selection[f276006b73549ef0]::traits::vtable::vtable_entries
  20:     0x7f1f515ef3e0 - rustc_query_impl[d9e05d596e7fb2e4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9e05d596e7fb2e4]::query_impl::vtable_entries::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f9db403ed88df217]::query::erase::Erased<[u8; 16usize]>>
  21:     0x7f1f515ef39f - <rustc_query_impl[d9e05d596e7fb2e4]::query_impl::vtable_entries::dynamic_query::{closure#2} as core[32850a7867c2faaf]::ops::function::FnOnce<(rustc_middle[f9db403ed88df217]::ty::context::TyCtxt, rustc_type_ir[db10ef31f899621e]::predicate::TraitRef<rustc_middle[f9db403ed88df217]::ty::context::TyCtxt>)>>::call_once
  22:     0x7f1f515ecfd4 - rustc_query_system[5bf9c757c7651d1c]::query::plumbing::try_execute_query::<rustc_query_impl[d9e05d596e7fb2e4]::DynamicConfig<rustc_query_system[5bf9c757c7651d1c]::query::caches::DefaultCache<rustc_type_ir[db10ef31f899621e]::predicate::TraitRef<rustc_middle[f9db403ed88df217]::ty::context::TyCtxt>, rustc_middle[f9db403ed88df217]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d9e05d596e7fb2e4]::plumbing::QueryCtxt, false>
  23:     0x7f1f515ecd0f - rustc_query_impl[d9e05d596e7fb2e4]::query_impl::vtable_entries::get_query_non_incr::__rust_end_short_backtrace
  24:     0x7f1f4f0620cd - <rustc_const_eval[c2a8dfe84ccca289]::interpret::eval_context::InterpCx<rustc_const_eval[c2a8dfe84ccca289]::const_eval::machine::CompileTimeMachine>>::vtable_entries
  25:     0x7f1f50ca3b20 - <rustc_const_eval[c2a8dfe84ccca289]::interpret::eval_context::InterpCx<rustc_const_eval[c2a8dfe84ccca289]::const_eval::machine::CompileTimeMachine>>::unsize_into_ptr::<rustc_const_eval[c2a8dfe84ccca289]::interpret::place::PlaceTy>
  26:     0x7f1f50c7cde2 - rustc_const_eval[c2a8dfe84ccca289]::const_eval::eval_queries::eval_body_using_ecx::<rustc_middle[f9db403ed88df217]::mir::interpret::allocation::ConstAllocation>
  27:     0x7f1f5178df8a - rustc_const_eval[c2a8dfe84ccca289]::const_eval::eval_queries::eval_static_initializer_provider
  28:     0x7f1f5178da55 - rustc_query_impl[d9e05d596e7fb2e4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9e05d596e7fb2e4]::query_impl::eval_static_initializer::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f9db403ed88df217]::query::erase::Erased<[u8; 16usize]>>
  29:     0x7f1f5178da29 - <rustc_query_impl[d9e05d596e7fb2e4]::query_impl::eval_static_initializer::dynamic_query::{closure#2} as core[32850a7867c2faaf]::ops::function::FnOnce<(rustc_middle[f9db403ed88df217]::ty::context::TyCtxt, rustc_span[56e001752d96add4]::def_id::DefId)>>::call_once
  30:     0x7f1f5088fb5b - rustc_query_system[5bf9c757c7651d1c]::query::plumbing::try_execute_query::<rustc_query_impl[d9e05d596e7fb2e4]::DynamicConfig<rustc_query_system[5bf9c757c7651d1c]::query::caches::DefIdCache<rustc_middle[f9db403ed88df217]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[d9e05d596e7fb2e4]::plumbing::QueryCtxt, false>
  31:     0x7f1f5173737a - rustc_query_impl[d9e05d596e7fb2e4]::query_impl::eval_static_initializer::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f1f50a443fb - <rustc_middle[f9db403ed88df217]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[c14eb0767420332]::check_crate::{closure#2}>::{closure#0}
  33:     0x7f1f50a43c44 - rustc_hir_analysis[c14eb0767420332]::check_crate
  34:     0x7f1f5162c09b - rustc_interface[c6a26c9f392246cf]::passes::analysis
  35:     0x7f1f5162bcf5 - rustc_query_impl[d9e05d596e7fb2e4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[d9e05d596e7fb2e4]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f9db403ed88df217]::query::erase::Erased<[u8; 0usize]>>
  36:     0x7f1f51902963 - rustc_query_system[5bf9c757c7651d1c]::query::plumbing::try_execute_query::<rustc_query_impl[d9e05d596e7fb2e4]::DynamicConfig<rustc_query_system[5bf9c757c7651d1c]::query::caches::SingleCache<rustc_middle[f9db403ed88df217]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[d9e05d596e7fb2e4]::plumbing::QueryCtxt, false>
  37:     0x7f1f5190274e - rustc_query_impl[d9e05d596e7fb2e4]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f1f51a93111 - <rustc_interface[c6a26c9f392246cf]::passes::create_and_enter_global_ctxt<core[32850a7867c2faaf]::option::Option<rustc_interface[c6a26c9f392246cf]::queries::Linker>, rustc_driver_impl[252c3262fddb99f]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[32850a7867c2faaf]::ops::function::FnOnce<(&rustc_session[eab982bd009dcc5a]::session::Session, rustc_middle[f9db403ed88df217]::ty::context::CurrentGcx, alloc[7a43974b6697a11c]::sync::Arc<rustc_data_structures[721127a3047d6cb5]::jobserver::Proxy>, &std[765ed69a96918746]::sync::once_lock::OnceLock<rustc_middle[f9db403ed88df217]::ty::context::GlobalCtxt>, &rustc_data_structures[721127a3047d6cb5]::sync::worker_local::WorkerLocal<rustc_middle[f9db403ed88df217]::arena::Arena>, &rustc_data_structures[721127a3047d6cb5]::sync::worker_local::WorkerLocal<rustc_hir[41466cadac454391]::Arena>, rustc_driver_impl[252c3262fddb99f]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  39:     0x7f1f518840b4 - rustc_interface[c6a26c9f392246cf]::interface::run_compiler::<(), rustc_driver_impl[252c3262fddb99f]::run_compiler::{closure#0}>::{closure#1}
  40:     0x7f1f5182cb7a - std[765ed69a96918746]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c6a26c9f392246cf]::util::run_in_thread_with_globals<rustc_interface[c6a26c9f392246cf]::util::run_in_thread_pool_with_globals<rustc_interface[c6a26c9f392246cf]::interface::run_compiler<(), rustc_driver_impl[252c3262fddb99f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  41:     0x7f1f5182c93e - <std[765ed69a96918746]::thread::lifecycle::spawn_unchecked<rustc_interface[c6a26c9f392246cf]::util::run_in_thread_with_globals<rustc_interface[c6a26c9f392246cf]::util::run_in_thread_pool_with_globals<rustc_interface[c6a26c9f392246cf]::interface::run_compiler<(), rustc_driver_impl[252c3262fddb99f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[32850a7867c2faaf]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7f1f5182e702 - std::sys::thread::unix::Thread::new::thread_start::h982f9ea829d1b5fb
  43:     0x7f1f4b4aa609 - start_thread
                               at /build/glibc-B3wQXB/glibc-2.31/nptl/pthread_create.c:477:8
  44:     0x7f1f4b3cf353 - clone
                               at /build/glibc-B3wQXB/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95:0
  45:                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-compiler&template=ice.md

note: rustc 1.94.0 (4a4ef493e 2026-03-02) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [vtable_entries] finding all vtable entries for trait `Bar`
#1 [eval_static_initializer] evaluating initializer of static `BAR`
... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack
error: aborting due to 3 previous errors; 3 warnings emitted

Anything else?

I’ve checked for duplicates, and it seems this bug has been reported many times, but this appears to be the only one that ICEs on both the current stable and nightly (with or without -Z next-solver=globally).

Activity

  1. added
    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.
    on Mar 19, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 19, 2026
  3. theemathas commented on Mar 19, 2026

    @theemathas
    Contributor

    Smaller:

    trait Bar: Sync {
        fn method(&self);
    } 
    impl<T: Sync> Bar for T {
        // missing method
    }
    static BAR: &dyn Sync = &false as &dyn Bar;
    fn main(){}
  4. added
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    on Mar 19, 2026
  5. added a commit that references this issue on Mar 20, 2026
    6e6d9f7
  6. matthiaskrgr commented on Mar 21, 2026

    @matthiaskrgr
    Member

    Looks like a duplicate of #137190 then

  7. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Mar 21, 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

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)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