Auto merge of #89247 - fee1-dead:const-eval-select, r=oli-obk
Add `const_eval_select` intrinsic Adds an intrinsic that calls a given function when evaluated at compiler time, but generates a call to another function when called at runtime. See https://github.com/rust-lang/const-eval/issues/7 for previous discussion. r? `@oli-obk.`
This commit is contained in:
commit
c34ac8747c
22 changed files with 372 additions and 39 deletions
|
@ -973,12 +973,16 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
ty::Tuple(_) => stack.extend(ty.tuple_fields().map(|t| (t, depth + 1))),
|
||||
|
||||
ty::Closure(_, substs) => {
|
||||
stack.extend(substs.as_closure().upvar_tys().map(|t| (t, depth + 1)))
|
||||
let substs = substs.as_closure();
|
||||
let ty = self.infcx.shallow_resolve(substs.tupled_upvars_ty());
|
||||
stack.push((ty, depth + 1));
|
||||
}
|
||||
|
||||
ty::Generator(_, substs, _) => {
|
||||
let substs = substs.as_generator();
|
||||
stack.extend(substs.upvar_tys().map(|t| (t, depth + 1)));
|
||||
let ty = self.infcx.shallow_resolve(substs.tupled_upvars_ty());
|
||||
|
||||
stack.push((ty, depth + 1));
|
||||
stack.push((substs.witness(), depth + 1));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue