forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Round generator sizes to multiple of their alignment
Fixes rust-lang#62658.
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// This test created a generator whose size was not rounded to a multiple of its | ||
// alignment. This caused an assertion error in codegen. | ||
|
||
// build-pass | ||
// edition:2018 | ||
|
||
#![feature(async_await)] | ||
|
||
async fn noop() {} | ||
|
||
async fn foo() { | ||
// This suspend should be the largest variant. | ||
{ | ||
let x = [0u8; 17]; | ||
noop().await; | ||
println!("{:?}", x); | ||
} | ||
|
||
// Add one variant that's aligned to 8 bytes. | ||
{ | ||
let x = 0u64; | ||
noop().await; | ||
println!("{:?}", x); | ||
} | ||
} | ||
|
||
fn main() { | ||
let _ = foo(); | ||
} |