Skip to content

Commit

Permalink
Rollup merge of #59156 - davidtwco:issue-55809, r=nikomatsakis
Browse files Browse the repository at this point in the history
[wg-async-await] Add regression test for #55809.

Fixes #55809.

This PR adds a regression test for #55809 which checks that a
overflow does not occur when evaluating a requirement for async
functions and `&mut` arguments in some specific circumstances.
  • Loading branch information
Centril authored Mar 13, 2019
2 parents 353740d + 9d938f6 commit 3569af1
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/test/run-pass/issue-55809.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// edition:2018
// run-pass

#![feature(async_await, await_macro, futures_api)]

trait Foo { }

impl Foo for () { }

impl<'a, T> Foo for &'a mut T where T: Foo { }

async fn foo_async<T>(_v: T) -> u8 where T: Foo {
0
}

async fn bad<T>(v: T) -> u8 where T: Foo {
await!(foo_async(v))
}

async fn async_main() {
let mut v = ();

let _ = await!(bad(&mut v));
let _ = await!(foo_async(&mut v));
let _ = await!(bad(v));
}

fn main() {
let _ = async_main();
}

0 comments on commit 3569af1

Please sign in to comment.