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`.
This commit is contained in:
commit
7347f8e4e0
1 changed files with 6 additions and 6 deletions
|
@ -376,7 +376,7 @@ pub struct GenericPredicates<'tcx> {
|
||||||
|
|
||||||
impl<'tcx> GenericPredicates<'tcx> {
|
impl<'tcx> GenericPredicates<'tcx> {
|
||||||
pub fn instantiate(
|
pub fn instantiate(
|
||||||
&self,
|
self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
args: GenericArgsRef<'tcx>,
|
args: GenericArgsRef<'tcx>,
|
||||||
) -> InstantiatedPredicates<'tcx> {
|
) -> InstantiatedPredicates<'tcx> {
|
||||||
|
@ -386,20 +386,20 @@ impl<'tcx> GenericPredicates<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instantiate_own(
|
pub fn instantiate_own(
|
||||||
&self,
|
self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
args: GenericArgsRef<'tcx>,
|
args: GenericArgsRef<'tcx>,
|
||||||
) -> impl Iterator<Item = (Clause<'tcx>, Span)> + DoubleEndedIterator + ExactSizeIterator {
|
) -> impl Iterator<Item = (Clause<'tcx>, Span)> + DoubleEndedIterator + ExactSizeIterator {
|
||||||
EarlyBinder::bind(self.predicates).iter_instantiated_copied(tcx, args)
|
EarlyBinder::bind(self.predicates).iter_instantiated_copied(tcx, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instantiate_own_identity(&self) -> impl Iterator<Item = (Clause<'tcx>, Span)> {
|
pub fn instantiate_own_identity(self) -> impl Iterator<Item = (Clause<'tcx>, Span)> {
|
||||||
EarlyBinder::bind(self.predicates).iter_identity_copied()
|
EarlyBinder::bind(self.predicates).iter_identity_copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(self, tcx))]
|
#[instrument(level = "debug", skip(self, tcx))]
|
||||||
fn instantiate_into(
|
fn instantiate_into(
|
||||||
&self,
|
self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
instantiated: &mut InstantiatedPredicates<'tcx>,
|
instantiated: &mut InstantiatedPredicates<'tcx>,
|
||||||
args: GenericArgsRef<'tcx>,
|
args: GenericArgsRef<'tcx>,
|
||||||
|
@ -413,14 +413,14 @@ impl<'tcx> GenericPredicates<'tcx> {
|
||||||
instantiated.spans.extend(self.predicates.iter().map(|(_, sp)| *sp));
|
instantiated.spans.extend(self.predicates.iter().map(|(_, sp)| *sp));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn instantiate_identity(&self, tcx: TyCtxt<'tcx>) -> InstantiatedPredicates<'tcx> {
|
pub fn instantiate_identity(self, tcx: TyCtxt<'tcx>) -> InstantiatedPredicates<'tcx> {
|
||||||
let mut instantiated = InstantiatedPredicates::empty();
|
let mut instantiated = InstantiatedPredicates::empty();
|
||||||
self.instantiate_identity_into(tcx, &mut instantiated);
|
self.instantiate_identity_into(tcx, &mut instantiated);
|
||||||
instantiated
|
instantiated
|
||||||
}
|
}
|
||||||
|
|
||||||
fn instantiate_identity_into(
|
fn instantiate_identity_into(
|
||||||
&self,
|
self,
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
instantiated: &mut InstantiatedPredicates<'tcx>,
|
instantiated: &mut InstantiatedPredicates<'tcx>,
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue