Skip to content

Commit 40ce36c

Browse files
committed
fixup a couple more all_clauses iterations, though unlikely to win much perf
1 parent 5b5b468 commit 40ce36c

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,12 @@ impl<'diag, 'tcx> MirBorrowckCtxt<'_, 'diag, 'tcx> {
285285
let place = &self.move_data.move_paths[mpi].place;
286286
let ty = place.ty(self.body, self.infcx.tcx).ty;
287287

288-
if self.infcx.param_env.caller_bounds().all_clauses(self.infcx.tcx).iter().any(|c| {
289-
c.as_trait_clause().is_some_and(|pred| {
290-
pred.skip_binder().self_ty() == ty && self.infcx.tcx.is_fn_trait(pred.def_id())
291-
})
292-
}) {
288+
if self.infcx.param_env.caller_bounds().trait_clauses(self.infcx.tcx).iter().any(
289+
|clause| {
290+
clause.skip_binder().self_ty() == ty
291+
&& self.infcx.tcx.is_fn_trait(clause.def_id())
292+
},
293+
) {
293294
// Suppress the next suggestion since we don't want to put more bounds onto
294295
// something that already has `Fn`-like bounds (or is a closure), so we can't
295296
// restrict anyways.

‎compiler/rustc_trait_selection/src/traits/auto_trait.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ impl<'tcx> AutoTraitFinder<'tcx> {
254254

255255
let full_user_env = ty::ParamEnv::new(
256256
tcx,
257+
// FIXME(jdonszelmann): if this ends up being a perf problem for rustdoc (calling
258+
// all_clauses here) we could instead add a method to the caller_bounds iterator
259+
// that does "extending", which adds bounds to a paramenv, without decompressing
260+
// existing bounds.
257261
orig_env.caller_bounds().all_clauses(tcx).iter().chain(field_clauses),
258262
);
259263

0 commit comments

Comments
 (0)