thread 'rustc' panicked at 'Normalizing Binder(<for<'x> fn(&'x u32) as std::ops::Fn<(&'x u32,)>>, []) without wrapping in a `Binder`', compiler/rustc_trait_selection/src/traits/project.rs:333:9
stack backtrace:
0: rust_begin_unwind
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/std/src/panicking.rs:498:5
1: core::panicking::panic_fmt
at /rustc/9d1b2106e23b1abd32fce1f17267604a5102f57a/library/core/src/panicking.rs:116:14
2: rustc_data_structures::stack::ensure_sufficient_stack::<rustc_middle::ty::sty::Binder<rustc_middle::ty::sty::TraitRef>, rustc_trait_selection::traits::project::normalize_with_depth_to<rustc_middle::ty::sty::Binder<rustc_middle::ty::sty::TraitRef>>::{closure#0}>
3: rustc_trait_selection::traits::project::normalize_with_depth::<rustc_middle::ty::sty::Binder<rustc_middle::ty::sty::TraitRef>>
4: rustc_data_structures::stack::ensure_sufficient_stack::<rustc_infer::traits::project::Normalized<rustc_middle::ty::sty::Binder<rustc_middle::ty::sty::TraitRef>>, <rustc_trait_selection::traits::select::SelectionContext>::confirm_fn_pointer_candidate::{closure#1}>
5: <rustc_trait_selection::traits::select::SelectionContext>::confirm_candidate
6: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_stack
7: <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>::evaluate_trait_predicate_recursively::{closure#2}, core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>>::{closure#0}, core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>>
8: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
9: rustc_data_structures::stack::ensure_sufficient_stack::<core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>, <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively::{closure#0}>
10: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_root_obligation
11: <rustc_infer::infer::InferCtxtBuilder>::enter_with_canonical::<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::Predicate>, core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>, rustc_traits::evaluate_obligation::evaluate_obligation::{closure#0}>
12: rustc_traits::evaluate_obligation::evaluate_obligation
13: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt>
14: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::evaluate_obligation
15: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::predicate_must_hold_considering_regions
16: <rustc_trait_selection::traits::fulfill::FulfillProcessor>::progress_changed_obligations
17: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor, rustc_data_structures::obligation_forest::Outcome<rustc_trait_selection::traits::fulfill::PendingPredicateObligation, rustc_infer::traits::FulfillmentErrorCode>>
18: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
19: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
20: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
21: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
22: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
23: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
24: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
25: rustc_typeck::check::check::check_fn
26: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
27: rustc_typeck::check::typeck
28: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
29: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
30: rustc_typeck::check::typeck
31: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
32: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
33: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_typeck::check::typeck_item_bodies::{closure#0}>
34: rustc_typeck::check::typeck_item_bodies
35: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), ()>>
36: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
37: <rustc_session::session::Session>::time::<(), rustc_typeck::check_crate::{closure#7}>
38: rustc_typeck::check_crate
39: rustc_interface::passes::analysis
40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorReported>>>
41: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
42: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
43: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
44: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>
45: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Code
Library version (choose "Build" from the pulldown):
Binary version:
The two have (slightly) differing output. Note: If you compile as a binary but don't call the problematic function, compilation succeeds. Compiling as a library ICEs even when the function is private.
Meta
Error output
Library version
Binary version
Backtrace (Library version)
Backtrace (Binary version)
Version it worked on
Works on
1.41.0. Works on versions prior to this down to1.7.0(spot checked). (Version1.6.0gives obsoleted errorE0193.)Versions with regression
Versions
1.42.0and up (spot checked). The error changes between1.54.0and1.55.0.@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged