File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1540,6 +1540,8 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
1540
1540
Ok ( variant)
1541
1541
} ) . collect :: < Result < IndexVec < VariantIdx , _ > , _ > > ( ) ?;
1542
1542
1543
+ size = size. align_to ( align. abi ) ;
1544
+
1543
1545
let abi = if prefix. abi . is_uninhabited ( ) ||
1544
1546
variants. iter ( ) . all ( |v| v. abi . is_uninhabited ( ) ) {
1545
1547
Abi :: Uninhabited
Original file line number Diff line number Diff line change
1
+ // This test created a generator whose size was not rounded to a multiple of its
2
+ // alignment. This caused an assertion error in codegen.
3
+
4
+ // build-pass
5
+ // edition:2018
6
+
7
+ #![ feature( async_await) ]
8
+
9
+ async fn noop ( ) { }
10
+
11
+ async fn foo ( ) {
12
+ // This suspend should be the largest variant.
13
+ {
14
+ let x = [ 0u8 ; 17 ] ;
15
+ noop ( ) . await ;
16
+ println ! ( "{:?}" , x) ;
17
+ }
18
+
19
+ // Add one variant that's aligned to 8 bytes.
20
+ {
21
+ let x = 0u64 ;
22
+ noop ( ) . await ;
23
+ println ! ( "{:?}" , x) ;
24
+ }
25
+ }
26
+
27
+ fn main ( ) {
28
+ let _ = foo ( ) ;
29
+ }
You can’t perform that action at this time.
0 commit comments