Skip to content

Commit 7347f8e

Browse files
committed
Auto merge of #128740 - compiler-errors:generic-preds, r=estebank
Stop unnecessarily taking GenericPredicates by `&self` This results in overcapturing in edition 2024, and is unnecessary since `GenericPredicates: Copy`.
2 parents 19469cb + cc96efd commit 7347f8e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

compiler/rustc_middle/src/ty/generics.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ pub struct GenericPredicates<'tcx> {
376376

377377
impl<'tcx> GenericPredicates<'tcx> {
378378
pub fn instantiate(
379-
&self,
379+
self,
380380
tcx: TyCtxt<'tcx>,
381381
args: GenericArgsRef<'tcx>,
382382
) -> InstantiatedPredicates<'tcx> {
@@ -386,20 +386,20 @@ impl<'tcx> GenericPredicates<'tcx> {
386386
}
387387

388388
pub fn instantiate_own(
389-
&self,
389+
self,
390390
tcx: TyCtxt<'tcx>,
391391
args: GenericArgsRef<'tcx>,
392392
) -> impl Iterator<Item = (Clause<'tcx>, Span)> + DoubleEndedIterator + ExactSizeIterator {
393393
EarlyBinder::bind(self.predicates).iter_instantiated_copied(tcx, args)
394394
}
395395

396-
pub fn instantiate_own_identity(&self) -> impl Iterator<Item = (Clause<'tcx>, Span)> {
396+
pub fn instantiate_own_identity(self) -> impl Iterator<Item = (Clause<'tcx>, Span)> {
397397
EarlyBinder::bind(self.predicates).iter_identity_copied()
398398
}
399399

400400
#[instrument(level = "debug", skip(self, tcx))]
401401
fn instantiate_into(
402-
&self,
402+
self,
403403
tcx: TyCtxt<'tcx>,
404404
instantiated: &mut InstantiatedPredicates<'tcx>,
405405
args: GenericArgsRef<'tcx>,
@@ -413,14 +413,14 @@ impl<'tcx> GenericPredicates<'tcx> {
413413
instantiated.spans.extend(self.predicates.iter().map(|(_, sp)| *sp));
414414
}
415415

416-
pub fn instantiate_identity(&self, tcx: TyCtxt<'tcx>) -> InstantiatedPredicates<'tcx> {
416+
pub fn instantiate_identity(self, tcx: TyCtxt<'tcx>) -> InstantiatedPredicates<'tcx> {
417417
let mut instantiated = InstantiatedPredicates::empty();
418418
self.instantiate_identity_into(tcx, &mut instantiated);
419419
instantiated
420420
}
421421

422422
fn instantiate_identity_into(
423-
&self,
423+
self,
424424
tcx: TyCtxt<'tcx>,
425425
instantiated: &mut InstantiatedPredicates<'tcx>,
426426
) {

0 commit comments

Comments
 (0)