about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-06-03 20:12:40 +0000
committerbors <bors@rust-lang.org>2020-06-03 20:12:40 +0000
commitf3fadf6abd571868d70538561a0731ddd800003a (patch)
tree3a5ce78bfd744d83550cf6147a0ae1e1a2208277
parent56daaf669ebc3d5083db5cded719f780dc31104e (diff)
parent8f8cb710cc682cdb29d21cfa39af88c7e8534d76 (diff)
downloadrust-f3fadf6abd571868d70538561a0731ddd800003a.tar.gz
rust-f3fadf6abd571868d70538561a0731ddd800003a.zip
Auto merge of #72754 - lcnr:predicate-fold, r=nikomatsakis
remove trivial `mk_predicate`s

r? @nikomatsakis
-rw-r--r--src/librustc_middle/ty/structural_impls.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/librustc_middle/ty/structural_impls.rs b/src/librustc_middle/ty/structural_impls.rs
index cee0afacb68..f6f5dfd6516 100644
--- a/src/librustc_middle/ty/structural_impls.rs
+++ b/src/librustc_middle/ty/structural_impls.rs
@@ -987,7 +987,8 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Region<'tcx> {
 
 impl<'tcx> TypeFoldable<'tcx> for ty::Predicate<'tcx> {
     fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
-        folder.tcx().mk_predicate(ty::PredicateKind::super_fold_with(self.kind, folder))
+        let new = ty::PredicateKind::super_fold_with(self.kind, folder);
+        if new != *self.kind { folder.tcx().mk_predicate(new) } else { *self }
     }
 
     fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {