about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBastian Kauschke <bastian_kauschke@hotmail.de>2020-05-29 21:04:01 +0200
committerBastian Kauschke <bastian_kauschke@hotmail.de>2020-05-29 21:04:01 +0200
commit8f8cb710cc682cdb29d21cfa39af88c7e8534d76 (patch)
tree6ad7ab3e3e9c9b613016fb165582c1d40c429d80
parent96dd4690c3aa70ec312448c3f2d50e6dc6fb87df (diff)
downloadrust-8f8cb710cc682cdb29d21cfa39af88c7e8534d76.tar.gz
rust-8f8cb710cc682cdb29d21cfa39af88c7e8534d76.zip
remove trivial `mk_predicate`s
-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 c6ecb08615f..7eefd1419a3 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 {