Closed
Description
Code
#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]
const fn foo<T: ~const Drop>(_: T) {}
const fn bar() {
foo(|| ());
}
Error output
error: internal compiler error: compiler/rustc_middle/src/ty/sty.rs:394:33: upvar_tys called before capture types are inferred
Backtrace
error: internal compiler error: /rustc/addb4da686a97da46159f0123cb6cdc2ce3d7fdb/compiler/rustc_middle/src/ty/sty.rs:394:33: upvar_tys called before capture types are inferred
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1146:9
stack backtrace:
0: std::panicking::begin_panic
1: std::panic::panic_any
2: rustc_errors::HandlerInner::bug
3: rustc_errors::Handler::bug
4: rustc_middle::ty::context::tls::with_opt
5: rustc_middle::util::bug::opt_span_bug_fmt
6: rustc_middle::util::bug::bug_fmt
7: rustc_middle::ty::sty::ClosureSubsts::upvar_tys
8: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::assemble_candidates
9: rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache
10: rustc_trait_selection::traits::select::SelectionContext::select
11: rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations
12: rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations
13: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_with_constness_where_possible
14: rustc_typeck::check::fallback::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::type_inference_fallback
15: rustc_infer::infer::InferCtxtBuilder::enter
16: rustc_typeck::check::typeck
17: rustc_query_system::query::plumbing::try_execute_query
18: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
19: rustc_typeck::check::typeck
20: rustc_query_system::query::plumbing::try_execute_query
21: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
22: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
23: rustc_typeck::check::typeck_item_bodies
24: rustc_query_system::query::plumbing::try_execute_query
25: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
26: rustc_session::utils::<impl rustc_session::session::Session>::time
27: rustc_typeck::check_crate
28: rustc_interface::passes::analysis
29: rustc_query_system::query::plumbing::try_execute_query
30: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
31: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
32: rustc_span::with_source_map
33: rustc_interface::interface::create_compiler_and_run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
note: the compiler unexpectedly panicked. this is a bug.
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.57.0-nightly (addb4da68 2021-09-25) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `bar`
#1 [typeck] type-checking `bar::{closure#0}`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
@rustbot label: +requires-nightly +A-const-eval +A-const-fn
cc @fee1-dead
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.`#![feature(const_trait_impl)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.