Skip to content

[ICE]: self-type &Cell<(dyn Bar + 'static)> for ObjectPick never dereferenced to an object #165033

Open

Description

@cushionbadak

Code

use std::cell::Cell;
use std::ops::Deref;

trait Foo: Deref<Target = Cell<dyn Bar>> {
    fn method(self: &Cell<dyn Bar>) {}
}

trait Bar {}

fn test(x: &dyn Foo) {
    x.method();
}

fn main() {}

Mutant of tests/ui/self/invalid-self-dyn-receiver.rs.

Meta

rustc --version --verbose:

rustc 1.101.0-nightly (16d1ffac1 2026-10-26)
binary: rustc
commit-hash: 16d1ffac17ad8b739e32483ac2e65fe7e1804977
commit-date: 2026-10-26
host: x86_64-apple-darwin
release: 1.101.0-nightly
LLVM version: 23.1.4

Error output

Command: rustc objpick.rs --edition 2024

error[E0307]: invalid `self` parameter type: `&Cell<(dyn Bar + 'static)>`
 --> objpick.rs:5:21
  |
5 |     fn method(self: &Cell<dyn Bar>) {}
  |                     ^^^^^^^^^^^^^^
  |
  = note: type of `self` must be `Self` or a type that dereferences to it
  = help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)

error: internal compiler error: /rustc-dev/16d1ffac17ad8b739e32483ac2e65fe7e1804977/compiler/rustc_hir_typeck/src/method/confirm.rs:410:17: self-type `&Cell<(dyn Bar + 'static)>` for ObjectPick never dereferenced to an object
  --> objpick.rs:11:7
   |
11 |     x.method();
   |       ^^^^^^


thread 'rustc' (44602892) panicked at /rustc-dev/16d1ffac17ad8b739e32483ac2e65fe7e1804977/compiler/rustc_hir_typeck/src/method/confirm.rs:410:17:
Box<dyn Any>
Backtrace

thread 'rustc' (44602892) panicked at /rustc-dev/16d1ffac17ad8b739e32483ac2e65fe7e1804977/compiler/rustc_hir_typeck/src/method/confirm.rs:410:17:
Box<dyn Any>
stack backtrace:
   0:        0x10ee76824 - <<std[2593b8881ffc8f3d]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[78285f1485d4cbbc]::fmt::Display>::fmt
   1:        0x10b47de57 - core[78285f1485d4cbbc]::fmt::write
   2:        0x10ee8efab - <std[2593b8881ffc8f3d]::sys::stdio::unix::Stderr as core[78285f1485d4cbbc]::io::write::Write>::write_fmt
   3:        0x10ee403d0 - std[2593b8881ffc8f3d]::panicking::default_hook::{closure#0}
   4:        0x10ee66107 - std[2593b8881ffc8f3d]::panicking::default_hook
   5:        0x10c3bfee2 - std[2593b8881ffc8f3d]::panicking::update_hook::<alloc[484f06d20a7e4722]::boxed::Box<rustc_driver_impl[7b907c5adb31dd75]::install_ice_hook::{closure#1}>>::{closure#0}
   6:        0x10ee66717 - std[2593b8881ffc8f3d]::panicking::panic_with_hook
   7:        0x10e55a859 - std[2593b8881ffc8f3d]::panicking::begin_panic::<rustc_span[bb5d078d821bdf7d]::macros::ExplicitBug>::{closure#0}
   8:        0x10e5569e9 - std[2593b8881ffc8f3d]::sys::backtrace::__rust_end_short_backtrace::<std[2593b8881ffc8f3d]::panicking::begin_panic<rustc_span[bb5d078d821bdf7d]::macros::ExplicitBug>::{closure#0}, !>
   9:        0x10f10ed88 - std[2593b8881ffc8f3d]::panicking::begin_panic::<rustc_span[bb5d078d821bdf7d]::macros::ExplicitBug>
  10:        0x10f110703 - rustc_span[bb5d078d821bdf7d]::macros::bug_impl
  11:        0x10cbb109f - <rustc_hir_typeck[be8275de51fa67fb]::method::confirm::ConfirmContext>::confirm
  12:        0x10cb2d479 - <rustc_hir_typeck[be8275de51fa67fb]::fn_ctxt::FnCtxt>::check_expr_method_call
  13:        0x10cb30fb3 - <rustc_hir_typeck[be8275de51fa67fb]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  14:        0x10cb88fd8 - <rustc_hir_typeck[be8275de51fa67fb]::fn_ctxt::FnCtxt>::check_expr_block
  15:        0x10cb31091 - <rustc_hir_typeck[be8275de51fa67fb]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  16:        0x10cb2e90a - <rustc_hir_typeck[be8275de51fa67fb]::fn_ctxt::FnCtxt>::check_return_or_body_tail
  17:        0x10cc31f62 - rustc_hir_typeck[be8275de51fa67fb]::check::check_fn
  18:        0x10cad138e - rustc_hir_typeck[be8275de51fa67fb]::typeck_with_inspect::{closure#0}
  19:        0x10cafafe0 - rustc_hir_typeck[be8275de51fa67fb]::typeck_root
  20:        0x10def9115 - rustc_query_impl[7d3ade741a45c836]::execution::try_execute_query::<rustc_data_structures[d1a59173e0b94bb]::vec_cache::VecCache<rustc_span[bb5d078d821bdf7d]::def_id::LocalDefId, rustc_middle[ca6269e841c8a80d]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[ca6269e841c8a80d]::dep_graph::graph::DepNodeIndex>, false>
  21:        0x10e1284c5 - rustc_query_impl[7d3ade741a45c836]::query_vtables::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
  22:        0x10c6087fe - <rustc_middle[ca6269e841c8a80d]::query::calls::TyCtxtEnsureOk>::typeck::<rustc_span[bb5d078d821bdf7d]::def_id::LocalDefId>
  23:        0x10c6fde35 - <rustc_middle[ca6269e841c8a80d]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[bdb44298bdcb9b02]::check_crate::{closure#1}>::{closure#0}
  24:        0x10c74715d - rustc_hir_analysis[bdb44298bdcb9b02]::check_crate
  25:        0x10cf1cebd - rustc_interface[24eeb4300d06b8bb]::passes::analysis
  26:        0x10df2462f - rustc_query_impl[7d3ade741a45c836]::execution::try_execute_query::<rustc_middle[ca6269e841c8a80d]::query::caches::SingleCache<rustc_middle[ca6269e841c8a80d]::query::erase::ErasedData<[u8; 0usize]>>, false>
  27:        0x10e144d46 - rustc_query_impl[7d3ade741a45c836]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
  28:        0x10c344b73 - rustc_interface[24eeb4300d06b8bb]::passes::create_and_enter_global_ctxt::<core[78285f1485d4cbbc]::option::Option<rustc_interface[24eeb4300d06b8bb]::queries::Linker>, rustc_driver_impl[7b907c5adb31dd75]::compiler_entrypoint::{closure#0}::{closure#1}>
  29:        0x10c3be7fd - rustc_interface[24eeb4300d06b8bb]::interface::run_compiler::<(), rustc_driver_impl[7b907c5adb31dd75]::compiler_entrypoint::{closure#0}>::{closure#2}
  30:        0x10c3ab9a0 - std[2593b8881ffc8f3d]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[24eeb4300d06b8bb]::util::run_in_thread_with_globals<rustc_interface[24eeb4300d06b8bb]::util::run_in_thread_pool_with_globals<rustc_interface[24eeb4300d06b8bb]::interface::run_compiler<(), rustc_driver_impl[7b907c5adb31dd75]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  31:        0x10c3c474b - <std[2593b8881ffc8f3d]::thread::lifecycle::spawn_unchecked<rustc_interface[24eeb4300d06b8bb]::util::run_in_thread_with_globals<rustc_interface[24eeb4300d06b8bb]::util::run_in_thread_pool_with_globals<rustc_interface[24eeb4300d06b8bb]::interface::run_compiler<(), rustc_driver_impl[7b907c5adb31dd75]::compiler_entrypoint::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[78285f1485d4cbbc]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:        0x10ee7238b - <std[2593b8881ffc8f3d]::sys::thread::unix::Thread>::new::thread_start
  33:     0x7ff80aa76e05 - __pthread_start

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/Volumes/T7/workspace/tmp/rustc-ice-2026-10-27T11_11_58-86764.txt` to your bug report

note: rustc 1.101.0-nightly (16d1ffac1 2026-10-26) running on x86_64-apple-darwin

query stack during panic:
#0 [typeck_root] type-checking `test`
#1 [analysis] running analysis passes on crate `objpick`
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0307`.

Notes

  • ICE location: compiler/rustc_hir_typeck/src/method/confirm.rs Line-410
    autoderef
    .include_raw_pointers()
    .find_map(|(ty, _)| match ty.kind() {
    ty::Dynamic(data, ..) => Some(closure(
    self,
    ty,
    data.principal().unwrap_or_else(|| {
    span_bug!(self.span, "calling trait method on empty object?")
    }),
    )),
    _ => None,
    })
    .unwrap_or_else(|| {
    span_bug!(
    self.span,
    "self-type `{}` for ObjectPick never dereferenced to an object",
    self_ty
    )
    })
    }
  • Currently I cannot find any opened ICE issues with "ObjectPick" query. link

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 Oct 27, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 27, 2026
  3. added
    T-typesRelevant to the types team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 27, 2026
  4. cushionbadak commented on Oct 27, 2026

    @cushionbadak
    Author

    Regression in nightly-2024-11-25
    My Fault, 2024-11-25 is just when --edition 2024 support begins.

    Regression in nightly-2024-02-15.
    Might be related to pr-120847 ?

    Bisection Log

    cargo bisect-rustc --start=2024-01-01 --end=2024-06-29 --regress ice --preserve --script rustc -- objpick.rs
    checking the start range to find a passing nightly
    installing nightly-2024-01-01
    rust-std-nightly-x86_64-apple-darwin: 25.37 MB / 25.37 MB [====================================] 100.00 % 5.09 MB/stesting...
    RESULT: nightly-2024-01-01, ===> Script did not ICE
    
    checking the end range to verify it does not pass
    installing nightly-2024-06-29
    testing...
    RESULT: nightly-2024-06-29, ===> Script found ICE
    
    90 versions remaining to test after this (roughly 7 steps)
    installing nightly-2024-03-31
    rust-std-nightly-x86_64-apple-darwin: 23.68 MB / 23.68 MB [====================================] 100.00 % 4.38 MB/stesting...
    RESULT: nightly-2024-03-31, ===> Script found ICE
    
    45 versions remaining to test after this (roughly 6 steps)
    installing nightly-2024-02-15
    rust-std-nightly-x86_64-apple-darwin: 25.55 MB / 25.55 MB [====================================] 100.00 % 4.54 MB/stesting...
    RESULT: nightly-2024-02-15, ===> Script found ICE
    
    23 versions remaining to test after this (roughly 5 steps)
    installing nightly-2024-01-23
    rust-std-nightly-x86_64-apple-darwin: 25.47 MB / 25.47 MB [====================================] 100.00 % 4.50 MB/stesting...
    RESULT: nightly-2024-01-23, ===> Script did not ICE
    
    12 versions remaining to test after this (roughly 4 steps)
    installing nightly-2024-02-03
    rust-std-nightly-x86_64-apple-darwin: 25.55 MB / 25.55 MB [====================================] 100.00 % 4.49 MB/stesting...
    RESULT: nightly-2024-02-03, ===> Script did not ICE
    
    6 versions remaining to test after this (roughly 3 steps)
    installing nightly-2024-02-09
    rust-std-nightly-x86_64-apple-darwin: 23.71 MB / 23.71 MB [====================================] 100.00 % 1.62 MB/stesting...
    RESULT: nightly-2024-02-09, ===> Script did not ICE
    
    3 versions remaining to test after this (roughly 2 steps)
    installing nightly-2024-02-12
    rust-std-nightly-x86_64-apple-darwin: 23.69 MB / 23.69 MB [====================================] 100.00 % 4.37 MB/stesting...
    RESULT: nightly-2024-02-12, ===> Script did not ICE
    
    2 versions remaining to test after this (roughly 2 steps)
    installing nightly-2024-02-13
    rust-std-nightly-x86_64-apple-darwin: 23.70 MB / 23.70 MB [====================================] 100.00 % 4.31 MB/stesting...
    RESULT: nightly-2024-02-13, ===> Script did not ICE
    
    1 versions remaining to test after this (roughly 1 steps)
    installing nightly-2024-02-14
    rust-std-nightly-x86_64-apple-darwin: 23.65 MB / 23.65 MB [====================================] 100.00 % 4.24 MB/stesting...
    RESULT: nightly-2024-02-14, ===> Script did not ICE
    
    searched toolchains nightly-2024-01-01 through nightly-2024-06-29
    
    
    ********************************************************************************
    Regression in nightly-2024-02-15
    ********************************************************************************
    
    fetching https://static.rust-lang.org/dist/2024-02-14/channel-rust-nightly-git-commit-hash.txt
    nightly manifest 2024-02-14: 40 B / 40 B [===================================================] 100.00 % 528.82 KB/sconverted 2024-02-14 to a84bb95a1f65bfe25038f188763a18e096a86ab2
    fetching https://static.rust-lang.org/dist/2024-02-15/channel-rust-nightly-git-commit-hash.txt
    nightly manifest 2024-02-15: 40 B / 40 B [===================================================] 100.00 % 578.50 KB/sconverted 2024-02-15 to ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46
    looking for regression commit between 2024-02-14 and 2024-02-15
    fetching (via remote github) commits from max(a84bb95a1f65bfe25038f188763a18e096a86ab2, 2024-02-12) to ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46
    ending github query because we found starting sha: a84bb95a1f65bfe25038f188763a18e096a86ab2
    get_commits_between returning commits, len: 9
      commit[0] 2024-02-13: Auto merge of #121036 - matthiaskrgr:rollup-ul05q8e, r=matthiaskrgr
      commit[1] 2024-02-14: Auto merge of #120942 - compiler-errors:deep-assoc-hang, r=lcnr
      commit[2] 2024-02-14: Auto merge of #121055 - matthiaskrgr:rollup-bzn5sda, r=matthiaskrgr
      commit[3] 2024-02-14: Auto merge of #120454 - clubby789:cargo-update, r=Nilstrieb
      commit[4] 2024-02-14: Auto merge of #121018 - oli-obk:impl_unsafety, r=TaKO8Ki
      commit[5] 2024-02-14: Auto merge of #100603 - tmandry:zst-guards, r=dtolnay
      commit[6] 2024-02-14: Auto merge of #121078 - oli-obk:rollup-p11zsav, r=oli-obk
      commit[7] 2024-02-14: Auto merge of #121086 - GuillaumeGomez:rollup-y82fs9y, r=GuillaumeGomez
      commit[8] 2024-02-14: Auto merge of #120847 - oli-obk:track_errors9, r=compiler-errors
    ERROR: no CI builds available between a84bb95a1f65bfe25038f188763a18e096a86ab2 and ee9c7c940c07d8b67c9a6b2ec930db70dcd23a46 within last 167 days
    

  5. maxdexh commented on Oct 27, 2026

    @maxdexh
    Member

    Yeah #120847 looks plausible

  6. added
    S-found-by-fuzzingStatus: This issue was found using fuzzing. It may not arise in practical cases.
    on Nov 10, 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.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-found-by-fuzzingStatus: This issue was found using fuzzing. It may not arise in practical cases.S-has-bisectionStatus: A bisection has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types 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