1 // Test that we don't allow awaiting from an async fn while a local is partially 2 // initialized. 3 4 // edition:2018 5 6 struct S { x: i32, y: i32 } 7 struct T(i32, i32); 8 noop()9async fn noop() {} 10 test_tuple()11async fn test_tuple() { 12 let mut t: (i32, i32); 13 t.0 = 42; //~ ERROR E0381 14 noop().await; 15 t.1 = 88; 16 let _ = t; 17 } 18 test_tuple_struct()19async fn test_tuple_struct() { 20 let mut t: T; 21 t.0 = 42; //~ ERROR E0381 22 noop().await; 23 t.1 = 88; 24 let _ = t; 25 } 26 test_struct()27async fn test_struct() { 28 let mut t: S; 29 t.x = 42; //~ ERROR E0381 30 noop().await; 31 t.y = 88; 32 let _ = t; 33 } 34 main()35fn main() { 36 let _ = test_tuple(); 37 let _ = test_tuple_struct(); 38 let _ = test_struct(); 39 } 40