diff options
| author | bors <bors@rust-lang.org> | 2021-10-14 10:06:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-10-14 10:06:30 +0000 |
| commit | c34ac8747ca96d09cb08b8f5adddead826e77c06 (patch) | |
| tree | 23a25e70efd4d935b3aea4b3082baed6add97917 /compiler/rustc_trait_selection | |
| parent | 7807a694c2f079fd3f395821bcc357eee8650071 (diff) | |
| parent | 11fac09eadc3a60982e46e2fed177d6b0a686041 (diff) | |
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.`
Diffstat (limited to 'compiler/rustc_trait_selection')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 0f6e2e0be52..856ea43b1ff 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -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)); } |
