Skip to content

Commit 1a7b00d

Browse files
committed
Don't look for niches inside generator types. Fixes #47253
1 parent 795594c commit 1a7b00d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustc/ty/layout.rs

+7
Original file line numberDiff line numberDiff line change
@@ -2295,6 +2295,13 @@ impl<'a, 'tcx> TyLayout<'tcx> {
22952295
}, niche_start))
22962296
};
22972297

2298+
// Locals variables which live across yields are stored
2299+
// in the generator type as fields. These may be uninitialized
2300+
// so we don't look for niches there.
2301+
if let ty::TyGenerator(..) = self.ty.sty {
2302+
return Ok(None);
2303+
}
2304+
22982305
match self.abi {
22992306
Abi::Scalar(ref scalar) => {
23002307
return Ok(scalar_component(scalar, Size::from_bytes(0)));

0 commit comments

Comments
 (0)