|
6 | 6 | use either::Either; |
7 | 7 | use rustc_data_structures::captures::Captures; |
8 | 8 | use rustc_data_structures::fx::FxIndexSet; |
9 | | -use rustc_errors::{ |
10 | | - codes::*, struct_span_code_err,Applicability,Diagnostic,DiagnosticBuilder,MultiSpan, |
11 | | -}; |
| 9 | +use rustc_errors::{codes::*, struct_span_code_err,Applicability,DiagnosticBuilder,MultiSpan}; |
12 | 10 | use rustc_hir as hir; |
13 | 11 | use rustc_hir::def::{DefKind,Res}; |
14 | 12 | use rustc_hir::intravisit::{walk_block, walk_expr,Visitor}; |
@@ -635,7 +633,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
635 | 633 |
|
636 | 634 | fnsuggest_assign_value( |
637 | 635 | &self, |
638 | | -err:&mutDiagnostic, |
| 636 | +err:&mutDiagnosticBuilder<'_>, |
639 | 637 | moved_place:PlaceRef<'tcx>, |
640 | 638 | sugg_span:Span, |
641 | 639 | ){ |
@@ -674,7 +672,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
674 | 672 |
|
675 | 673 | fnsuggest_borrow_fn_like( |
676 | 674 | &self, |
677 | | -err:&mutDiagnostic, |
| 675 | +err:&mutDiagnosticBuilder<'_>, |
678 | 676 | ty:Ty<'tcx>, |
679 | 677 | move_sites:&[MoveSite], |
680 | 678 | value_name:&str, |
@@ -742,7 +740,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
742 | 740 |
|
743 | 741 | fnsuggest_cloning( |
744 | 742 | &self, |
745 | | -err:&mutDiagnostic, |
| 743 | +err:&mutDiagnosticBuilder<'_>, |
746 | 744 | ty:Ty<'tcx>, |
747 | 745 | expr:&hir::Expr<'_>, |
748 | 746 | span:Span, |
@@ -778,7 +776,12 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
778 | 776 | } |
779 | 777 | } |
780 | 778 |
|
781 | | -fnsuggest_adding_copy_bounds(&self,err:&mutDiagnostic,ty:Ty<'tcx>,span:Span){ |
| 779 | +fnsuggest_adding_copy_bounds( |
| 780 | +&self, |
| 781 | +err:&mutDiagnosticBuilder<'_>, |
| 782 | +ty:Ty<'tcx>, |
| 783 | +span:Span, |
| 784 | +){ |
782 | 785 | let tcx = self.infcx.tcx; |
783 | 786 | let generics = tcx.generics_of(self.mir_def_id()); |
784 | 787 |
|
@@ -1225,7 +1228,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
1225 | 1228 | #[instrument(level = "debug", skip(self, err))] |
1226 | 1229 | fnsuggest_using_local_if_applicable( |
1227 | 1230 | &self, |
1228 | | -err:&mutDiagnostic, |
| 1231 | +err:&mutDiagnosticBuilder<'_>, |
1229 | 1232 | location:Location, |
1230 | 1233 | issued_borrow:&BorrowData<'tcx>, |
1231 | 1234 | explanation:BorrowExplanation<'tcx>, |
@@ -1321,7 +1324,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
1321 | 1324 |
|
1322 | 1325 | fnsuggest_slice_method_if_applicable( |
1323 | 1326 | &self, |
1324 | | -err:&mutDiagnostic, |
| 1327 | +err:&mutDiagnosticBuilder<'_>, |
1325 | 1328 | place:Place<'tcx>, |
1326 | 1329 | borrowed_place:Place<'tcx>, |
1327 | 1330 | ){ |
@@ -1430,7 +1433,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
1430 | 1433 | /// ``` |
1431 | 1434 | pub(crate)fnexplain_iterator_advancement_in_for_loop_if_applicable( |
1432 | 1435 | &self, |
1433 | | -err:&mutDiagnostic, |
| 1436 | +err:&mutDiagnosticBuilder<'_>, |
1434 | 1437 | span:Span, |
1435 | 1438 | issued_spans:&UseSpans<'tcx>, |
1436 | 1439 | ){ |
@@ -1617,7 +1620,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
1617 | 1620 | /// ``` |
1618 | 1621 | fnsuggest_using_closure_argument_instead_of_capture( |
1619 | 1622 | &self, |
1620 | | -err:&mutDiagnostic, |
| 1623 | +err:&mutDiagnosticBuilder<'_>, |
1621 | 1624 | borrowed_place:Place<'tcx>, |
1622 | 1625 | issued_spans:&UseSpans<'tcx>, |
1623 | 1626 | ){ |
@@ -1751,7 +1754,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
1751 | 1754 |
|
1752 | 1755 | fnsuggest_binding_for_closure_capture_self( |
1753 | 1756 | &self, |
1754 | | -err:&mutDiagnostic, |
| 1757 | +err:&mutDiagnosticBuilder<'_>, |
1755 | 1758 | issued_spans:&UseSpans<'tcx>, |
1756 | 1759 | ){ |
1757 | 1760 | letUseSpans::ClosureUse{ capture_kind_span, .. } = issued_spans else{return}; |
@@ -2997,7 +3000,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { |
2997 | 3000 | self.buffer_error(err); |
2998 | 3001 | } |
2999 | 3002 |
|
3000 | | -fnexplain_deref_coercion(&mutself,loan:&BorrowData<'tcx>,err:&mutDiagnostic){ |
| 3003 | +fnexplain_deref_coercion(&mutself,loan:&BorrowData<'tcx>,err:&mutDiagnosticBuilder<'_>){ |
3001 | 3004 | let tcx = self.infcx.tcx; |
3002 | 3005 | iflet( |
3003 | 3006 | Some(Terminator{ |
@@ -3532,7 +3535,11 @@ enum AnnotatedBorrowFnSignature<'tcx> { |
3532 | 3535 | impl<'tcx>AnnotatedBorrowFnSignature<'tcx>{ |
3533 | 3536 | /// Annotate the provided diagnostic with information about borrow from the fn signature that |
3534 | 3537 | /// helps explain. |
3535 | | -pub(crate)fnemit(&self,cx:&mutMirBorrowckCtxt<'_,'tcx>,diag:&mutDiagnostic) -> String{ |
| 3538 | +pub(crate)fnemit( |
| 3539 | +&self, |
| 3540 | +cx:&mutMirBorrowckCtxt<'_,'tcx>, |
| 3541 | +diag:&mutDiagnosticBuilder<'_>, |
| 3542 | +) -> String{ |
3536 | 3543 | matchself{ |
3537 | 3544 | &AnnotatedBorrowFnSignature::Closure{ argument_ty, argument_span } => { |
3538 | 3545 | diag.span_label( |
|
0 commit comments