Rollup merge of #47270 - Zoxc:gen-layout-fix, r=eddyb

Don't look for niches inside generator types. Fixes #47253

r? @eddyb
This commit is contained in:
kennytm 2018-01-09 01:58:54 +08:00
commit 9dd7caef04
No known key found for this signature in database
GPG Key ID: FEF6C8051D0E013C

View File

@ -2295,6 +2295,13 @@ impl<'a, 'tcx> TyLayout<'tcx> {
}, niche_start))
};
// Locals variables which live across yields are stored
// in the generator type as fields. These may be uninitialized
// so we don't look for niches there.
if let ty::TyGenerator(..) = self.ty.sty {
return Ok(None);
}
match self.abi {
Abi::Scalar(ref scalar) => {
return Ok(scalar_component(scalar, Size::from_bytes(0)));