File tree 2 files changed +17
-2
lines changed
rustc_data_structures/src
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ fn do_mir_borrowck<'a, 'tcx>(
236
236
// Compute non-lexical lifetimes.
237
237
let nll:: NllOutput {
238
238
regioncx,
239
- opaque_type_values,
239
+ mut opaque_type_values,
240
240
polonius_input,
241
241
polonius_output,
242
242
opt_closure_req,
@@ -437,6 +437,12 @@ fn do_mir_borrowck<'a, 'tcx>(
437
437
438
438
let tainted_by_errors = mbcx. emit_errors ( ) ;
439
439
440
+ // Since `BorrowCheckResult` is a query result, let's make sure that its `concrete_opaque_types`
441
+ // field is in deterministic order.
442
+ // Note, that this is not the best solution. It would be better to use a collection type
443
+ // that does not expose its internal order at all once that's available (see #63713).
444
+ opaque_type_values. sort_deterministically ( & infcx. tcx . create_stable_hashing_context ( ) ) ;
445
+
440
446
let result = BorrowCheckResult {
441
447
concrete_opaque_types : opaque_type_values,
442
448
closure_requirements : opt_closure_req,
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use std::iter::FromIterator;
4
4
use std:: slice:: Iter ;
5
5
use std:: vec:: IntoIter ;
6
6
7
- use crate :: stable_hasher:: { HashStable , StableHasher } ;
7
+ use crate :: stable_hasher:: { HashStable , StableHasher , ToStableHashKey } ;
8
8
9
9
/// A map type implemented as a vector of pairs `K` (key) and `V` (value).
10
10
/// It currently provides a subset of all the map operations, the rest could be added as needed.
@@ -190,5 +190,14 @@ where
190
190
}
191
191
}
192
192
193
+ impl < K , V > VecMap < K , V > {
194
+ pub fn sort_deterministically < HCX > ( & mut self , hcx : & HCX )
195
+ where
196
+ K : ToStableHashKey < HCX > ,
197
+ {
198
+ self . 0 . sort_by_cached_key ( |( k, _) | k. to_stable_hash_key ( hcx) ) ;
199
+ }
200
+ }
201
+
193
202
#[ cfg( test) ]
194
203
mod tests;
You can’t perform that action at this time.
0 commit comments