@@ -224,7 +224,11 @@ pub struct MainDefinition {
224
224
225
225
impl MainDefinition {
226
226
pub fn opt_fn_def_id ( self ) -> Option < DefId > {
227
- if let Res :: Def ( DefKind :: Fn , def_id) = self . res { Some ( def_id) } else { None }
227
+ if let Res :: Def ( DefKind :: Fn , def_id) = self . res {
228
+ Some ( def_id)
229
+ } else {
230
+ None
231
+ }
228
232
}
229
233
}
230
234
@@ -953,11 +957,19 @@ impl<'tcx> Term<'tcx> {
953
957
}
954
958
955
959
pub fn ty ( & self ) -> Option < Ty < ' tcx > > {
956
- if let TermKind :: Ty ( ty) = self . unpack ( ) { Some ( ty) } else { None }
960
+ if let TermKind :: Ty ( ty) = self . unpack ( ) {
961
+ Some ( ty)
962
+ } else {
963
+ None
964
+ }
957
965
}
958
966
959
967
pub fn ct ( & self ) -> Option < Const < ' tcx > > {
960
- if let TermKind :: Const ( c) = self . unpack ( ) { Some ( c) } else { None }
968
+ if let TermKind :: Const ( c) = self . unpack ( ) {
969
+ Some ( c)
970
+ } else {
971
+ None
972
+ }
961
973
}
962
974
963
975
pub fn into_arg ( self ) -> GenericArg < ' tcx > {
@@ -990,8 +1002,8 @@ impl<'tcx> TermKind<'tcx> {
990
1002
}
991
1003
TermKind :: Const ( ct) => {
992
1004
// Ensure we can use the tag bits.
993
- assert_eq ! ( mem:: align_of_val( & * ct. 0.0 ) & TAG_MASK , 0 ) ;
994
- ( CONST_TAG , ct. 0 . 0 as * const ty:: ConstS < ' tcx > as usize )
1005
+ assert_eq ! ( mem:: align_of_val( & * ct. 0 . 0 ) & TAG_MASK , 0 ) ;
1006
+ ( CONST_TAG , ct. 0 . 0 as * const ty:: ConstS < ' tcx > as usize )
995
1007
}
996
1008
} ;
997
1009
@@ -1459,7 +1471,11 @@ impl WithOptConstParam<LocalDefId> {
1459
1471
}
1460
1472
1461
1473
pub fn def_id_for_type_of ( self ) -> DefId {
1462
- if let Some ( did) = self . const_param_did { did } else { self . did . to_def_id ( ) }
1474
+ if let Some ( did) = self . const_param_did {
1475
+ did
1476
+ } else {
1477
+ self . did . to_def_id ( )
1478
+ }
1463
1479
}
1464
1480
}
1465
1481
@@ -2030,7 +2046,11 @@ impl<'tcx> TyCtxt<'tcx> {
2030
2046
// path hash with the user defined seed, this will allowing determinism while
2031
2047
// still allowing users to further randomize layout generation for e.g. fuzzing
2032
2048
if let Some ( user_seed) = self . sess . opts . unstable_opts . layout_seed {
2033
- field_shuffle_seed ^= user_seed;
2049
+ // Order-sensitive hash combination
2050
+ field_shuffle_seed ^= user_seed
2051
+ . wrapping_add ( 0x9e3779b9 )
2052
+ . wrapping_add ( field_shuffle_seed << 6 )
2053
+ . wrapping_add ( field_shuffle_seed >> 2 ) ;
2034
2054
}
2035
2055
2036
2056
for attr in self . get_attrs ( did, sym:: repr) {
0 commit comments