]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/unresolved_type_param.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / ui / async-await / unresolved_type_param.rs
1 // revisions: no_drop_tracking drop_tracking drop_tracking_mir
2 // [drop_tracking] compile-flags: -Zdrop-tracking
3 // [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
4 // Provoke an unresolved type error (T).
5 // Error message should pinpoint the type parameter T as needing to be bound
6 // (rather than give a general error message)
7 // edition:2018
8
9 async fn bar<T>() -> () {}
10
11 async fn foo() {
12     bar().await;
13     //[drop_tracking_mir]~^ ERROR type annotations needed
14     //[drop_tracking_mir]~| NOTE cannot infer type of the type parameter `T`
15     //[no_drop_tracking,drop_tracking]~^^^ ERROR type inside `async fn` body must be known in this context
16     //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
17     //[no_drop_tracking,drop_tracking]~| ERROR type inside `async fn` body must be known in this context
18     //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
19     //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
20     //[no_drop_tracking,drop_tracking]~| NOTE cannot infer type for type parameter `T`
21     //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
22     //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
23     //[no_drop_tracking,drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
24     //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
25     //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
26     //[no_drop_tracking,drop_tracking]~| NOTE in this expansion of desugaring of `await`
27     //[no_drop_tracking]~^^^^^^^^^^^^^^^ ERROR type inside `async fn` body must be known in this context
28     //[no_drop_tracking]~| ERROR type inside `async fn` body must be known in this context
29     //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
30     //[no_drop_tracking]~| NOTE cannot infer type for type parameter `T`
31     //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
32     //[no_drop_tracking]~| NOTE the type is part of the `async fn` body because of this `await`
33     //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
34     //[no_drop_tracking]~| NOTE in this expansion of desugaring of `await`
35 }
36 fn main() {}