Skip to content

Commit

Permalink
Add test for #55809.
Browse files Browse the repository at this point in the history
This commit 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
davidtwco committed Mar 13, 2019
1 parent f8860f2 commit 9d938f6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/test/run-pass/issue-55809.rs
@@ -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 9d938f6

Please sign in to comment.