}
}
+impl<'a, 'tcx> HashStable<StableHashingContext<'a, 'tcx>> for ty::TyS<'tcx> {
+ fn hash_stable<W: StableHasherResult>(&self,
+ hcx: &mut StableHashingContext<'a, 'tcx>,
+ hasher: &mut StableHasher<W>) {
+ let ty::TyS {
+ ref sty,
+
+ // The other fields just provide fast access to information that is
+ // also contained in `sty`, so no need to hash them.
+ flags: _,
+ region_depth: _,
+ } = *self;
+
+ sty.hash_stable(hcx, hasher);
+ }
+}
+
pub type Ty<'tcx> = &'tcx TyS<'tcx>;
impl<'tcx> serialize::UseSpecializedEncodable for Ty<'tcx> {}
pub packed: bool,
pub simd: bool,
pub int: Option<attr::IntType>,
+ // Internal only for now. If true, don't reorder fields.
+ pub linear: bool,
}
impl_stable_hash_for!(struct ReprOptions {
c,
packed,
simd,
- int
+ int,
+ linear
});
impl ReprOptions {
ret.simd = true;
}
+ // This is here instead of layout because the choice must make it into metadata.
+ ret.linear = !tcx.consider_optimizing(|| format!("Reorder fields of {:?}",
+ tcx.item_path_str(did)));
ret
}