1
Fork 0

Rollup merge of #131344 - nnethercote:ref-Lrc, r=compiler-errors

Avoid `&Lrc<T>` in various places

Seeing `&Lrc<T>` is a bit suspicious, and `&T` or `Lrc<T>` is often better.

r? `@oli-obk`
This commit is contained in:
Matthias Krüger 2024-10-07 12:23:54 +02:00 committed by GitHub
commit df61a0b1b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 45 additions and 39 deletions

View file

@ -749,7 +749,7 @@ impl<'tcx> InferCtxt<'tcx> {
definition_span: Span,
hidden_ty: Ty<'tcx>,
region: ty::Region<'tcx>,
in_regions: &Lrc<Vec<ty::Region<'tcx>>>,
in_regions: Lrc<Vec<ty::Region<'tcx>>>,
) {
self.inner.borrow_mut().unwrap_region_constraints().member_constraint(
key,

View file

@ -358,7 +358,15 @@ impl<'tcx> InferCtxt<'tcx> {
// not currently sound until we have existential regions.
concrete_ty.visit_with(&mut ConstrainOpaqueTypeRegionVisitor {
tcx: self.tcx,
op: |r| self.member_constraint(opaque_type_key, span, concrete_ty, r, &choice_regions),
op: |r| {
self.member_constraint(
opaque_type_key,
span,
concrete_ty,
r,
choice_regions.clone(),
)
},
});
}
}

View file

@ -522,7 +522,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
definition_span: Span,
hidden_ty: Ty<'tcx>,
member_region: ty::Region<'tcx>,
choice_regions: &Lrc<Vec<ty::Region<'tcx>>>,
choice_regions: Lrc<Vec<ty::Region<'tcx>>>,
) {
debug!("member_constraint({:?} in {:#?})", member_region, choice_regions);
@ -535,7 +535,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
definition_span,
hidden_ty,
member_region,
choice_regions: choice_regions.clone(),
choice_regions,
});
}