diff options
| author | fee1-dead <ent3rm4n@gmail.com> | 2023-04-16 18:55:38 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-16 18:55:38 +0800 |
| commit | eba419195c7eea19df4366e07ddf074fe54dd00e (patch) | |
| tree | 273ca45232745c7ad8bdf1d960b803335a2842aa /compiler/rustc_middle/src | |
| parent | a5136f14aee8447820a81141631cd6e5919631a5 (diff) | |
| parent | 4460a1dc28a10cd74a6e5636d6e2cd8c8f06ba4b (diff) | |
| download | rust-eba419195c7eea19df4366e07ddf074fe54dd00e.tar.gz rust-eba419195c7eea19df4366e07ddf074fe54dd00e.zip | |
Rollup merge of #110345 - nnethercote:rm-Super-impls-for-Region, r=compiler-errors
Remove `TypeSuper{Foldable,Visitable}` impls for `Region`.
These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial.
This commit inlines and removes those trivial methods.
r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/fold.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/structural_impls.rs | 18 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/visit.rs | 2 |
4 files changed, 4 insertions, 21 deletions
diff --git a/compiler/rustc_middle/src/ty/fold.rs b/compiler/rustc_middle/src/ty/fold.rs index 203e16bea27..25890eb15cd 100644 --- a/compiler/rustc_middle/src/ty/fold.rs +++ b/compiler/rustc_middle/src/ty/fold.rs @@ -37,7 +37,8 @@ where } fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> { - let r = r.super_fold_with(self); + // This one is a little different, because `super_fold_with` is not + // implemented on non-recursive `Region`. (self.lt_op)(r) } diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 72caadaf661..af76cf7cc4e 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2518,7 +2518,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> { self.used_region_names.insert(name); } - r.super_visit_with(self) + ControlFlow::Continue(()) } // We collect types in order to prevent really large types from compiling for diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index 5c604bb6db2..619fcea8b7d 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -583,24 +583,6 @@ impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for ty::Region<'tcx> { } } -impl<'tcx> TypeSuperFoldable<TyCtxt<'tcx>> for ty::Region<'tcx> { - fn try_super_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>( - self, - _folder: &mut F, - ) -> Result<Self, F::Error> { - Ok(self) - } -} - -impl<'tcx> TypeSuperVisitable<TyCtxt<'tcx>> for ty::Region<'tcx> { - fn super_visit_with<V: TypeVisitor<TyCtxt<'tcx>>>( - &self, - _visitor: &mut V, - ) -> ControlFlow<V::BreakTy> { - ControlFlow::Continue(()) - } -} - impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for ty::Predicate<'tcx> { fn try_fold_with<F: FallibleTypeFolder<TyCtxt<'tcx>>>( self, diff --git a/compiler/rustc_middle/src/ty/visit.rs b/compiler/rustc_middle/src/ty/visit.rs index 08a62c900f9..24a1f04c7e3 100644 --- a/compiler/rustc_middle/src/ty/visit.rs +++ b/compiler/rustc_middle/src/ty/visit.rs @@ -364,7 +364,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for ValidateBoundVars<'tcx> { _ => (), }; - r.super_visit_with(self) + ControlFlow::Continue(()) } } |
