Auto merge of #97447 - nnethercote:improve-folding, r=jackh726

Folding revamp

r? `@ghost`
This commit is contained in:
bors 2022-06-08 05:36:40 +00:00
commit 64a7aa7016
47 changed files with 321 additions and 366 deletions

View file

@ -1,5 +1,5 @@
use rustc_middle::mir::interpret::InterpResult;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeVisitor};
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable, TypeVisitor};
use std::convert::TryInto;
use std::ops::ControlFlow;
@ -47,7 +47,7 @@ where
match (is_used, subst.needs_subst()) {
// Just in case there are closures or generators within this subst,
// recurse.
(true, true) => return subst.super_visit_with(self),
(true, true) => return subst.visit_with(self),
// Confirm that polymorphization replaced the parameter with
// `ty::Param`/`ty::ConstKind::Param`.
(false, true) if cfg!(debug_assertions) => match subst.unpack() {