Skip to content

Commit ee80fbc

Browse files
authored
Unrolled build for #154874
Rollup merge of #154874 - cijiugechu:fix-const-closure-inherited-conditions, r=oli-obk Fix ICE for inherited const conditions on const closures Synchronize `evaluate_host_effect_for_fn_goal` with the behavior of `extract_fn_def_from_const_callable` in new solver. Closes #153861 .
2 parents 1bfcb28 + 1ee6e9a commit ee80fbc

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

compiler/rustc_trait_selection/src/traits/effects.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -556,15 +556,8 @@ fn evaluate_host_effect_for_fn_goal<'tcx>(
556556

557557
ty::Closure(def, args) => {
558558
// For now we limit ourselves to closures without binders. The next solver can handle them.
559-
let sig =
560-
args.as_closure().sig().no_bound_vars().ok_or(EvaluationFailure::NoSolution)?;
561-
(
562-
def,
563-
tcx.mk_args_from_iter(
564-
[ty::GenericArg::from(*sig.inputs().get(0).unwrap()), sig.output().into()]
565-
.into_iter(),
566-
),
567-
)
559+
args.as_closure().sig().no_bound_vars().ok_or(EvaluationFailure::NoSolution)?;
560+
(def, args)
568561
}
569562

570563
// Everything else needs explicit impls or cannot have an impl
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ check-pass
2+
//@ revisions: next old
3+
//@[next] compile-flags: -Znext-solver
4+
5+
#![feature(const_closures, const_trait_impl)]
6+
7+
const trait Foo {}
8+
9+
const fn qux<T: [const] Foo>() { (const || {})() }
10+
11+
fn main() {}

0 commit comments

Comments
 (0)