@@ -98,8 +98,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
9898 return ;
9999 }
100100
101- let err =
102- self . report_use_of_uninitialized ( mpi, used_place, desired_action, span, use_spans) ;
101+ let err = self . report_use_of_uninitialized (
102+ mpi,
103+ used_place,
104+ moved_place,
105+ desired_action,
106+ span,
107+ use_spans,
108+ ) ;
103109 self . buffer_error ( err) ;
104110 } else {
105111 if let Some ( ( reported_place, _) ) = self . has_move_error ( & move_out_indices) {
@@ -316,6 +322,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
316322 & self ,
317323 mpi : MovePathIndex ,
318324 used_place : PlaceRef < ' tcx > ,
325+ moved_place : PlaceRef < ' tcx > ,
319326 desired_action : InitializationRequiringAction ,
320327 span : Span ,
321328 use_spans : UseSpans < ' tcx > ,
@@ -334,11 +341,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
334341 }
335342 }
336343
337- let ( binding , name, desc) =
338- match self . describe_place_with_options ( used_place , IncludingDowncast ( true ) ) {
339- Some ( name) => ( format ! ( "`{name}`" ) , format ! ( "`{name}`" ) , format ! ( "`{name}` ") ) ,
340- None => ( "value" . to_string ( ) , " the variable". to_string ( ) , String :: new ( ) ) ,
344+ let ( name, desc) =
345+ match self . describe_place_with_options ( moved_place , IncludingDowncast ( true ) ) {
346+ Some ( name) => ( format ! ( "`{name}`" ) , format ! ( "`{name}` " ) ) ,
347+ None => ( "the variable" . to_string ( ) , String :: new ( ) ) ,
341348 } ;
349+ let path = match self . describe_place_with_options ( used_place, IncludingDowncast ( true ) ) {
350+ Some ( name) => format ! ( "`{name}`" ) ,
351+ None => "value" . to_string ( ) ,
352+ } ;
342353
343354 // We use the statements were the binding was initialized, and inspect the HIR to look
344355 // for the branching codepaths that aren't covered, to point at them.
@@ -390,13 +401,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
390401 format ! ( "{} occurs due to use{}" , desired_action. as_noun( ) , use_spans. describe( ) ) ,
391402 ) ;
392403
393- if let InitializationRequiringAction :: PartialAssignment = desired_action {
404+ if let InitializationRequiringAction :: PartialAssignment
405+ | InitializationRequiringAction :: Assignment = desired_action
406+ {
394407 err. help (
395408 "partial initialization isn't supported, fully initialize the binding with a \
396409 default value and mutate it, or use `std::mem::MaybeUninit`",
397410 ) ;
398411 }
399- err. span_label ( span, format ! ( "{binding } {used} here but it {isnt_initialized}" ) ) ;
412+ err. span_label ( span, format ! ( "{path } {used} here but it {isnt_initialized}" ) ) ;
400413
401414 let mut shown = false ;
402415 for ( sp, label) in visitor. errors {
0 commit comments