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

[Stable] Error performing operation: fully_perform when encountering a chain of associated types #129688

Closed
dmitrii-ubskii opened this issue Aug 28, 2024 · 3 comments
Labels
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.

Comments

@dmitrii-ubskii
Copy link

Code

pub trait Helper {
    type Assoc;
}
pub trait Trait {
    type Item: Helper;
    fn wrap<T, J: Trait<Item = T>>(&self) -> Wrapper<J> {
        todo!()
    }
}
pub struct Wrapper<LI: Trait> {
    _next: LI,
    _item: Option<<LI::Item as Helper>::Assoc>,
}

Meta

rustc --version --verbose:

rustc 1.80.1 (3f5fd8dd4 2024-08-06)
binary: rustc
commit-hash: 3f5fd8dd41153bc5fdca9427e9e05be2c767ba23
commit-date: 2024-08-06
host: aarch64-apple-darwin
release: 1.80.1
LLVM version: 18.1.7

Error output

    Checking ice v0.0.0 (/Users/dmitriiubskii/workspace/misc/ice)
note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: error performing operation: fully_perform
  |
  = note: delayed at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:85:25 - disabled backtrace

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.80.1 (3f5fd8dd4 2024-08-06) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `ice` (lib)
Backtrace

 0: std::backtrace::Backtrace::create
 1: <rustc_errors::DiagCtxtInner>::emit_diagnostic
 2: <rustc_errors::diagnostic::Diag>::emit_producing_error_guaranteed
 3: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_middle::traits::query::DropckOutlivesResult, rustc_span::ErrorGuaranteed, rustc_trait_selection ::traits::query::type_op::custom::scrape_region_constraints<rustc_middle::ty::ParamEnvAnd<rustc_trait_selection::traits::query::type_op::outlives::DropckOutlives>, r ustc_middle::traits::query::DropckOutlivesResult, <rustc_middle::ty::ParamEnvAnd<rustc_trait_selection::traits::query::type_op::outlives::DropckOutlives> as rustc_tr ait_selection::traits::query::type_op::TypeOp>::fully_perform::{closure#1}>::{closure#0}>
 4: <rustc_middle::ty::ParamEnvAnd<rustc_trait_selection::traits::query::type_op::outlives::DropckOutlives> as rustc_trait_selection::traits::query::type _op::TypeOp>::fully_perform
 5: <indexmap::map::core::entry::Entry<rustc_middle::ty::Ty, rustc_borrowck::type_check::liveness::trace::DropData>>::or_insert_with::<<rustc_borrowck::t ype_check::liveness::trace::LivenessResults>::dropck_boring_locals::{closure#0}>
 6: rustc_borrowck::type_check::liveness::trace::trace
 7: rustc_borrowck::type_check::liveness::generate
 8: rustc_borrowck::type_check::type_check
 9: rustc_borrowck::nll::compute_regions
10: rustc_borrowck::do_mir_borrowck
11: rustc_borrowck::mir_borrowck
12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc _middle::query::erase::Erased<[u8; 8]>>
13: <rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span ::def_id::LocalDefId)>>::call_once
14: 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; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
15: rustc_query_impl::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
16: std::panicking::try::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::disabled::par_for_each_in<&[rustc_span::d ef_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_interface::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}>::{closure# 0}::{closure#0}::{closure#0}>>
17: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_data_structures::sync::parallel::disabled::par_for_each_in<&[rustc_span::def_ id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_interface::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}>::{closure#0}: :{closure#0}::{closure#0}>
18: <rustc_session::session::Session>::time::<(), rustc_interface::passes::run_required_analyses::{closure#1}>
19: rustc_interface::passes::analysis
20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_mid dle::query::erase::Erased<[u8; 1]>>
21: <rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, ())>>::call_on ce
22: 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, true>
23: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
24: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure#3}, core::result::Result<(), rus tc_span::ErrorGuaranteed>>
25: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}, core::result::Result<core::option::Option< rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
26: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_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::ErrorGuarant eed>>::{closure#0}::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
27: rustc_span::create_session_globals_then::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::util::run_in_thread_with_globals<ru stc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::resul t::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
28: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_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::ErrorGuarant eed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
29: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Re sult<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0 }::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#2} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
30: std::sys::pal::unix::thread::Thread::new::thread_start
31: __pthread_joiner_wake

@dmitrii-ubskii dmitrii-ubskii 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 Aug 28, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 28, 2024
@dmitrii-ubskii
Copy link
Author

dmitrii-ubskii commented Aug 28, 2024

Issue is also present on nightly:

rustc +nightly --version --verbose:

rustc 1.82.0-nightly (1f12b9b0f 2024-08-27)
binary: rustc
commit-hash: 1f12b9b0fdbe735968ac002792a720f0ba4faca6
commit-date: 2024-08-27
host: aarch64-apple-darwin
release: 1.82.0-nightly
LLVM version: 19.1.0

rustc-ice-2024-08-28T15_04_22-82289.txt

@matthiaskrgr
Copy link
Member

probably duplicate of #103899

@compiler-errors
Copy link
Member

Yep, duplicate of #103899. The definition of wrap is not well-formed and should have T: Helper. This cannot be deduced currently from the J: Trait<Item = T> bound.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 1, 2024
@saethlin saethlin closed this as not planned Won't fix, can't repro, duplicate, stale Sep 1, 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. 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

5 participants