@@ -1345,11 +1345,13 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
13451345 // See `tests/ui/moves/needs-clone-through-deref.rs`
13461346 return false ;
13471347 }
1348- // We don't want to suggest `.clone()` in a move closure, since the value has already been captured.
1348+ // We don't want to suggest `.clone()` in a move closure, since the value has already been
1349+ // captured.
13491350 if self . in_move_closure ( expr) {
13501351 return false ;
13511352 }
1352- // We also don't want to suggest cloning a closure itself, since the value has already been captured.
1353+ // We also don't want to suggest cloning a closure itself, since the value has already been
1354+ // captured.
13531355 if let hir:: ExprKind :: Closure ( _) = expr. kind {
13541356 return false ;
13551357 }
@@ -1381,7 +1383,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
13811383 }
13821384 }
13831385 }
1384- // Cloning the raw pointer doesn't make sense in some cases and would cause a type mismatch error. (see #126863)
1386+ // Cloning the raw pointer doesn't make sense in some cases and would cause a type mismatch
1387+ // error. (see #126863)
13851388 if inner_expr. span . lo ( ) != expr. span . lo ( ) && !is_raw_ptr {
13861389 // Remove "(*" or "(&"
13871390 sugg. push ( ( expr. span . with_hi ( inner_expr. span . lo ( ) ) , String :: new ( ) ) ) ;
@@ -1553,8 +1556,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
15531556 let use_spans = self . move_spans ( place. as_ref ( ) , location) ;
15541557 let span = use_spans. var_or_use ( ) ;
15551558
1556- // If the attempted use is in a closure then we do not care about the path span of the place we are currently trying to use
1557- // we call `var_span_label` on `borrow_spans` to annotate if the existing borrow was in a closure
1559+ // If the attempted use is in a closure then we do not care about the path span of the
1560+ // place we are currently trying to use we call `var_span_label` on `borrow_spans` to
1561+ // annotate if the existing borrow was in a closure.
15581562 let mut err = self . cannot_use_when_mutably_borrowed (
15591563 span,
15601564 & self . describe_any_place ( place. as_ref ( ) ) ,
@@ -2477,7 +2481,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
24772481 if let hir:: ExprKind :: Closure ( closure) = ex. kind
24782482 && ex. span . contains ( self . borrow_span )
24792483 // To support cases like `|| { v.call(|this| v.get()) }`
2480- // FIXME: actually support such cases (need to figure out how to move from the capture place to original local)
2484+ // FIXME: actually support such cases (need to figure out how to move from the
2485+ // capture place to original local).
24812486 && self . res . as_ref ( ) . map_or ( true , |( prev_res, _) | prev_res. span . contains ( ex. span ) )
24822487 {
24832488 self . res = Some ( ( ex, closure) ) ;
@@ -3184,8 +3189,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
31843189 /// misleading users in cases like `tests/ui/nll/borrowed-temporary-error.rs`.
31853190 /// We could expand the analysis to suggest hoising all of the relevant parts of
31863191 /// the users' code to make the code compile, but that could be too much.
3187- /// We found the `prop_expr` by the way to check whether the expression is a `FormatArguments`,
3188- /// which is a special case since it's generated by the compiler.
3192+ /// We found the `prop_expr` by the way to check whether the expression is a
3193+ /// `FormatArguments`, which is a special case since it's generated by the
3194+ /// compiler.
31893195 struct NestedStatementVisitor < ' tcx > {
31903196 span : Span ,
31913197 current : usize ,
@@ -3416,7 +3422,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
34163422 let ( sugg_span, suggestion) = match tcx. sess . source_map ( ) . span_to_snippet ( args_span) {
34173423 Ok ( string) => {
34183424 let coro_prefix = if string. starts_with ( "async" ) {
3419- // `async` is 5 chars long. Not using `.len()` to avoid the cast from `usize` to `u32`
3425+ // `async` is 5 chars long. Not using `.len()` to avoid the cast from `usize`
3426+ // to `u32`.
34203427 Some ( 5 )
34213428 } else if string. starts_with ( "gen" ) {
34223429 // `gen` is 3 chars long
@@ -3614,10 +3621,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
36143621 let stmt_kind =
36153622 self . body [ location. block ] . statements . get ( location. statement_index ) . map ( |s| & s. kind ) ;
36163623 if let Some ( StatementKind :: StorageDead ( ..) ) = stmt_kind {
3617- // this analysis only tries to find moves explicitly
3618- // written by the user, so we ignore the move-outs
3619- // created by `StorageDead` and at the beginning
3620- // of a function.
3624+ // This analysis only tries to find moves explicitly written by the user, so we
3625+ // ignore the move-outs created by `StorageDead` and at the beginning of a
3626+ // function.
36213627 } else {
36223628 // If we are found a use of a.b.c which was in error, then we want to look for
36233629 // moves not only of a.b.c but also a.b and a.
@@ -3702,13 +3708,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
37023708 }
37033709 }
37043710 if ( is_argument || !reached_start) && result. is_empty ( ) {
3705- /* Process back edges (moves in future loop iterations) only if
3706- the move path is definitely initialized upon loop entry,
3707- to avoid spurious "in previous iteration" errors.
3708- During DFS, if there's a path from the error back to the start
3709- of the function with no intervening init or move, then the
3710- move path may be uninitialized at loop entry.
3711- */
3711+ // Process back edges (moves in future loop iterations) only if
3712+ // the move path is definitely initialized upon loop entry,
3713+ // to avoid spurious "in previous iteration" errors.
3714+ // During DFS, if there's a path from the error back to the start
3715+ // of the function with no intervening init or move, then the
3716+ // move path may be uninitialized at loop entry.
37123717 while let Some ( location) = back_edge_stack. pop ( ) {
37133718 if dfs_iter ( & mut result, location, true ) {
37143719 continue ;
0 commit comments