@@ -51,16 +51,16 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
51
51
& mut self ,
52
52
context : Context ,
53
53
desired_action : InitializationRequiringAction ,
54
- ( place , span) : ( & Place < ' tcx > , Span ) ,
54
+ ( moved_place , used_place , span) : ( & Place < ' tcx > , & Place < ' tcx > , Span ) ,
55
55
mpi : MovePathIndex ,
56
56
) {
57
57
debug ! (
58
- "report_use_of_moved_or_uninitialized: context={:?} desired_action={:?} place={:?} \
59
- span={:?} mpi={:?}",
60
- context, desired_action, place , span, mpi
58
+ "report_use_of_moved_or_uninitialized: context={:?} desired_action={:?} \
59
+ moved_place={:?} used_place={:?} span={:?} mpi={:?}",
60
+ context, desired_action, moved_place , used_place , span, mpi
61
61
) ;
62
62
63
- let use_spans = self . move_spans ( place , context. loc )
63
+ let use_spans = self . move_spans ( moved_place , context. loc )
64
64
. or_else ( || self . borrow_spans ( span, context. loc ) ) ;
65
65
let span = use_spans. args_or_use ( ) ;
66
66
@@ -75,7 +75,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
75
75
. collect ( ) ;
76
76
77
77
if move_out_indices. is_empty ( ) {
78
- let root_place = self . prefixes ( & place , PrefixSet :: All ) . last ( ) . unwrap ( ) ;
78
+ let root_place = self . prefixes ( & used_place , PrefixSet :: All ) . last ( ) . unwrap ( ) ;
79
79
80
80
if self . uninitialized_error_reported
81
81
. contains ( & root_place. clone ( ) )
@@ -89,14 +89,15 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
89
89
90
90
self . uninitialized_error_reported . insert ( root_place. clone ( ) ) ;
91
91
92
- let item_msg = match self . describe_place_with_options ( place, IncludingDowncast ( true ) ) {
92
+ let item_msg = match self . describe_place_with_options ( used_place,
93
+ IncludingDowncast ( true ) ) {
93
94
Some ( name) => format ! ( "`{}`" , name) ,
94
95
None => "value" . to_owned ( ) ,
95
96
} ;
96
97
let mut err = self . infcx . tcx . cannot_act_on_uninitialized_variable (
97
98
span,
98
99
desired_action. as_noun ( ) ,
99
- & self . describe_place_with_options ( place , IncludingDowncast ( true ) )
100
+ & self . describe_place_with_options ( moved_place , IncludingDowncast ( true ) )
100
101
. unwrap_or ( "_" . to_owned ( ) ) ,
101
102
Origin :: Mir ,
102
103
) ;
@@ -111,7 +112,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
111
112
} else {
112
113
if let Some ( ( reported_place, _) ) = self . move_error_reported . get ( & move_out_indices) {
113
114
if self . prefixes ( & reported_place, PrefixSet :: All )
114
- . any ( |p| p == place )
115
+ . any ( |p| p == used_place )
115
116
{
116
117
debug ! (
117
118
"report_use_of_moved_or_uninitialized place: error suppressed \
@@ -128,7 +129,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
128
129
span,
129
130
desired_action. as_noun ( ) ,
130
131
msg,
131
- self . describe_place_with_options ( & place , IncludingDowncast ( true ) ) ,
132
+ self . describe_place_with_options ( & moved_place , IncludingDowncast ( true ) ) ,
132
133
Origin :: Mir ,
133
134
) ;
134
135
@@ -181,7 +182,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
181
182
) ;
182
183
}
183
184
184
- if let Some ( ty) = self . retrieve_type_for_place ( place ) {
185
+ if let Some ( ty) = self . retrieve_type_for_place ( used_place ) {
185
186
let needs_note = match ty. sty {
186
187
ty:: Closure ( id, _) => {
187
188
let tables = self . infcx . tcx . typeck_tables_of ( id) ;
@@ -219,7 +220,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
219
220
}
220
221
221
222
if let Some ( ( _, mut old_err) ) = self . move_error_reported
222
- . insert ( move_out_indices, ( place . clone ( ) , err) )
223
+ . insert ( move_out_indices, ( used_place . clone ( ) , err) )
223
224
{
224
225
// Cancel the old error so it doesn't ICE.
225
226
old_err. cancel ( ) ;
0 commit comments