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

super_relate_consts ty field equality assert doesnt support <T, const N: T> #107898

Closed
michael-swan opened this issue Feb 10, 2023 · 4 comments · Fixed by #107940
Closed

super_relate_consts ty field equality assert doesnt support <T, const N: T> #107898

michael-swan opened this issue Feb 10, 2023 · 4 comments · Fixed by #107940
Assignees
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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

@michael-swan
Copy link

Code

#![feature(generic_const_exprs)]

use std::mem::size_of;

trait X<T> {
    fn f(self);
    fn g(self);
}

struct Y;

impl<T> X<T> for Y
    where [(); size_of::<T>()]: Sized {
    fn f(self) {
        self.g();
    }
    fn g(self) {
    }
}

Meta

rustc --version --verbose:

rustc 1.69.0-nightly (8996ea93b 2023-02-09)
binary: rustc
commit-hash: 8996ea93b6e554148c4286e62b613f12a3ee505c
commit-date: 2023-02-09
host: x86_64-unknown-linux-gnu
release: 1.69.0-nightly
LLVM version: 15.0.7

Error output

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

error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<_>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<T>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<_>} != fn() -> usize {std::mem::size_of::<T>}
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &alloc::string::String>
             2: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             3: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             4: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             5: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             6: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_infer::infer::InferOk<()>, rustc_middle::ty::error::TypeError, <rustc_infer::infer::at::Trace>::eq<rustc_middle::ty::consts::Const>::{closure#0}>
             7: <rustc_infer::infer::at::At>::eq::<rustc_middle::ty::consts::Const>
             8: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively
             9: <rustc_trait_selection::traits::select::SelectionContext>::assemble_candidates
            10: <rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache
            11: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_anon_task::<rustc_middle::ty::context::TyCtxt, <rustc_trait_selection::traits::select::SelectionContext>::in_task<<rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}, core::result::Result<core::option::Option<rustc_middle::traits::select::SelectionCandidate>, rustc_middle::traits::SelectionError>>::{closure#0}, core::result::Result<core::option::Option<rustc_middle::traits::select::SelectionCandidate>, rustc_middle::traits::SelectionError>>
            12: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_stack
            13: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicates_recursively::<alloc::vec::into_iter::IntoIter<rustc_infer::traits::Obligation<rustc_middle::ty::Predicate>>>
            14: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_stack
            15: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively
            16: rustc_traits::evaluate_obligation::evaluate_obligation
            17: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
            18: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_may_hold
            19: <rustc_infer::infer::InferCtxt>::probe::<rustc_hir_typeck::method::probe::ProbeResult, <rustc_hir_typeck::method::probe::ProbeContext>::consider_probe::{closure#0}>
            20: <rustc_hir_typeck::method::probe::ProbeContext>::pick_all_method
            21: <rustc_infer::infer::InferCtxt>::probe::<core::result::Result<rustc_hir_typeck::method::probe::Pick, rustc_hir_typeck::method::MethodError>, <rustc_hir_typeck::fn_ctxt::FnCtxt>::probe_op<<rustc_hir_typeck::fn_ctxt::FnCtxt>::probe_for_name::{closure#0}, rustc_hir_typeck::method::probe::Pick>::{closure#4}>
            22: <rustc_hir_typeck::fn_ctxt::FnCtxt>::lookup_method
            23: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            24: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
            25: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            26: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
            27: rustc_hir_typeck::check::check_fn
            28: rustc_hir_typeck::typeck
            29: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::typeck_results::TypeckResults>
            30: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            31: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_typeck::typeck_item_bodies::{closure#0}>::{closure#0}>
            32: rustc_hir_typeck::typeck_item_bodies
            33: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()>
            34: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
            35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
            36: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#7}>
            37: rustc_hir_analysis::check_crate
            38: rustc_interface::passes::analysis
            39: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            41: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            42: <rustc_interface::passes::QueryContext>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            43: <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_errors::ErrorGuaranteed>>
            44: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            45: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            46: 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_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            47: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            48: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            49: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            50: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/std/src/sys/unix/thread.rs:108:17
            51: start_thread
                       at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
            52: clone
                       at /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
          

error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<_>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<T>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<_>} != fn() -> usize {std::mem::size_of::<T>}
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &alloc::string::String>
             2: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             3: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             4: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             5: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             6: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_infer::infer::InferOk<()>, rustc_middle::ty::error::TypeError, <rustc_infer::infer::at::Trace>::eq<rustc_middle::ty::consts::Const>::{closure#0}>
             7: <rustc_infer::infer::at::At>::eq::<rustc_middle::ty::consts::Const>
             8: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicates_recursively::<alloc::vec::into_iter::IntoIter<rustc_infer::traits::Obligation<rustc_middle::ty::Predicate>>>
             9: <rustc_infer::infer::InferCtxt>::probe::<core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>, <rustc_trait_selection::traits::select::SelectionContext>::evaluation_probe<<rustc_trait_selection::traits::select::SelectionContext>::evaluate_candidate::{closure#0}::{closure#0}>::{closure#0}>
            10: <alloc::vec::Vec<rustc_trait_selection::traits::select::EvaluatedCandidate> as alloc::vec::spec_from_iter::SpecFromIter<rustc_trait_selection::traits::select::EvaluatedCandidate, core::iter::adapters::GenericShunt<core::iter::adapters::flatten::FlatMap<core::iter::adapters::map::Map<alloc::vec::into_iter::IntoIter<rustc_middle::traits::select::SelectionCandidate>, <rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache::{closure#0}>, core::option::Option<core::result::Result<rustc_trait_selection::traits::select::EvaluatedCandidate, rustc_middle::traits::SelectionError>>, <core::result::Result<core::option::Option<rustc_trait_selection::traits::select::EvaluatedCandidate>, rustc_middle::traits::SelectionError>>::transpose>, core::result::Result<core::convert::Infallible, rustc_middle::traits::SelectionError>>>>::from_iter
            11: <rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache
            12: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_anon_task::<rustc_middle::ty::context::TyCtxt, <rustc_trait_selection::traits::select::SelectionContext>::in_task<<rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}, core::result::Result<core::option::Option<rustc_middle::traits::select::SelectionCandidate>, rustc_middle::traits::SelectionError>>::{closure#0}, core::result::Result<core::option::Option<rustc_middle::traits::select::SelectionCandidate>, rustc_middle::traits::SelectionError>>
            13: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_stack
            14: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicates_recursively::<alloc::vec::into_iter::IntoIter<rustc_infer::traits::Obligation<rustc_middle::ty::Predicate>>>
            15: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_stack
            16: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively
            17: rustc_traits::evaluate_obligation::evaluate_obligation
            18: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
            19: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_may_hold
            20: <rustc_infer::infer::InferCtxt>::probe::<rustc_hir_typeck::method::probe::ProbeResult, <rustc_hir_typeck::method::probe::ProbeContext>::consider_probe::{closure#0}>
            21: <rustc_hir_typeck::method::probe::ProbeContext>::pick_all_method
            22: <rustc_infer::infer::InferCtxt>::probe::<core::result::Result<rustc_hir_typeck::method::probe::Pick, rustc_hir_typeck::method::MethodError>, <rustc_hir_typeck::fn_ctxt::FnCtxt>::probe_op<<rustc_hir_typeck::fn_ctxt::FnCtxt>::probe_for_name::{closure#0}, rustc_hir_typeck::method::probe::Pick>::{closure#4}>
            23: <rustc_hir_typeck::fn_ctxt::FnCtxt>::lookup_method
            24: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            25: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
            26: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            27: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
            28: rustc_hir_typeck::check::check_fn
            29: rustc_hir_typeck::typeck
            30: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::typeck_results::TypeckResults>
            31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            32: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_typeck::typeck_item_bodies::{closure#0}>::{closure#0}>
            33: rustc_hir_typeck::typeck_item_bodies
            34: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()>
            35: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
            36: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
            37: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#7}>
            38: rustc_hir_analysis::check_crate
            39: rustc_interface::passes::analysis
            40: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            41: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            42: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            43: <rustc_interface::passes::QueryContext>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::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_errors::ErrorGuaranteed>>
            45: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            46: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            47: 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_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            48: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            49: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            50: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            51: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/std/src/sys/unix/thread.rs:108:17
            52: start_thread
                       at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
            53: clone
                       at /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
          

error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<T>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<_>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<T>} != fn() -> usize {std::mem::size_of::<_>}
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &alloc::string::String>
             2: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             3: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             4: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             5: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             6: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_infer::infer::InferOk<()>, rustc_middle::ty::error::TypeError, <rustc_infer::infer::at::Trace>::eq<rustc_middle::ty::consts::Const>::{closure#0}>
             7: <rustc_infer::infer::at::At>::eq::<rustc_middle::ty::consts::Const>
             8: <rustc_trait_selection::traits::engine::ObligationCtxt>::eq::<rustc_middle::ty::consts::Const>
             9: <rustc_infer::infer::InferCtxt>::probe::<bool, <rustc_trait_selection::traits::const_evaluatable::satisfied_from_param_env::Visitor as rustc_middle::ty::visit::TypeVisitor>::visit_const::{closure#0}>
            10: <rustc_trait_selection::traits::const_evaluatable::satisfied_from_param_env::Visitor as rustc_middle::ty::visit::TypeVisitor>::visit_const
            11: rustc_trait_selection::traits::const_evaluatable::satisfied_from_param_env
            12: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable
            13: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicates_recursively::<alloc::vec::into_iter::IntoIter<rustc_infer::traits::Obligation<rustc_middle::ty::Predicate>>>
            14: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_stack
            15: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively
            16: rustc_traits::evaluate_obligation::evaluate_obligation
            17: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
            18: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_may_hold
            19: <rustc_infer::infer::InferCtxt>::probe::<rustc_hir_typeck::method::probe::ProbeResult, <rustc_hir_typeck::method::probe::ProbeContext>::consider_probe::{closure#0}>
            20: <rustc_hir_typeck::method::probe::ProbeContext>::pick_all_method
            21: <rustc_infer::infer::InferCtxt>::probe::<core::result::Result<rustc_hir_typeck::method::probe::Pick, rustc_hir_typeck::method::MethodError>, <rustc_hir_typeck::fn_ctxt::FnCtxt>::probe_op<<rustc_hir_typeck::fn_ctxt::FnCtxt>::probe_for_name::{closure#0}, rustc_hir_typeck::method::probe::Pick>::{closure#4}>
            22: <rustc_hir_typeck::fn_ctxt::FnCtxt>::lookup_method
            23: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            24: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
            25: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            26: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
            27: rustc_hir_typeck::check::check_fn
            28: rustc_hir_typeck::typeck
            29: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::typeck_results::TypeckResults>
            30: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            31: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_typeck::typeck_item_bodies::{closure#0}>::{closure#0}>
            32: rustc_hir_typeck::typeck_item_bodies
            33: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()>
            34: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
            35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
            36: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#7}>
            37: rustc_hir_analysis::check_crate
            38: rustc_interface::passes::analysis
            39: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            41: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            42: <rustc_interface::passes::QueryContext>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            43: <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_errors::ErrorGuaranteed>>
            44: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            45: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            46: 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_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            47: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            48: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            49: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            50: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/std/src/sys/unix/thread.rs:108:17
            51: start_thread
                       at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
            52: clone
                       at /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
          

error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<T>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<_>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<T>} != fn() -> usize {std::mem::size_of::<_>}
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &alloc::string::String>
             2: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             3: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             4: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             5: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             6: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_infer::infer::InferOk<()>, rustc_middle::ty::error::TypeError, <rustc_infer::infer::at::Trace>::eq<rustc_middle::ty::consts::Const>::{closure#0}>
             7: <rustc_infer::infer::at::At>::eq::<rustc_middle::ty::consts::Const>
             8: <rustc_trait_selection::traits::engine::ObligationCtxt>::eq::<rustc_middle::ty::consts::Const>
             9: rustc_trait_selection::traits::const_evaluatable::satisfied_from_param_env
            10: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable
            11: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicates_recursively::<alloc::vec::into_iter::IntoIter<rustc_infer::traits::Obligation<rustc_middle::ty::Predicate>>>
            12: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_stack
            13: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively
            14: rustc_traits::evaluate_obligation::evaluate_obligation
            15: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt, rustc_middle::dep_graph::dep_node::DepKind>
            16: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_may_hold
            17: <rustc_infer::infer::InferCtxt>::probe::<rustc_hir_typeck::method::probe::ProbeResult, <rustc_hir_typeck::method::probe::ProbeContext>::consider_probe::{closure#0}>
            18: <rustc_hir_typeck::method::probe::ProbeContext>::pick_all_method
            19: <rustc_infer::infer::InferCtxt>::probe::<core::result::Result<rustc_hir_typeck::method::probe::Pick, rustc_hir_typeck::method::MethodError>, <rustc_hir_typeck::fn_ctxt::FnCtxt>::probe_op<<rustc_hir_typeck::fn_ctxt::FnCtxt>::probe_for_name::{closure#0}, rustc_hir_typeck::method::probe::Pick>::{closure#4}>
            20: <rustc_hir_typeck::fn_ctxt::FnCtxt>::lookup_method
            21: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            22: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
            23: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            24: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
            25: rustc_hir_typeck::check::check_fn
            26: rustc_hir_typeck::typeck
            27: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::typeck_results::TypeckResults>
            28: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            29: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_typeck::typeck_item_bodies::{closure#0}>::{closure#0}>
            30: rustc_hir_typeck::typeck_item_bodies
            31: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()>
            32: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
            33: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
            34: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#7}>
            35: rustc_hir_analysis::check_crate
            36: rustc_interface::passes::analysis
            37: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            38: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            39: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            40: <rustc_interface::passes::QueryContext>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            41: <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_errors::ErrorGuaranteed>>
            42: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            43: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            44: 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_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            45: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            46: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            47: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            48: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/std/src/sys/unix/thread.rs:108:17
            49: start_thread
                       at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
            50: clone
                       at /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
          

error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<T>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<_>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<T>} != fn() -> usize {std::mem::size_of::<_>}
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &alloc::string::String>
             2: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             3: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             4: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             5: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             6: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_infer::infer::InferOk<()>, rustc_middle::ty::error::TypeError, <rustc_infer::infer::at::Trace>::eq<rustc_middle::ty::consts::Const>::{closure#0}>
             7: <rustc_infer::infer::at::At>::eq::<rustc_middle::ty::consts::Const>
             8: <rustc_trait_selection::traits::engine::ObligationCtxt>::eq::<rustc_middle::ty::consts::Const>
             9: <rustc_infer::infer::InferCtxt>::probe::<bool, <rustc_trait_selection::traits::const_evaluatable::satisfied_from_param_env::Visitor as rustc_middle::ty::visit::TypeVisitor>::visit_const::{closure#0}>
            10: <rustc_trait_selection::traits::const_evaluatable::satisfied_from_param_env::Visitor as rustc_middle::ty::visit::TypeVisitor>::visit_const
            11: rustc_trait_selection::traits::const_evaluatable::satisfied_from_param_env
            12: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable
            13: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
            14: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
            15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
            16: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
            18: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            19: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
            20: rustc_hir_typeck::check::check_fn
            21: rustc_hir_typeck::typeck
            22: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::typeck_results::TypeckResults>
            23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            24: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_typeck::typeck_item_bodies::{closure#0}>::{closure#0}>
            25: rustc_hir_typeck::typeck_item_bodies
            26: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()>
            27: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
            28: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
            29: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#7}>
            30: rustc_hir_analysis::check_crate
            31: rustc_interface::passes::analysis
            32: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            33: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            34: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            35: <rustc_interface::passes::QueryContext>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            36: <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_errors::ErrorGuaranteed>>
            37: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            38: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            39: 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_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            40: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            41: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            42: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            43: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/std/src/sys/unix/thread.rs:108:17
            44: start_thread
                       at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
            45: clone
                       at /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
          

error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<T>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<_>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<T>} != fn() -> usize {std::mem::size_of::<_>}
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &alloc::string::String>
             2: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             3: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             4: rustc_middle::ty::relate::super_relate_consts::<rustc_infer::infer::equate::Equate>
             5: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             6: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_infer::infer::InferOk<()>, rustc_middle::ty::error::TypeError, <rustc_infer::infer::at::Trace>::eq<rustc_middle::ty::consts::Const>::{closure#0}>
             7: <rustc_infer::infer::at::At>::eq::<rustc_middle::ty::consts::Const>
             8: <rustc_trait_selection::traits::engine::ObligationCtxt>::eq::<rustc_middle::ty::consts::Const>
             9: rustc_trait_selection::traits::const_evaluatable::satisfied_from_param_env
            10: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable
            11: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
            12: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
            13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
            14: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
            16: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
            17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
            18: rustc_hir_typeck::check::check_fn
            19: rustc_hir_typeck::typeck
            20: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::typeck_results::TypeckResults>
            21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            22: rustc_data_structures::sync::par_for_each_in::<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_typeck::typeck_item_bodies::{closure#0}>::{closure#0}>
            23: rustc_hir_typeck::typeck_item_bodies
            24: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()>
            25: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
            26: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
            27: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#7}>
            28: rustc_hir_analysis::check_crate
            29: rustc_interface::passes::analysis
            30: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            32: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            33: <rustc_interface::passes::QueryContext>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::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_errors::ErrorGuaranteed>>
            35: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            36: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            37: 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_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
            38: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            39: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            40: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/alloc/src/boxed.rs:1988:9
            41: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/8996ea93b6e554148c4286e62b613f12a3ee505c/library/std/src/sys/unix/thread.rs:108:17
            42: start_thread
                       at /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
            43: clone
                       at /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Backtrace

see above

This occurred in code different from the above but this is a minimal example that causes this failure. I believe I am disobeying some rules in the manner in which T is not bound in the underlying type of the trait. This bug appeared in my own code that worked with a previous nightly build. That code does bind T into the underlying type and still fails. If I bind it in this example with the following changes:

#![feature(generic_const_exprs)]

use std::mem::size_of;

trait X<T> {
    fn f(self);
    fn g(self);
}

struct Y<T>(T);

impl<T> X<T> for Y<T>
    where [(); size_of::<T>()]: Sized {
    fn f(self) {
        self.g();
    }
    fn g(self) {
    }
}

the error goes away. I will need to create a minimal example that produces an ICE closer to the failure in my own code but I was struggling to do this. This is at least one ICE of interest and perhaps the unbound T should itself be prevented. I'm not entirely sure. Worthy of note, the following also compiles fine:

trait X<Word> {
    fn f(self);
    fn g(self);
}

struct Y;

impl<T> X<T> for Y {
    fn f(self) {
        <Y as X<T>>::g(self);
    }
    fn g(self) {
    }
}

which omits all of the generic_const_expr stuff.

@michael-swan michael-swan 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 Feb 10, 2023
@michael-swan
Copy link
Author

I've isolated it to the following commit range: 50d3ba5..75a0be9

@michael-swan
Copy link
Author

I determined it was due to the above linked-from PR.

@michael-swan
Copy link
Author

michael-swan commented Feb 10, 2023

Prior to this PR, the above code would emit the following warning instead of generating the ICE:

error[E0282]: type annotations needed
  --> /home/miswan/repo/trace32.rs/crates/core/ice-example/src/lib.rs:15:14
   |
15 |         self.g();
   |              ^
   |
help: try using a fully qualified path to specify the expected types
   |
15 |         <Y as X<T>>::g(self);
   |         +++++++++++++++    ~

error: aborting due to previous error; 1 warning emitted

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

@BoxyUwU BoxyUwU added A-const-generics Area: const generics (parameters and arguments) F-generic_const_exprs `#![feature(generic_const_exprs)]` labels Feb 10, 2023
@BoxyUwU BoxyUwU changed the title Generic Const Expr ICE super_relate_consts ty field equality assert doesnt support <T, const N: T> Feb 10, 2023
@BoxyUwU BoxyUwU self-assigned this Feb 10, 2023
@BoxyUwU
Copy link
Member

BoxyUwU commented Feb 11, 2023

This is caused by the fact that ConstKind::Expr acts sort of like a const item with a const param ty the references other generic parameters: const FOO<T, const N: T>. When we relate the T in super_relate_consts we constrain infer vars to be the same as eachother but do not end up actually resolving the infer vars before relating N so the assertion that const param ty's are == sees two different infer vars instead of the resolved ones.

@bors bors closed this as completed in 068161e Feb 15, 2023
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 15, 2023
Skip over all the nightlies from 2023-02-06 until 2023-02-15 as those
ICE when trying to build kani with:
```
error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<[T; N]>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<[T; _]>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<[T; N]>} != fn() -> usize {std::mem::size_of::<[T; _]>}
```

This issue was reported upstream as
rust-lang/rust#107898, and fixed in
rust-lang/rust#107940, which isn't part of any
of the above nightlies.

Doing this multi-day update also requires addressing:

Remove some superfluous type parameters from layout.rs rust-lang/rust#107163
Introduce -Zterminal-urls to use OSC8 for error codes rust-lang/rust#107838
s/eval_usize/eval_target_usize/ for clarity rust-lang/rust#108029

Co-authored-by: Qinheping Hu <[email protected]>
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 15, 2023
Skip over all the nightlies from 2023-02-06 until 2023-02-15 as those
ICE when trying to build kani with:
```
error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<[T; N]>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<[T; _]>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<[T; N]>} != fn() -> usize {std::mem::size_of::<[T; _]>}
```

This issue was reported upstream as
rust-lang/rust#107898, and fixed in
rust-lang/rust#107940, which isn't part of any
of the above nightlies.

Doing this multi-day update also requires addressing:

Remove some superfluous type parameters from layout.rs rust-lang/rust#107163
Introduce -Zterminal-urls to use OSC8 for error codes rust-lang/rust#107838
s/eval_usize/eval_target_usize/ for clarity rust-lang/rust#108029

Co-authored-by: Qinheping Hu <[email protected]>
tautschnig added a commit to tautschnig/kani that referenced this issue Apr 15, 2023
Skip over all the nightlies from 2023-02-06 until 2023-02-15 as those
ICE when trying to build kani with:
```
error: internal compiler error: cannot relate constants (Const { ty: fn() -> usize {std::mem::size_of::<[T; N]>}, kind: Value(Branch([])) }, Const { ty: fn() -> usize {std::mem::size_of::<[T; _]>}, kind: Value(Branch([])) }) of different types: fn() -> usize {std::mem::size_of::<[T; N]>} != fn() -> usize {std::mem::size_of::<[T; _]>}
```

This issue was reported upstream as
rust-lang/rust#107898, and fixed in
rust-lang/rust#107940, which isn't part of any
of the above nightlies.

Doing this multi-day update also requires addressing:

Remove some superfluous type parameters from layout.rs rust-lang/rust#107163
Introduce -Zterminal-urls to use OSC8 for error codes rust-lang/rust#107838
s/eval_usize/eval_target_usize/ for clarity rust-lang/rust#108029

Co-authored-by: Qinheping Hu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` 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

Successfully merging a pull request may close this issue.

2 participants