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 TAIT: Failed to unify obligation; no errors encountered even though delay_span_bug issued #111470

Closed
VictorBulba opened this issue May 11, 2023 · 3 comments · Fixed by #119816
Assignees
Labels
C-bug Category: This is a bug. F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@VictorBulba
Copy link

VictorBulba commented May 11, 2023

Hey! I was trying to make it work somehow with impl Fn*, when the function depends on the other generic parameters. I came to this approach and encountered an ICE.

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=ff6eed88b2feb32c9fb18a94384dc2ca

Code

#![feature(type_alias_impl_trait)]

use std::fmt::Debug;
use std::marker::PhantomData;

struct Foo<T: Debug, F: FnOnce(T)> {
    f: F,
    _phantom: PhantomData<T>,
}

type ImplT = impl Debug;
type FooImpl = Foo<ImplT, impl FnOnce(ImplT)>;

fn bar() -> FooImpl {
    Foo::<i32, _> {
        f: |_| (),
        _phantom: PhantomData,
    }
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (cba14074b 2023-05-10)
binary: rustc
commit-hash: cba14074bb4cc12bfe918eabd0d52a3999b2a461
commit-date: 2023-05-10
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

Output

error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: Failed to unify obligation `Obligation(predicate=AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (ImplT,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, depth=0)` with poly_projection `Binder(ProjectionPredicate(AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (i32,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, Term::Ty(())), [])`: Sorts(ExpectedFound { expected: i32, found: ImplT })
  --> src/lib.rs:17:13
   |
17 | fn bar() -> FooImpl {
   |             ^^^^^^^
   |
   = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
              1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
              2: <rustc_middle::ty::context::TyCtxt>::ty_error_with_message::<rustc_span::span_encoding::Span>
              3: rustc_trait_selection::traits::project::confirm_param_env_candidate
              4: rustc_trait_selection::traits::project::opt_normalize_projection_type
              5: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_trait_selection::traits::project::ProjectAndUnifyResult, rustc_infer::traits::project::MismatchedProjectionTypes, rustc_trait_selection::traits::project::poly_project_and_unify_type::{closure#0}>
              6: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
              7: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
              8: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
              9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::try_coerce
             10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
             11: rustc_hir_typeck::check::check_fn
             12: rustc_hir_typeck::typeck
             13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
             14: rustc_query_impl::get_query::typeck
             15: rustc_middle::ty::query::query_get_at::<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 8]>>>
             16: <rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator>::check
             17: <rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator as rustc_hir::intravisit::Visitor>::visit_nested_item
             18: rustc_hir::intravisit::walk_mod::<rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator>
             19: rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait
             20: rustc_hir_analysis::collect::type_of::type_of
             21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt>
             22: rustc_query_impl::get_query::type_of
             23: rustc_middle::ty::query::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
             24: rustc_hir_analysis::check::check::check_mod_item_types
             25: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             26: rustc_query_impl::get_query::check_mod_item_types
             27: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             28: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#6}>
             29: rustc_hir_analysis::check_crate
             30: rustc_interface::passes::analysis
             31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             32: rustc_query_impl::get_query::analysis
             33: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
             34: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
             35: std::sys_common::backtrace::__rust_begin_short_backtrace::<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#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
             36: <<std::thread::Builder>::spawn_unchecked_<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#1}>::{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}
             37: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
             38: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
             39: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys/unix/thread.rs:108:17
             40: start_thread
             41: clone
           

error: internal compiler error: Failed to unify obligation `Obligation(predicate=AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (ImplT,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, depth=0)` with poly_projection `Binder(ProjectionPredicate(AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (i32,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, Term::Ty(())), [])`: Sorts(ExpectedFound { expected: i32, found: ImplT })
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
             2: <rustc_middle::ty::context::TyCtxt>::ty_error_with_message::<rustc_span::span_encoding::Span>
             3: rustc_trait_selection::traits::project::confirm_param_env_candidate
             4: rustc_trait_selection::traits::project::opt_normalize_projection_type
             5: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_trait_selection::traits::project::ProjectAndUnifyResult, rustc_infer::traits::project::MismatchedProjectionTypes, rustc_trait_selection::traits::project::poly_project_and_unify_type::{closure#0}>
             6: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively
             7: rustc_traits::evaluate_obligation::evaluate_obligation
             8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt>
             9: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_considering_regions
            10: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
            11: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
            12: <rustc_trait_selection::traits::engine::ObligationCtxt>::select_all_or_error
            13: rustc_trait_selection::traits::query::type_op::custom::scrape_region_constraints::<rustc_borrowck::type_check::InstantiateOpaqueType, (), <rustc_borrowck::type_check::InstantiateOpaqueType as rustc_trait_selection::traits::query::type_op::TypeOp>::fully_perform::{closure#0}>
            14: <rustc_borrowck::type_check::TypeChecker>::fully_perform_op::<(), rustc_borrowck::type_check::InstantiateOpaqueType>
            15: <rustc_infer::infer::nll_relate::TypeRelating<rustc_borrowck::type_check::relate_tys::NllTypeRelatingDelegate>>::relate_opaques
            16: <rustc_middle::ty::subst::GenericArg as rustc_middle::ty::relate::Relate>::relate::<rustc_infer::infer::nll_relate::TypeRelating<rustc_borrowck::type_check::relate_tys::NllTypeRelatingDelegate>>
            17: rustc_middle::ty::relate::relate_substs_with_variances::<rustc_infer::infer::nll_relate::TypeRelating<rustc_borrowck::type_check::relate_tys::NllTypeRelatingDelegate>>
            18: rustc_middle::ty::relate::super_relate_tys::<rustc_infer::infer::nll_relate::TypeRelating<rustc_borrowck::type_check::relate_tys::NllTypeRelatingDelegate>>
            19: <rustc_borrowck::type_check::TypeChecker>::typeck_mir
            20: rustc_borrowck::nll::compute_regions
            21: rustc_borrowck::do_mir_borrowck
            22: rustc_borrowck::mir_borrowck
            23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
            24: rustc_query_impl::get_query::mir_borrowck
            25: rustc_middle::ty::query::query_get_at::<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 8]>>>
            26: <rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator>::check
            27: <rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator as rustc_hir::intravisit::Visitor>::visit_nested_item
            28: rustc_hir::intravisit::walk_mod::<rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator>
            29: rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait
            30: rustc_hir_analysis::collect::type_of::type_of
            31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt>
            32: rustc_query_impl::get_query::type_of
            33: rustc_middle::ty::query::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
            34: rustc_hir_analysis::check::check::check_mod_item_types
            35: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
            36: rustc_query_impl::get_query::check_mod_item_types
            37: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
            38: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#6}>
            39: rustc_hir_analysis::check_crate
            40: rustc_interface::passes::analysis
            41: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            42: rustc_query_impl::get_query::analysis
            43: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            44: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            45: std::sys_common::backtrace::__rust_begin_short_backtrace::<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#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            46: <<std::thread::Builder>::spawn_unchecked_<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#1}>::{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}
            47: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
            48: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
            49: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys/unix/thread.rs:108:17
            50: start_thread
            51: clone
          

error: internal compiler error: Failed to unify obligation `Obligation(predicate=AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (ImplT,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, depth=0)` with poly_projection `Binder(ProjectionPredicate(AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (i32,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, Term::Ty(())), [])`: Sorts(ExpectedFound { expected: i32, found: ImplT })
  --> src/lib.rs:19:5
   |
19 | /     Foo::<i32, _> {
20 | |         f: |_| (),
21 | |         _phantom: PhantomData,
22 | |     }
   | |_____^
   |
   = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
              1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
              2: <rustc_middle::ty::context::TyCtxt>::ty_error_with_message::<rustc_span::span_encoding::Span>
              3: rustc_trait_selection::traits::project::confirm_param_env_candidate
              4: rustc_trait_selection::traits::project::opt_normalize_projection_type
              5: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_trait_selection::traits::project::ProjectAndUnifyResult, rustc_infer::traits::project::MismatchedProjectionTypes, rustc_trait_selection::traits::project::poly_project_and_unify_type::{closure#0}>
              6: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
              7: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
              8: <rustc_trait_selection::traits::engine::ObligationCtxt>::select_all_or_error
              9: rustc_trait_selection::traits::query::type_op::custom::scrape_region_constraints::<rustc_borrowck::type_check::InstantiateOpaqueType, (), <rustc_borrowck::type_check::InstantiateOpaqueType as rustc_trait_selection::traits::query::type_op::TypeOp>::fully_perform::{closure#0}>
             10: <rustc_borrowck::type_check::TypeChecker>::fully_perform_op::<(), rustc_borrowck::type_check::InstantiateOpaqueType>
             11: <rustc_infer::infer::nll_relate::TypeRelating<rustc_borrowck::type_check::relate_tys::NllTypeRelatingDelegate>>::relate_opaques
             12: <rustc_middle::ty::subst::GenericArg as rustc_middle::ty::relate::Relate>::relate::<rustc_infer::infer::nll_relate::TypeRelating<rustc_borrowck::type_check::relate_tys::NllTypeRelatingDelegate>>
             13: rustc_middle::ty::relate::relate_substs_with_variances::<rustc_infer::infer::nll_relate::TypeRelating<rustc_borrowck::type_check::relate_tys::NllTypeRelatingDelegate>>
             14: rustc_middle::ty::relate::super_relate_tys::<rustc_infer::infer::nll_relate::TypeRelating<rustc_borrowck::type_check::relate_tys::NllTypeRelatingDelegate>>
             15: <rustc_borrowck::type_check::TypeChecker>::typeck_mir
             16: rustc_borrowck::nll::compute_regions
             17: rustc_borrowck::do_mir_borrowck
             18: rustc_borrowck::mir_borrowck
             19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             20: rustc_query_impl::get_query::mir_borrowck
             21: rustc_middle::ty::query::query_get_at::<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 8]>>>
             22: <rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator>::check
             23: <rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator as rustc_hir::intravisit::Visitor>::visit_nested_item
             24: rustc_hir::intravisit::walk_mod::<rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator>
             25: rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait
             26: rustc_hir_analysis::collect::type_of::type_of
             27: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt>
             28: rustc_query_impl::get_query::type_of
             29: rustc_middle::ty::query::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
             30: rustc_hir_analysis::check::check::check_mod_item_types
             31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             32: rustc_query_impl::get_query::check_mod_item_types
             33: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             34: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#6}>
             35: rustc_hir_analysis::check_crate
             36: rustc_interface::passes::analysis
             37: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             38: rustc_query_impl::get_query::analysis
             39: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
             40: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
             41: std::sys_common::backtrace::__rust_begin_short_backtrace::<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#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
             42: <<std::thread::Builder>::spawn_unchecked_<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#1}>::{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}
             43: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
             44: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
             45: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys/unix/thread.rs:108:17
             46: start_thread
             47: clone
           

error: internal compiler error: Failed to unify obligation `Obligation(predicate=AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (ImplT,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, depth=0)` with poly_projection `Binder(ProjectionPredicate(AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (i32,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, Term::Ty(())), [])`: Sorts(ExpectedFound { expected: i32, found: ImplT })
  --> src/lib.rs:19:5
   |
19 | /     Foo::<i32, _> {
20 | |         f: |_| (),
21 | |         _phantom: PhantomData,
22 | |     }
   | |_____^
   |
   = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
              1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
              2: <rustc_middle::ty::context::TyCtxt>::ty_error_with_message::<rustc_span::span_encoding::Span>
              3: rustc_trait_selection::traits::project::confirm_param_env_candidate
              4: rustc_trait_selection::traits::project::opt_normalize_projection_type
              5: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_trait_selection::traits::project::ProjectAndUnifyResult, rustc_infer::traits::project::MismatchedProjectionTypes, rustc_trait_selection::traits::project::poly_project_and_unify_type::{closure#0}>
              6: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
              7: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
              8: <rustc_trait_selection::traits::engine::ObligationCtxt>::select_all_or_error
              9: <rustc_infer::infer::InferCtxt as rustc_borrowck::region_infer::opaque_types::InferCtxtExt>::infer_opaque_definition_from_instantiation
             10: <rustc_borrowck::region_infer::RegionInferenceContext>::infer_opaque_types
             11: rustc_borrowck::nll::compute_regions
             12: rustc_borrowck::do_mir_borrowck
             13: rustc_borrowck::mir_borrowck
             14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
             15: rustc_query_impl::get_query::mir_borrowck
             16: rustc_middle::ty::query::query_get_at::<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 8]>>>
             17: <rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator>::check
             18: <rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator as rustc_hir::intravisit::Visitor>::visit_nested_item
             19: rustc_hir::intravisit::walk_mod::<rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait::ConstraintLocator>
             20: rustc_hir_analysis::collect::type_of::find_opaque_ty_constraints_for_tait
             21: rustc_hir_analysis::collect::type_of::type_of
             22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::type_of, rustc_query_impl::plumbing::QueryCtxt>
             23: rustc_query_impl::get_query::type_of
             24: rustc_middle::ty::query::query_get_at::<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::DefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
             25: rustc_hir_analysis::check::check::check_mod_item_types
             26: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             27: rustc_query_impl::get_query::check_mod_item_types
             28: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             29: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#6}>
             30: rustc_hir_analysis::check_crate
             31: rustc_interface::passes::analysis
             32: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             33: rustc_query_impl::get_query::analysis
             34: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
             35: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
             36: std::sys_common::backtrace::__rust_begin_short_backtrace::<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#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
             37: <<std::thread::Builder>::spawn_unchecked_<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#1}>::{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}
             38: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
             39: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
             40: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys/unix/thread.rs:108:17
             41: start_thread
             42: clone
           

error: internal compiler error: Failed to unify obligation `Obligation(predicate=AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (ImplT,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, depth=0)` with poly_projection `Binder(ProjectionPredicate(AliasTy { substs: [[closure@src/lib.rs:20:12: 20:15], (i32,)], def_id: DefId(2:2922 ~ core[7de8]::ops::function::FnOnce::Output) }, Term::Ty(())), [])`: Sorts(ExpectedFound { expected: i32, found: ImplT })
  --> src/lib.rs:15:27
   |
15 | type FooImpl = Foo<ImplT, impl FnOnce(ImplT)>;
   |                           ^^^^^^^^^^^^^^^^^^
   |
   = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
              1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
              2: <rustc_middle::ty::context::TyCtxt>::ty_error_with_message::<rustc_span::span_encoding::Span>
              3: rustc_trait_selection::traits::project::confirm_param_env_candidate
              4: rustc_trait_selection::traits::project::opt_normalize_projection_type
              5: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_trait_selection::traits::project::ProjectAndUnifyResult, rustc_infer::traits::project::MismatchedProjectionTypes, rustc_trait_selection::traits::project::poly_project_and_unify_type::{closure#0}>
              6: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
              7: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
              8: <rustc_trait_selection::traits::engine::ObligationCtxt>::select_all_or_error
              9: rustc_hir_analysis::check::check::check_mod_item_types
             10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_item_types, rustc_query_impl::plumbing::QueryCtxt>
             11: rustc_query_impl::get_query::check_mod_item_types
             12: <rustc_middle::hir::map::Map>::for_each_module::<rustc_hir_analysis::check_crate::{closure#6}::{closure#0}>
             13: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#6}>
             14: rustc_hir_analysis::check_crate
             15: rustc_interface::passes::analysis
             16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             17: rustc_query_impl::get_query::analysis
             18: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
             19: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
             20: std::sys_common::backtrace::__rust_begin_short_backtrace::<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#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
             21: <<std::thread::Builder>::spawn_unchecked_<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#1}>::{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}
             22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
             23: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/alloc/src/boxed.rs:1985:9
             24: std::sys::unix::thread::Thread::new::thread_start
                        at /rustc/cba14074bb4cc12bfe918eabd0d52a3999b2a461/library/std/src/sys/unix/thread.rs:108:17
             25: start_thread
             26: clone
           

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.71.0-nightly (cba14074b 2023-05-10) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

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

query stack during panic:
end of query stack

@VictorBulba VictorBulba 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 May 11, 2023
@compiler-errors compiler-errors self-assigned this May 11, 2023
@Jules-Bertholet
Copy link
Contributor

@rustbot label requires-nightly F-type_alias_impl_trait

@rustbot rustbot added F-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` requires-nightly This issue requires a nightly compiler in some way. labels May 12, 2023
@compiler-errors compiler-errors removed their assignment May 12, 2023
@matthiaskrgr
Copy link
Member

Regression in nightly-2023-02-22
Regression in f4c7596
#108311 cc @oli-obk

@oli-obk oli-obk self-assigned this Jun 14, 2023
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 25, 2023
@matthiaskrgr
Copy link
Member

still crashing, rustc 1.77.0-nightly (ca663b0 2024-01-08)

@bors bors closed this as completed in d4b276c Jan 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 16, 2024
Rollup merge of rust-lang#119816 - oli-obk:tait_ice_unify_obligations, r=lcnr

Define hidden types in confirmation

fixes  rust-lang#111470

r? `@lcnr` or `@compiler-errors`

explanation in the newly added test
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-type_alias_impl_trait `#[feature(type_alias_impl_trait)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants