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

This commit is contained in:
John Kåre Alsaker 2018-01-08 13:18:50 +01:00
parent 795594cd8c
commit 1a7b00d5fd

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)));