Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ICE]: receiver T/#1 when Self = (dyn Trait<T> + 'static) should have a ScalarPair ABI; found Err(Unknown(T/#1)) #132684

Closed
1 of 4 tasks
wxie7 opened this issue Nov 6, 2024 · 2 comments
Labels
C-bug Category: This is a bug. F-arbitrary_self_types `#![feature(arbitrary_self_types)]` F-dispatch_from_dyn `#![feature(dispatch_from_dyn)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wxie7
Copy link

wxie7 commented Nov 6, 2024

Code

#![feature(arbitrary_self_types, dispatch_from_dyn)]
use std::ops::{Deref, DispatchFromDyn};
trait Trait<T: Deref<Target = Self> + DispatchFromDyn<T>> {
    fn foo(self: T) -> dyn Trait<T>;
}
fn main() {}

Affected release channels

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

Rust Version

rustc 1.84.0-nightly (bc5cf99 2024-11-05)
binary: rustc
commit-hash: bc5cf99
commit-date: 2024-11-05
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Current error output

No response

Backtrace

     0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
     1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
     2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
     3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, alloc::string::String>
     4: <core::iter::adapters::flatten::FlatMap<core::iter::sources::from_fn::FromFn<rustc_type_ir::elaborate::supertrait_def_ids<rustc_middle::ty::context::TyCtxt>::{closure#0}>, alloc::vec::Vec<rustc_middle::traits::DynCompatibilityViolation>, rustc_trait_selection::traits::dyn_compatibility::dyn_compatibility_violations::{closure#0}> as core::iter::traits::iterator::Iterator>::next
     5: rustc_trait_selection::traits::dyn_compatibility::dyn_compatibility_violations
     6: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::dyn_compatibility_violations::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
     7: <rustc_query_impl::query_impl::dyn_compatibility_violations::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
     8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 16]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
     9: rustc_query_impl::query_impl::dyn_compatibility_violations::get_query_non_incr::__rust_end_short_backtrace
    10: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 16]>>>
    11: rustc_trait_selection::traits::dyn_compatibility::is_dyn_compatible
    12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::is_dyn_compatible::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
    13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    14: rustc_query_impl::query_impl::is_dyn_compatible::get_query_non_incr::__rust_end_short_backtrace
    15: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 1]>>>
    16: rustc_hir_analysis::check::wfcheck::check_dyn_incompatible_self_trait_by_name
    17: rustc_hir_analysis::check::wfcheck::check_well_formed
    18: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
    19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    20: rustc_query_impl::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
    21: rustc_middle::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, ()>
    22: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
    23: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
    24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    25: rustc_query_impl::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
    26: rustc_hir_analysis::check_crate
    27: rustc_interface::passes::run_required_analyses
    28: rustc_interface::passes::analysis
    29: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
    30: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
    31: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
    32: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
    33: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
    34: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
    35: std::sys::pal::unix::thread::Thread::new::thread_start
    36: start_thread
               at ./nptl/pthread_create.c:442:8
    37: __GI___clone3
               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Anything else?

note: compiler flags: --crate-type staticlib -C link-dead-code -C debuginfo=2 -C opt-level=3 -Z mir-opt-level=3 (fmease: unnecessary)

@wxie7 wxie7 added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 6, 2024
@fmease fmease added F-arbitrary_self_types `#![feature(arbitrary_self_types)]` F-dispatch_from_dyn `#![feature(dispatch_from_dyn)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Nov 6, 2024
@fmease
Copy link
Member

fmease commented Nov 6, 2024

Strongly related to (if not duplicate of) #90110 although the latter doesn't require any feature flags.

@fmease fmease changed the title [ICE]: receiver T/#1 when Self = (dyn Trait<T> + 'static) should have a ScalarPair ABI; found Err(Unknown(T/#1)) [ICE]: receiver T/#1 when Self = (dyn Trait<T> + 'static) should have a ScalarPair ABI; found Err(Unknown(T/#1)) Nov 6, 2024
@matthiaskrgr
Copy link
Member

the code is from #57276 , closing as duplicate

@matthiaskrgr matthiaskrgr closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-arbitrary_self_types `#![feature(arbitrary_self_types)]` F-dispatch_from_dyn `#![feature(dispatch_from_dyn)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants