Rollup merge of #126508 - beepster4096:minor_borrowck_cherrypick, r=compiler-errors
Make uninitialized_error_reported a set of locals Another artifact of how places used to be able to be based on statics and not just locals. This set is exclusively filled with PlaceRefs that are just locals, so it should just contain locals directly.
This commit is contained in:
commit
53364c3e07
@ -100,12 +100,12 @@ pub(crate) fn report_use_of_moved_or_uninitialized(
|
|||||||
move_site_vec.iter().map(|move_site| move_site.moi).collect();
|
move_site_vec.iter().map(|move_site| move_site.moi).collect();
|
||||||
|
|
||||||
if move_out_indices.is_empty() {
|
if move_out_indices.is_empty() {
|
||||||
let root_place = PlaceRef { projection: &[], ..used_place };
|
let root_local = used_place.local;
|
||||||
|
|
||||||
if !self.uninitialized_error_reported.insert(root_place) {
|
if !self.uninitialized_error_reported.insert(root_local) {
|
||||||
debug!(
|
debug!(
|
||||||
"report_use_of_moved_or_uninitialized place: error about {:?} suppressed",
|
"report_use_of_moved_or_uninitialized place: error about {:?} suppressed",
|
||||||
root_place
|
root_local
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -566,7 +566,7 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
fn_self_span_reported: FxIndexSet<Span>,
|
fn_self_span_reported: FxIndexSet<Span>,
|
||||||
/// This field keeps track of errors reported in the checking of uninitialized variables,
|
/// This field keeps track of errors reported in the checking of uninitialized variables,
|
||||||
/// so that we don't report seemingly duplicate errors.
|
/// so that we don't report seemingly duplicate errors.
|
||||||
uninitialized_error_reported: FxIndexSet<PlaceRef<'tcx>>,
|
uninitialized_error_reported: FxIndexSet<Local>,
|
||||||
/// This field keeps track of all the local variables that are declared mut and are mutated.
|
/// This field keeps track of all the local variables that are declared mut and are mutated.
|
||||||
/// Used for the warning issued by an unused mutable local variable.
|
/// Used for the warning issued by an unused mutable local variable.
|
||||||
used_mut: FxIndexSet<Local>,
|
used_mut: FxIndexSet<Local>,
|
||||||
|
Loading…
Reference in New Issue
Block a user