mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 12:36:35 +03:00
Normalize opaques with escaping bound vars
This commit is contained in:
@@ -500,10 +500,7 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
// to make sure we don't forget to fold the substs regardless.
|
||||
|
||||
match kind {
|
||||
// This is really important. While we *can* handle this, this has
|
||||
// severe performance implications for large opaque types with
|
||||
// late-bound regions. See `issue-88862` benchmark.
|
||||
ty::Opaque if !data.substs.has_escaping_bound_vars() => {
|
||||
ty::Opaque => {
|
||||
// Only normalize `impl Trait` outside of type inference, usually in codegen.
|
||||
match self.param_env.reveal() {
|
||||
Reveal::UserFacing => ty.super_fold_with(self),
|
||||
@@ -529,7 +526,6 @@ fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
ty::Opaque => ty.super_fold_with(self),
|
||||
|
||||
ty::Projection if !data.has_escaping_bound_vars() => {
|
||||
// This branch is *mostly* just an optimization: when we don't
|
||||
|
||||
@@ -211,10 +211,7 @@ fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> {
|
||||
|
||||
// Wrap this in a closure so we don't accidentally return from the outer function
|
||||
let res = match kind {
|
||||
// This is really important. While we *can* handle this, this has
|
||||
// severe performance implications for large opaque types with
|
||||
// late-bound regions. See `issue-88862` benchmark.
|
||||
ty::Opaque if !data.substs.has_escaping_bound_vars() => {
|
||||
ty::Opaque => {
|
||||
// Only normalize `impl Trait` outside of type inference, usually in codegen.
|
||||
match self.param_env.reveal() {
|
||||
Reveal::UserFacing => ty.try_super_fold_with(self)?,
|
||||
@@ -255,8 +252,6 @@ fn try_fold_ty(&mut self, ty: Ty<'tcx>) -> Result<Ty<'tcx>, Self::Error> {
|
||||
}
|
||||
}
|
||||
|
||||
ty::Opaque => ty.try_super_fold_with(self)?,
|
||||
|
||||
ty::Projection | ty::Inherent | ty::Weak => {
|
||||
// See note in `rustc_trait_selection::traits::project`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user