Auto merge of #124228 - compiler-errors:lint-overcaptures, r=oli-obk · rust-lang/rust@c45e831 (original) (raw)
`@@ -1407,7 +1407,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
`
1407
1407
` bounds,
`
1408
1408
` fn_kind,
`
1409
1409
` itctx,
`
1410
``
`-
precise_capturing.as_deref().map(|(args, _)| args.as_slice()),
`
``
1410
`+
precise_capturing.as_deref().map(|(args, span)| (args.as_slice(), *span)),
`
1411
1411
`),
`
1412
1412
`ImplTraitContext::Universal => {
`
1413
1413
`if let Some(&(_, span)) = precise_capturing.as_deref() {
`
`@@ -1523,7 +1523,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
`
1523
1523
`bounds: &GenericBounds,
`
1524
1524
`fn_kind: Option,
`
1525
1525
`itctx: ImplTraitContext,
`
1526
``
`-
precise_capturing_args: Option<&[PreciseCapturingArg]>,
`
``
1526
`+
precise_capturing_args: Option<(&[PreciseCapturingArg], Span)>,
`
1527
1527
`) -> hir::TyKind<'hir> {
`
1528
1528
`// Make sure we know that some funky desugaring has been going on here.
`
1529
1529
`// This is a first: there is code in other places like for loop
`
`@@ -1533,7 +1533,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
`
1533
1533
`let opaque_ty_span = self.mark_span_with_reason(DesugaringKind::OpaqueTy, span, None);
`
1534
1534
``
1535
1535
`let captured_lifetimes_to_duplicate =
`
1536
``
`-
if let Some(precise_capturing) = precise_capturing_args {
`
``
1536
`+
if let Some((precise_capturing, _)) = precise_capturing_args {
`
1537
1537
`// We'll actually validate these later on; all we need is the list of
`
1538
1538
`// lifetimes to duplicate during this portion of lowering.
`
1539
1539
` precise_capturing
`
`@@ -1607,7 +1607,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
`
1607
1607
`captured_lifetimes_to_duplicate: FxIndexSet,
`
1608
1608
`span: Span,
`
1609
1609
`opaque_ty_span: Span,
`
1610
``
`-
precise_capturing_args: Option<&[PreciseCapturingArg]>,
`
``
1610
`+
precise_capturing_args: Option<(&[PreciseCapturingArg], Span)>,
`
1611
1611
`lower_item_bounds: impl FnOnce(&mut Self) -> &'hir [hir::GenericBound<'hir>],
`
1612
1612
`) -> hir::TyKind<'hir> {
`
1613
1613
`let opaque_ty_def_id = self.create_def(
`
`@@ -1698,8 +1698,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
`
1698
1698
` this.with_remapping(captured_to_synthesized_mapping, |this| {
`
1699
1699
`(
`
1700
1700
`lower_item_bounds(this),
`
1701
``
`-
precise_capturing_args.map(|precise_capturing| {
`
1702
``
`-
this.lower_precise_capturing_args(precise_capturing)
`
``
1701
`+
precise_capturing_args.map(|(precise_capturing, span)| {
`
``
1702
`+
(
`
``
1703
`+
this.lower_precise_capturing_args(precise_capturing),
`
``
1704
`+
this.lower_span(span),
`
``
1705
`+
)
`
1703
1706
`}),
`
1704
1707
`)
`
1705
1708
`});
`