Skip to content

Const generic defaults ICE: No bound vars found #93647

Closed
@DutchGhost

Description

@DutchGhost

Const generic defaults are being stabilized, #90207.

Code

struct X<const N: usize = {
    async move {}
}>;

Meta

rustc --version --verbose:

rustc 1.60.0-nightly (4e8fb743c 2022-02-03)

Error output

error: internal compiler error: compiler/rustc_middle/src/ty/context.rs:2720:21: No bound vars found for "expr {} (hir_id=HirId { owner: DefId(0:3 ~ playground[ea18]::X), local_id: 10 })" (HirId { owner: DefId(0:3 ~ playground[ea18]::X), local_id: 10 })
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1160:9
stack backtrace:
   0:     0x7f2e91a70ebc - std::backtrace_rs::backtrace::libunwind::trace::hddd5a7e459ce4327
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f2e91a70ebc - std::backtrace_rs::backtrace::trace_unsynchronized::h69db3e09cfd8bf11
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f2e91a70ebc - std::sys_common::backtrace::_print_fmt::h83b461b46804fdab
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f2e91a70ebc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2f6e5cd8872f3d74
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f2e91ad22dc - core::fmt::write::hd64a00f3787c90bd
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/core/src/fmt/mod.rs:1190:17
   5:     0x7f2e91a60383 - std::io::Write::write_fmt::h6347402c88d40325
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/io/mod.rs:1653:15
   6:     0x7f2e91a75181 - std::sys_common::backtrace::_print::h989064c3e0b39e3c
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f2e91a75181 - std::sys_common::backtrace::print::h4af8c55ce731a045
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f2e91a75181 - std::panicking::default_hook::{{closure}}::h41ef6f6a9fac6b53
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/panicking.rs:295:22
   9:     0x7f2e91a74e3f - std::panicking::default_hook::hbaf11e031e0e4a5f
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/panicking.rs:314:9
  10:     0x7f2e92252541 - rustc_driver[7b59b981d4c23d31]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f2e91a75a5b - std::panicking::rust_panic_with_hook::h4788f0bd625b1005
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/panicking.rs:702:17
  12:     0x7f2e93316281 - std[daefdbcf0dca51d0]::panicking::begin_panic::<rustc_errors[b77837aed2b0d3e7]::ExplicitBug>::{closure#0}
  13:     0x7f2e933161f6 - std[daefdbcf0dca51d0]::sys_common::backtrace::__rust_end_short_backtrace::<std[daefdbcf0dca51d0]::panicking::begin_panic<rustc_errors[b77837aed2b0d3e7]::ExplicitBug>::{closure#0}, !>
  14:     0x7f2e9331aa2f - std[daefdbcf0dca51d0]::panicking::begin_panic::<rustc_errors[b77837aed2b0d3e7]::ExplicitBug>
  15:     0x7f2e933270cd - std[daefdbcf0dca51d0]::panic::panic_any::<rustc_errors[b77837aed2b0d3e7]::ExplicitBug>
  16:     0x7f2e9332637d - <rustc_errors[b77837aed2b0d3e7]::HandlerInner>::bug
  17:     0x7f2e93325ed0 - <rustc_errors[b77837aed2b0d3e7]::Handler>::bug
  18:     0x7f2e931ac6d9 - rustc_middle[e664fb30aec2b69e]::ty::context::tls::with_opt::<rustc_middle[e664fb30aec2b69e]::util::bug::opt_span_bug_fmt<rustc_span[26d1c5a8904e1196]::span_encoding::Span>::{closure#0}, ()>
  19:     0x7f2e931ad830 - rustc_middle[e664fb30aec2b69e]::util::bug::opt_span_bug_fmt::<rustc_span[26d1c5a8904e1196]::span_encoding::Span>
  20:     0x7f2e931ad7a6 - rustc_middle[e664fb30aec2b69e]::util::bug::bug_fmt
  21:     0x7f2e93f9d473 - <rustc_middle[e664fb30aec2b69e]::ty::context::TyCtxt>::late_bound_vars
  22:     0x7f2e9431d895 - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::supplied_sig_of_closure
  23:     0x7f2e9361a04e - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::check_expr_closure
  24:     0x7f2e9361d95e - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::check_expr_kind
  25:     0x7f2e93602eaa - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::check_argument_types
  26:     0x7f2e935d99f9 - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  27:     0x7f2e935d65ba - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::check_call
  28:     0x7f2e9361abf0 - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::check_expr_kind
  29:     0x7f2e935e1a06 - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:     0x7f2e936099ab - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::check_block_with_expected
  31:     0x7f2e935e1a06 - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:     0x7f2e9369a18e - <rustc_infer[835d7697e80d8145]::infer::InferCtxtBuilder>::enter::<&rustc_middle[e664fb30aec2b69e]::ty::context::TypeckResults, <rustc_typeck[95242508bb98a5fb]::check::inherited::InheritedBuilder>::enter<rustc_typeck[95242508bb98a5fb]::check::typeck_with_fallback<rustc_typeck[95242508bb98a5fb]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[e664fb30aec2b69e]::ty::context::TypeckResults>::{closure#0}>
  33:     0x7f2e93671432 - rustc_typeck[95242508bb98a5fb]::check::typeck
  34:     0x7f2e93b1c077 - rustc_query_system[59fab566a51c2c24]::query::plumbing::try_execute_query::<rustc_query_impl[ae50953882263c5d]::plumbing::QueryCtxt, rustc_query_system[59fab566a51c2c24]::query::caches::DefaultCache<rustc_span[26d1c5a8904e1196]::def_id::LocalDefId, &rustc_middle[e664fb30aec2b69e]::ty::context::TypeckResults>>
  35:     0x7f2e93b7aacc - <rustc_query_impl[ae50953882263c5d]::Queries as rustc_middle[e664fb30aec2b69e]::ty::query::QueryEngine>::typeck
  36:     0x7f2e93f8cbf2 - <rustc_middle[e664fb30aec2b69e]::ty::context::TyCtxt>::typeck_opt_const_arg
  37:     0x7f2e93a87721 - rustc_const_eval[55e19033940159c7]::const_eval::eval_queries::eval_to_allocation_raw_provider
  38:     0x7f2e93b09a9c - rustc_query_system[59fab566a51c2c24]::query::plumbing::try_execute_query::<rustc_query_impl[ae50953882263c5d]::plumbing::QueryCtxt, rustc_query_system[59fab566a51c2c24]::query::caches::DefaultCache<rustc_middle[e664fb30aec2b69e]::ty::ParamEnvAnd<rustc_middle[e664fb30aec2b69e]::mir::interpret::GlobalId>, core[90c82cfbe27f5d33]::result::Result<rustc_middle[e664fb30aec2b69e]::mir::interpret::value::ConstAlloc, rustc_middle[e664fb30aec2b69e]::mir::interpret::error::ErrorHandled>>>
  39:     0x7f2e93b7aebf - <rustc_query_impl[ae50953882263c5d]::Queries as rustc_middle[e664fb30aec2b69e]::ty::query::QueryEngine>::eval_to_allocation_raw
  40:     0x7f2e93a869b2 - rustc_const_eval[55e19033940159c7]::const_eval::eval_queries::eval_to_const_value_raw_provider
  41:     0x7f2e93b0a94b - rustc_query_system[59fab566a51c2c24]::query::plumbing::try_execute_query::<rustc_query_impl[ae50953882263c5d]::plumbing::QueryCtxt, rustc_query_system[59fab566a51c2c24]::query::caches::DefaultCache<rustc_middle[e664fb30aec2b69e]::ty::ParamEnvAnd<rustc_middle[e664fb30aec2b69e]::mir::interpret::GlobalId>, core[90c82cfbe27f5d33]::result::Result<rustc_middle[e664fb30aec2b69e]::mir::interpret::value::ConstValue, rustc_middle[e664fb30aec2b69e]::mir::interpret::error::ErrorHandled>>>
  42:     0x7f2e93b7b07b - <rustc_query_impl[ae50953882263c5d]::Queries as rustc_middle[e664fb30aec2b69e]::ty::query::QueryEngine>::eval_to_const_value_raw
  43:     0x7f2e93f82b4a - <rustc_middle[e664fb30aec2b69e]::ty::context::TyCtxt>::const_eval_global_id
  44:     0x7f2e94908a49 - <rustc_middle[e664fb30aec2b69e]::ty::context::TyCtxt>::const_eval_resolve
  45:     0x7f2e948ab391 - <rustc_infer[835d7697e80d8145]::infer::InferCtxt>::const_eval_resolve
  46:     0x7f2e9487f659 - rustc_trait_selection[99ac7681cfb15a86]::traits::const_evaluatable::is_const_evaluatable
  47:     0x7f2e93e6a679 - <rustc_trait_selection[99ac7681cfb15a86]::traits::fulfill::FulfillProcessor>::progress_changed_obligations
  48:     0x7f2e93e73834 - <rustc_data_structures[9901de6203b925f4]::obligation_forest::ObligationForest<rustc_trait_selection[99ac7681cfb15a86]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[99ac7681cfb15a86]::traits::fulfill::FulfillProcessor, rustc_data_structures[9901de6203b925f4]::obligation_forest::Outcome<rustc_trait_selection[99ac7681cfb15a86]::traits::fulfill::PendingPredicateObligation, rustc_infer[835d7697e80d8145]::traits::FulfillmentErrorCode>>
  49:     0x7f2e93e66198 - <rustc_trait_selection[99ac7681cfb15a86]::traits::fulfill::FulfillmentContext as rustc_infer[835d7697e80d8145]::traits::engine::TraitEngine>::select_all_or_error
  50:     0x7f2e93627da5 - <rustc_typeck[95242508bb98a5fb]::check::fn_ctxt::FnCtxt>::select_all_obligations_or_error
  51:     0x7f2e9435fba7 - <rustc_infer[835d7697e80d8145]::infer::InferCtxtBuilder>::enter::<(), <rustc_typeck[95242508bb98a5fb]::check::inherited::InheritedBuilder>::enter<<rustc_typeck[95242508bb98a5fb]::check::wfcheck::CheckWfFcxBuilder>::with_fcx<rustc_typeck[95242508bb98a5fb]::check::wfcheck::check_type_defn<rustc_typeck[95242508bb98a5fb]::check::wfcheck::check_item_well_formed::{closure#2}>::{closure#0}>::{closure#0}, ()>::{closure#0}>
  52:     0x7f2e936f5aae - rustc_typeck[95242508bb98a5fb]::check::wfcheck::check_item_well_formed
  53:     0x7f2e93b1ed9e - rustc_query_system[59fab566a51c2c24]::query::plumbing::try_execute_query::<rustc_query_impl[ae50953882263c5d]::plumbing::QueryCtxt, rustc_query_system[59fab566a51c2c24]::query::caches::DefaultCache<rustc_span[26d1c5a8904e1196]::def_id::LocalDefId, ()>>
  54:     0x7f2e93b80ee5 - <rustc_query_impl[ae50953882263c5d]::Queries as rustc_middle[e664fb30aec2b69e]::ty::query::QueryEngine>::check_item_well_formed
  55:     0x7f2e936bfb74 - <rustc_middle[e664fb30aec2b69e]::hir::map::Map>::par_visit_all_item_likes::<rustc_typeck[95242508bb98a5fb]::check::wfcheck::CheckTypeWellFormedVisitor>
  56:     0x7f2e9435421c - <rustc_session[bcbf86d149cb5e94]::session::Session>::track_errors::<rustc_typeck[95242508bb98a5fb]::check_crate::{closure#5}, ()>
  57:     0x7f2e943397cb - rustc_typeck[95242508bb98a5fb]::check_crate
  58:     0x7f2e940ec287 - rustc_interface[be440f50dcda62f9]::passes::analysis
  59:     0x7f2e94584729 - rustc_query_system[59fab566a51c2c24]::query::plumbing::try_execute_query::<rustc_query_impl[ae50953882263c5d]::plumbing::QueryCtxt, rustc_query_system[59fab566a51c2c24]::query::caches::DefaultCache<(), core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>>>
  60:     0x7f2e945c28a5 - rustc_query_system[59fab566a51c2c24]::query::plumbing::get_query::<rustc_query_impl[ae50953882263c5d]::queries::analysis, rustc_query_impl[ae50953882263c5d]::plumbing::QueryCtxt>
  61:     0x7f2e940c280d - <rustc_interface[be440f50dcda62f9]::passes::QueryContext>::enter::<rustc_driver[7b59b981d4c23d31]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>>
  62:     0x7f2e940c081a - <rustc_interface[be440f50dcda62f9]::interface::Compiler>::enter::<rustc_driver[7b59b981d4c23d31]::run_compiler::{closure#1}::{closure#2}, core[90c82cfbe27f5d33]::result::Result<core[90c82cfbe27f5d33]::option::Option<rustc_interface[be440f50dcda62f9]::queries::Linker>, rustc_errors[b77837aed2b0d3e7]::ErrorReported>>
  63:     0x7f2e940c3876 - rustc_span[26d1c5a8904e1196]::with_source_map::<core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>, rustc_interface[be440f50dcda62f9]::interface::create_compiler_and_run<core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>, rustc_driver[7b59b981d4c23d31]::run_compiler::{closure#1}>::{closure#1}>
  64:     0x7f2e940c01fe - rustc_interface[be440f50dcda62f9]::interface::create_compiler_and_run::<core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>, rustc_driver[7b59b981d4c23d31]::run_compiler::{closure#1}>
  65:     0x7f2e940a6302 - std[daefdbcf0dca51d0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[be440f50dcda62f9]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[be440f50dcda62f9]::interface::run_compiler<core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>, rustc_driver[7b59b981d4c23d31]::run_compiler::{closure#1}>::{closure#0}, core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>>::{closure#0}, core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>>
  66:     0x7f2e940a3a19 - <<std[daefdbcf0dca51d0]::thread::Builder>::spawn_unchecked_<rustc_interface[be440f50dcda62f9]::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface[be440f50dcda62f9]::interface::run_compiler<core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>, rustc_driver[7b59b981d4c23d31]::run_compiler::{closure#1}>::{closure#0}, core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>>::{closure#0}, core[90c82cfbe27f5d33]::result::Result<(), rustc_errors[b77837aed2b0d3e7]::ErrorReported>>::{closure#1} as core[90c82cfbe27f5d33]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  67:     0x7f2e91a81803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hed49a6c6e767ba83
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/alloc/src/boxed.rs:1854:9
  68:     0x7f2e91a81803 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h14238373d01dc9bc
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/alloc/src/boxed.rs:1854:9
  69:     0x7f2e91a81803 - std::sys::unix::thread::Thread::new::thread_start::hc6dbf73cd24f68cc
                               at /rustc/4e8fb743ccbec27344b2dd42de7057f41d4ebfdd/library/std/src/sys/unix/thread.rs:108:17
  70:     0x7f2e919b5609 - start_thread
  71:     0x7f2e918cf293 - clone
  72:                0x0 - <unknown>

Metadata

Metadata

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-criticalCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions