Skip to content

Commit 52dc1d9

Browse files
Rollup merge of rust-lang#59156 - davidtwco:issue-55809, r=nikomatsakis
[wg-async-await] Add regression test for rust-lang#55809. Fixes rust-lang#55809. This PR adds a regression test for rust-lang#55809 which checks that a overflow does not occur when evaluating a requirement for async functions and `&mut` arguments in some specific circumstances.
2 parents 511c3de + 9d938f6 commit 52dc1d9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/test/run-pass/issue-55809.rs

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// edition:2018
2+
// run-pass
3+
4+
#![feature(async_await, await_macro, futures_api)]
5+
6+
trait Foo { }
7+
8+
impl Foo for () { }
9+
10+
impl<'a, T> Foo for &'a mut T where T: Foo { }
11+
12+
async fn foo_async<T>(_v: T) -> u8 where T: Foo {
13+
0
14+
}
15+
16+
async fn bad<T>(v: T) -> u8 where T: Foo {
17+
await!(foo_async(v))
18+
}
19+
20+
async fn async_main() {
21+
let mut v = ();
22+
23+
let _ = await!(bad(&mut v));
24+
let _ = await!(foo_async(&mut v));
25+
let _ = await!(bad(v));
26+
}
27+
28+
fn main() {
29+
let _ = async_main();
30+
}

0 commit comments

Comments
 (0)