Skip to content

Commit ab85743

Browse files
committed
fix performance problem
1 parent 3d95cd8 commit ab85743

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/librustc/traits/structural_impls.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -771,8 +771,20 @@ impl<'tcx, O: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::Obligation<'tcx
771771
}
772772

773773
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> Result<(), V::Error> {
774-
self.predicate.visit_with(visitor)?;
775-
self.param_env.visit_with(visitor)
774+
let traits::Obligation {
775+
cause: _,
776+
recursion_depth: _,
777+
predicate,
778+
/* HACK: visiting the param-env is a serious performance footgun because
779+
* it can be very large and cause scalability problems. So just don't
780+
* visit it. The code had never visited it, so I suppose it still hadn't
781+
* bit anyone in a serious enough way, but it probably will one day.
782+
*
783+
* Maybe the permafix will be to have `Obligation` not be `TypeFoldable`?
784+
*/
785+
param_env: _,
786+
} = self;
787+
predicate.visit_with(visitor)
776788
}
777789
}
778790

0 commit comments

Comments
 (0)