11//! This query borrow-checks the MIR to (further) ensure it is not broken.
22
3- #![ allow( rustc:: potential_query_instability) ]
43#![ feature( associated_type_bounds) ]
54#![ feature( box_patterns) ]
65#![ feature( let_chains) ]
@@ -18,7 +17,7 @@ extern crate rustc_middle;
1817#[ macro_use]
1918extern crate tracing;
2019
21- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
20+ use rustc_data_structures:: fx:: { FxIndexMap , FxIndexSet } ;
2221use rustc_data_structures:: graph:: dominators:: Dominators ;
2322use rustc_data_structures:: vec_map:: VecMap ;
2423use rustc_errors:: { Diagnostic , DiagnosticBuilder , DiagnosticMessage , SubdiagnosticMessage } ;
@@ -404,7 +403,7 @@ fn do_mir_borrowck<'tcx>(
404403 // Note that this set is expected to be small - only upvars from closures
405404 // would have a chance of erroneously adding non-user-defined mutable vars
406405 // to the set.
407- let temporary_used_locals: FxHashSet < Local > = mbcx
406+ let temporary_used_locals: FxIndexSet < Local > = mbcx
408407 . used_mut
409408 . iter ( )
410409 . filter ( |& local| !mbcx. body . local_decls [ * local] . is_user_variable ( ) )
@@ -491,7 +490,7 @@ pub struct BodyWithBorrowckFacts<'tcx> {
491490
492491pub struct BorrowckInferCtxt < ' cx , ' tcx > {
493492 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 > > ,
495494}
496495
497496impl < ' cx , ' tcx > BorrowckInferCtxt < ' cx , ' tcx > {
@@ -588,25 +587,25 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
588587 /// borrow errors that is handled by the `reservation_error_reported` field as the inclusion
589588 /// of the `Span` type (while required to mute some errors) stops the muting of the reservation
590589 /// errors.
591- access_place_error_reported : FxHashSet < ( Place < ' tcx > , Span ) > ,
590+ access_place_error_reported : FxIndexSet < ( Place < ' tcx > , Span ) > ,
592591 /// This field keeps track of when borrow conflict errors are reported
593592 /// for reservations, so that we don't report seemingly duplicate
594593 /// errors for corresponding activations.
595594 //
596595 // FIXME: ideally this would be a set of `BorrowIndex`, not `Place`s,
597596 // but it is currently inconvenient to track down the `BorrowIndex`
598597 // at the time we detect and report a reservation error.
599- reservation_error_reported : FxHashSet < Place < ' tcx > > ,
598+ reservation_error_reported : FxIndexSet < Place < ' tcx > > ,
600599 /// This fields keeps track of the `Span`s that we have
601600 /// used to report extra information for `FnSelfUse`, to avoid
602601 /// unnecessarily verbose errors.
603- fn_self_span_reported : FxHashSet < Span > ,
602+ fn_self_span_reported : FxIndexSet < Span > ,
604603 /// This field keeps track of errors reported in the checking of uninitialized variables,
605604 /// so that we don't report seemingly duplicate errors.
606- uninitialized_error_reported : FxHashSet < PlaceRef < ' tcx > > ,
605+ uninitialized_error_reported : FxIndexSet < PlaceRef < ' tcx > > ,
607606 /// This field keeps track of all the local variables that are declared mut and are mutated.
608607 /// Used for the warning issued by an unused mutable local variable.
609- used_mut : FxHashSet < Local > ,
608+ used_mut : FxIndexSet < Local > ,
610609 /// If the function we're checking is a closure, then we'll need to report back the list of
611610 /// mutable upvars that have been used. This field keeps track of them.
612611 used_mut_upvars : SmallVec < [ Field ; 8 ] > ,
@@ -628,7 +627,7 @@ struct MirBorrowckCtxt<'cx, 'tcx> {
628627
629628 /// Record the region names generated for each region in the given
630629 /// 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 > > ,
632631
633632 /// The counter for generating new region names.
634633 next_region_name : RefCell < usize > ,
@@ -2334,7 +2333,7 @@ mod error {
23342333 /// same primary span come out in a consistent order.
23352334 buffered_move_errors :
23362335 BTreeMap < Vec < MoveOutIndex > , ( PlaceRef < ' tcx > , DiagnosticBuilder < ' tcx , ErrorGuaranteed > ) > ,
2337- buffered_mut_errors : FxHashMap < Span , ( DiagnosticBuilder < ' tcx , ErrorGuaranteed > , usize ) > ,
2336+ buffered_mut_errors : FxIndexMap < Span , ( DiagnosticBuilder < ' tcx , ErrorGuaranteed > , usize ) > ,
23382337 /// Diagnostics to be reported buffer.
23392338 buffered : Vec < Diagnostic > ,
23402339 /// Set to Some if we emit an error during borrowck
0 commit comments