Add test for #55809.

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.
This commit is contained in:
David Wood 2019-03-13 12:38:10 +01:00
parent f8860f217d
commit 9d938f6936
No known key found for this signature in database
GPG Key ID: 01760B4F9F53F154

View File

@ -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();
}