1
1
//! This query borrow-checks the MIR to (further) ensure it is not broken.
2
2
3
- #![ allow( rustc:: potential_query_instability) ]
4
3
#![ feature( associated_type_bounds) ]
5
4
#![ feature( box_patterns) ]
6
5
#![ feature( let_chains) ]
@@ -18,7 +17,7 @@ extern crate rustc_middle;
18
17
#[ macro_use]
19
18
extern crate tracing;
20
19
21
- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
20
+ use rustc_data_structures:: fx:: { FxIndexMap , FxIndexSet } ;
22
21
use rustc_data_structures:: graph:: dominators:: Dominators ;
23
22
use rustc_data_structures:: vec_map:: VecMap ;
24
23
use rustc_errors:: { Diagnostic , DiagnosticBuilder , DiagnosticMessage , SubdiagnosticMessage } ;
@@ -404,7 +403,7 @@ fn do_mir_borrowck<'tcx>(
404
403
// Note that this set is expected to be small - only upvars from closures
405
404
// would have a chance of erroneously adding non-user-defined mutable vars
406
405
// to the set.
407
- let temporary_used_locals: FxHashSet < Local > = mbcx
406
+ let temporary_used_locals: FxIndexSet < Local > = mbcx
408
407
. used_mut
409
408
. iter ( )
410
409
. filter ( |& local| !mbcx. body . local_decls [ * local] . is_user_variable ( ) )
@@ -491,7 +490,7 @@ pub struct BodyWithBorrowckFacts<'tcx> {
491
490
492
491
pub struct BorrowckInferCtxt < ' cx , ' tcx > {
493
492
pub ( crate ) infcx : & ' cx InferCtxt < ' tcx > ,
494
- pub ( crate ) reg_var_to_origin : RefCell < FxHashMap < ty:: RegionVid , RegionCtxt > > ,
493
+ pub ( crate ) reg_var_to_origin : RefCell < FxIndexMap < ty:: RegionVid , RegionCtxt > > ,
495
494
}
496
495
497
496
impl < ' cx , ' tcx > BorrowckInferCtxt < ' cx , ' tcx > {
@@ -588,25 +587,25 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
588
587
/// borrow errors that is handled by the `reservation_error_reported` field as the inclusion
589
588
/// of the `Span` type (while required to mute some errors) stops the muting of the reservation
590
589
/// errors.
591
- access_place_error_reported : FxHashSet < ( Place < ' tcx > , Span ) > ,
590
+ access_place_error_reported : FxIndexSet < ( Place < ' tcx > , Span ) > ,
592
591
/// This field keeps track of when borrow conflict errors are reported
593
592
/// for reservations, so that we don't report seemingly duplicate
594
593
/// errors for corresponding activations.
595
594
//
596
595
// FIXME: ideally this would be a set of `BorrowIndex`, not `Place`s,
597
596
// but it is currently inconvenient to track down the `BorrowIndex`
598
597
// at the time we detect and report a reservation error.
599
- reservation_error_reported : FxHashSet < Place < ' tcx > > ,
598
+ reservation_error_reported : FxIndexSet < Place < ' tcx > > ,
600
599
/// This fields keeps track of the `Span`s that we have
601
600
/// used to report extra information for `FnSelfUse`, to avoid
602
601
/// unnecessarily verbose errors.
603
- fn_self_span_reported : FxHashSet < Span > ,
602
+ fn_self_span_reported : FxIndexSet < Span > ,
604
603
/// This field keeps track of errors reported in the checking of uninitialized variables,
605
604
/// so that we don't report seemingly duplicate errors.
606
- uninitialized_error_reported : FxHashSet < PlaceRef < ' tcx > > ,
605
+ uninitialized_error_reported : FxIndexSet < PlaceRef < ' tcx > > ,
607
606
/// This field keeps track of all the local variables that are declared mut and are mutated.
608
607
/// Used for the warning issued by an unused mutable local variable.
609
- used_mut : FxHashSet < Local > ,
608
+ used_mut : FxIndexSet < Local > ,
610
609
/// If the function we're checking is a closure, then we'll need to report back the list of
611
610
/// mutable upvars that have been used. This field keeps track of them.
612
611
used_mut_upvars : SmallVec < [ Field ; 8 ] > ,
@@ -628,7 +627,7 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
628
627
629
628
/// Record the region names generated for each region in the given
630
629
/// MIR def so that we can reuse them later in help/error messages.
631
- region_names : RefCell < FxHashMap < RegionVid , RegionName > > ,
630
+ region_names : RefCell < FxIndexMap < RegionVid , RegionName > > ,
632
631
633
632
/// The counter for generating new region names.
634
633
next_region_name : RefCell < usize > ,
@@ -2329,7 +2328,7 @@ mod error {
2329
2328
/// same primary span come out in a consistent order.
2330
2329
buffered_move_errors :
2331
2330
BTreeMap < Vec < MoveOutIndex > , ( PlaceRef < ' tcx > , DiagnosticBuilder < ' tcx , ErrorGuaranteed > ) > ,
2332
- buffered_mut_errors : FxHashMap < Span , ( DiagnosticBuilder < ' tcx , ErrorGuaranteed > , usize ) > ,
2331
+ buffered_mut_errors : FxIndexMap < Span , ( DiagnosticBuilder < ' tcx , ErrorGuaranteed > , usize ) > ,
2333
2332
/// Diagnostics to be reported buffer.
2334
2333
buffered : Vec < Diagnostic > ,
2335
2334
/// Set to Some if we emit an error during borrowck
0 commit comments