@@ -17,17 +17,17 @@ use hir::def::CtorKind;
17
17
use hir:: def_id:: DefId ;
18
18
use hir:: { self , HirId , InlineAsm } ;
19
19
use middle:: region;
20
- use mir:: interpret:: { EvalErrorKind , Scalar , ScalarMaybeUndef , ConstValue } ;
20
+ use mir:: interpret:: { ConstValue , EvalErrorKind , Scalar , ScalarMaybeUndef } ;
21
21
use mir:: visit:: MirVisitable ;
22
22
use rustc_apfloat:: ieee:: { Double , Single } ;
23
23
use rustc_apfloat:: Float ;
24
24
use rustc_data_structures:: graph:: dominators:: { dominators, Dominators } ;
25
25
use rustc_data_structures:: graph:: { self , GraphPredecessors , GraphSuccessors } ;
26
26
use rustc_data_structures:: indexed_vec:: { Idx , IndexVec } ;
27
- use smallvec:: SmallVec ;
28
27
use rustc_data_structures:: sync:: Lrc ;
29
28
use rustc_data_structures:: sync:: ReadGuard ;
30
29
use rustc_serialize as serialize;
30
+ use smallvec:: SmallVec ;
31
31
use std:: borrow:: Cow ;
32
32
use std:: fmt:: { self , Debug , Formatter , Write } ;
33
33
use std:: ops:: { Index , IndexMut } ;
@@ -208,9 +208,10 @@ impl<'tcx> Mir<'tcx> {
208
208
let if_zero_locations = if loc. statement_index == 0 {
209
209
let predecessor_blocks = self . predecessors_for ( loc. block ) ;
210
210
let num_predecessor_blocks = predecessor_blocks. len ( ) ;
211
- Some ( ( 0 .. num_predecessor_blocks)
212
- . map ( move |i| predecessor_blocks[ i] )
213
- . map ( move |bb| self . terminator_loc ( bb) )
211
+ Some (
212
+ ( 0 ..num_predecessor_blocks)
213
+ . map ( move |i| predecessor_blocks[ i] )
214
+ . map ( move |bb| self . terminator_loc ( bb) ) ,
214
215
)
215
216
} else {
216
217
None
@@ -219,10 +220,16 @@ impl<'tcx> Mir<'tcx> {
219
220
let if_not_zero_locations = if loc. statement_index == 0 {
220
221
None
221
222
} else {
222
- Some ( Location { block : loc. block , statement_index : loc. statement_index - 1 } )
223
+ Some ( Location {
224
+ block : loc. block ,
225
+ statement_index : loc. statement_index - 1 ,
226
+ } )
223
227
} ;
224
228
225
- if_zero_locations. into_iter ( ) . flatten ( ) . chain ( if_not_zero_locations)
229
+ if_zero_locations
230
+ . into_iter ( )
231
+ . flatten ( )
232
+ . chain ( if_not_zero_locations)
226
233
}
227
234
228
235
#[ inline]
@@ -577,13 +584,15 @@ impl_stable_hash_for!(struct self::VarBindingForm<'tcx> {
577
584
} ) ;
578
585
579
586
mod binding_form_impl {
580
- use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher , StableHasherResult } ;
581
587
use ich:: StableHashingContext ;
588
+ use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher , StableHasherResult } ;
582
589
583
590
impl < ' a , ' tcx > HashStable < StableHashingContext < ' a > > for super :: BindingForm < ' tcx > {
584
- fn hash_stable < W : StableHasherResult > ( & self ,
585
- hcx : & mut StableHashingContext < ' a > ,
586
- hasher : & mut StableHasher < W > ) {
591
+ fn hash_stable < W : StableHasherResult > (
592
+ & self ,
593
+ hcx : & mut StableHashingContext < ' a > ,
594
+ hasher : & mut StableHasher < W > ,
595
+ ) {
587
596
use super :: BindingForm :: * ;
588
597
:: std:: mem:: discriminant ( self ) . hash_stable ( hcx, hasher) ;
589
598
@@ -1500,16 +1509,17 @@ impl<'tcx> TerminatorKind<'tcx> {
1500
1509
. map ( |& u| {
1501
1510
let mut s = String :: new ( ) ;
1502
1511
let c = ty:: Const {
1503
- val : ConstValue :: Scalar ( Scalar :: Bits {
1512
+ val : ConstValue :: Scalar (
1513
+ Scalar :: Bits {
1504
1514
bits : u,
1505
1515
size : size. bytes ( ) as u8 ,
1506
- } . into ( ) ) ,
1516
+ } . into ( ) ,
1517
+ ) ,
1507
1518
ty : switch_ty,
1508
1519
} ;
1509
1520
fmt_const_val ( & mut s, & c) . unwrap ( ) ;
1510
1521
s. into ( )
1511
- } )
1512
- . chain ( iter:: once ( String :: from ( "otherwise" ) . into ( ) ) )
1522
+ } ) . chain ( iter:: once ( String :: from ( "otherwise" ) . into ( ) ) )
1513
1523
. collect ( )
1514
1524
}
1515
1525
Call {
@@ -2039,7 +2049,13 @@ pub enum AggregateKind<'tcx> {
2039
2049
/// active field number and is present only for union expressions
2040
2050
/// -- e.g. for a union expression `SomeUnion { c: .. }`, the
2041
2051
/// active field index would identity the field `c`
2042
- Adt ( & ' tcx AdtDef , usize , & ' tcx Substs < ' tcx > , Option < CanonicalTy < ' tcx > > , Option < usize > ) ,
2052
+ Adt (
2053
+ & ' tcx AdtDef ,
2054
+ usize ,
2055
+ & ' tcx Substs < ' tcx > ,
2056
+ Option < CanonicalTy < ' tcx > > ,
2057
+ Option < usize > ,
2058
+ ) ,
2043
2059
2044
2060
Closure ( DefId , ClosureSubsts < ' tcx > ) ,
2045
2061
Generator ( DefId , GeneratorSubsts < ' tcx > , hir:: GeneratorMovability ) ,
@@ -2289,7 +2305,7 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result {
2289
2305
return write ! ( f, "{:?}{}" , ( ( bits as i128 ) << shift) >> shift, i) ;
2290
2306
}
2291
2307
Char => return write ! ( f, "{:?}" , :: std:: char :: from_u32( bits as u32 ) . unwrap( ) ) ,
2292
- _ => { } ,
2308
+ _ => { }
2293
2309
}
2294
2310
}
2295
2311
// print function definitons
@@ -2305,14 +2321,12 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result {
2305
2321
let alloc = tcx. alloc_map . lock ( ) . get ( ptr. alloc_id ) ;
2306
2322
if let Some ( interpret:: AllocType :: Memory ( alloc) ) = alloc {
2307
2323
assert_eq ! ( len as usize as u128 , len) ;
2308
- let slice = & alloc
2309
- . bytes
2310
- [ ( ptr. offset . bytes ( ) as usize ) ..]
2311
- [ ..( len as usize ) ] ;
2324
+ let slice =
2325
+ & alloc. bytes [ ( ptr. offset . bytes ( ) as usize ) ..] [ ..( len as usize ) ] ;
2312
2326
let s = :: std:: str:: from_utf8 ( slice) . expect ( "non utf8 str from miri" ) ;
2313
2327
write ! ( f, "{:?}" , s)
2314
2328
} else {
2315
- write ! ( f, "pointer to erroneous constant {:?}, {:?}" , ptr, len)
2329
+ write ! ( f, "pointer to erroneous constant {:?}, {:?}" , ptr, len)
2316
2330
}
2317
2331
} ) ;
2318
2332
}
@@ -2843,15 +2857,13 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
2843
2857
let kind = box match * * kind {
2844
2858
AggregateKind :: Array ( ty) => AggregateKind :: Array ( ty. fold_with ( folder) ) ,
2845
2859
AggregateKind :: Tuple => AggregateKind :: Tuple ,
2846
- AggregateKind :: Adt ( def, v, substs, user_ty, n) => {
2847
- AggregateKind :: Adt (
2848
- def,
2849
- v,
2850
- substs. fold_with ( folder) ,
2851
- user_ty. fold_with ( folder) ,
2852
- n,
2853
- )
2854
- }
2860
+ AggregateKind :: Adt ( def, v, substs, user_ty, n) => AggregateKind :: Adt (
2861
+ def,
2862
+ v,
2863
+ substs. fold_with ( folder) ,
2864
+ user_ty. fold_with ( folder) ,
2865
+ n,
2866
+ ) ,
2855
2867
AggregateKind :: Closure ( id, substs) => {
2856
2868
AggregateKind :: Closure ( id, substs. fold_with ( folder) )
2857
2869
}
@@ -2882,8 +2894,9 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
2882
2894
( match * * kind {
2883
2895
AggregateKind :: Array ( ty) => ty. visit_with ( visitor) ,
2884
2896
AggregateKind :: Tuple => false ,
2885
- AggregateKind :: Adt ( _, _, substs, user_ty, _) =>
2886
- substs. visit_with ( visitor) || user_ty. visit_with ( visitor) ,
2897
+ AggregateKind :: Adt ( _, _, substs, user_ty, _) => {
2898
+ substs. visit_with ( visitor) || user_ty. visit_with ( visitor)
2899
+ }
2887
2900
AggregateKind :: Closure ( _, substs) => substs. visit_with ( visitor) ,
2888
2901
AggregateKind :: Generator ( _, substs, _) => substs. visit_with ( visitor) ,
2889
2902
} ) || fields. visit_with ( visitor)
0 commit comments