@@ -17,17 +17,17 @@ use hir::def::CtorKind;
1717use hir:: def_id:: DefId ;
1818use hir:: { self , HirId , InlineAsm } ;
1919use middle:: region;
20- use mir:: interpret:: { EvalErrorKind , Scalar , ScalarMaybeUndef , ConstValue } ;
20+ use mir:: interpret:: { ConstValue , EvalErrorKind , Scalar , ScalarMaybeUndef } ;
2121use mir:: visit:: MirVisitable ;
2222use rustc_apfloat:: ieee:: { Double , Single } ;
2323use rustc_apfloat:: Float ;
2424use rustc_data_structures:: graph:: dominators:: { dominators, Dominators } ;
2525use rustc_data_structures:: graph:: { self , GraphPredecessors , GraphSuccessors } ;
2626use rustc_data_structures:: indexed_vec:: { Idx , IndexVec } ;
27- use smallvec:: SmallVec ;
2827use rustc_data_structures:: sync:: Lrc ;
2928use rustc_data_structures:: sync:: ReadGuard ;
3029use rustc_serialize as serialize;
30+ use smallvec:: SmallVec ;
3131use std:: borrow:: Cow ;
3232use std:: fmt:: { self , Debug , Formatter , Write } ;
3333use std:: ops:: { Index , IndexMut } ;
@@ -208,9 +208,10 @@ impl<'tcx> Mir<'tcx> {
208208 let if_zero_locations = if loc. statement_index == 0 {
209209 let predecessor_blocks = self . predecessors_for ( loc. block ) ;
210210 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) ) ,
214215 )
215216 } else {
216217 None
@@ -219,10 +220,16 @@ impl<'tcx> Mir<'tcx> {
219220 let if_not_zero_locations = if loc. statement_index == 0 {
220221 None
221222 } 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+ } )
223227 } ;
224228
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)
226233 }
227234
228235 #[ inline]
@@ -577,13 +584,15 @@ impl_stable_hash_for!(struct self::VarBindingForm<'tcx> {
577584} ) ;
578585
579586mod binding_form_impl {
580- use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher , StableHasherResult } ;
581587 use ich:: StableHashingContext ;
588+ use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher , StableHasherResult } ;
582589
583590 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+ ) {
587596 use super :: BindingForm :: * ;
588597 :: std:: mem:: discriminant ( self ) . hash_stable ( hcx, hasher) ;
589598
@@ -1500,16 +1509,17 @@ impl<'tcx> TerminatorKind<'tcx> {
15001509 . map ( |& u| {
15011510 let mut s = String :: new ( ) ;
15021511 let c = ty:: Const {
1503- val : ConstValue :: Scalar ( Scalar :: Bits {
1512+ val : ConstValue :: Scalar (
1513+ Scalar :: Bits {
15041514 bits : u,
15051515 size : size. bytes ( ) as u8 ,
1506- } . into ( ) ) ,
1516+ } . into ( ) ,
1517+ ) ,
15071518 ty : switch_ty,
15081519 } ;
15091520 fmt_const_val ( & mut s, & c) . unwrap ( ) ;
15101521 s. into ( )
1511- } )
1512- . chain ( iter:: once ( String :: from ( "otherwise" ) . into ( ) ) )
1522+ } ) . chain ( iter:: once ( String :: from ( "otherwise" ) . into ( ) ) )
15131523 . collect ( )
15141524 }
15151525 Call {
@@ -2039,7 +2049,13 @@ pub enum AggregateKind<'tcx> {
20392049 /// active field number and is present only for union expressions
20402050 /// -- e.g. for a union expression `SomeUnion { c: .. }`, the
20412051 /// 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+ ) ,
20432059
20442060 Closure ( DefId , ClosureSubsts < ' tcx > ) ,
20452061 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 {
22892305 return write ! ( f, "{:?}{}" , ( ( bits as i128 ) << shift) >> shift, i) ;
22902306 }
22912307 Char => return write ! ( f, "{:?}" , :: std:: char :: from_u32( bits as u32 ) . unwrap( ) ) ,
2292- _ => { } ,
2308+ _ => { }
22932309 }
22942310 }
22952311 // print function definitons
@@ -2305,14 +2321,12 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result {
23052321 let alloc = tcx. alloc_map . lock ( ) . get ( ptr. alloc_id ) ;
23062322 if let Some ( interpret:: AllocType :: Memory ( alloc) ) = alloc {
23072323 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 ) ] ;
23122326 let s = :: std:: str:: from_utf8 ( slice) . expect ( "non utf8 str from miri" ) ;
23132327 write ! ( f, "{:?}" , s)
23142328 } else {
2315- write ! ( f, "pointer to erroneous constant {:?}, {:?}" , ptr, len)
2329+ write ! ( f, "pointer to erroneous constant {:?}, {:?}" , ptr, len)
23162330 }
23172331 } ) ;
23182332 }
@@ -2843,15 +2857,13 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
28432857 let kind = box match * * kind {
28442858 AggregateKind :: Array ( ty) => AggregateKind :: Array ( ty. fold_with ( folder) ) ,
28452859 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+ ) ,
28552867 AggregateKind :: Closure ( id, substs) => {
28562868 AggregateKind :: Closure ( id, substs. fold_with ( folder) )
28572869 }
@@ -2882,8 +2894,9 @@ impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
28822894 ( match * * kind {
28832895 AggregateKind :: Array ( ty) => ty. visit_with ( visitor) ,
28842896 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+ }
28872900 AggregateKind :: Closure ( _, substs) => substs. visit_with ( visitor) ,
28882901 AggregateKind :: Generator ( _, substs, _) => substs. visit_with ( visitor) ,
28892902 } ) || fields. visit_with ( visitor)
0 commit comments