]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/drop-track-field-assign.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / ui / async-await / drop-track-field-assign.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 // Derived from an ICE found in tokio-xmpp during a crater run.
5 // edition:2021
6 // build-pass
7
8 #![allow(dead_code)]
9
10 #[derive(Clone)]
11 struct InfoResult {
12     node: Option<String>
13 }
14
15 struct Agent {
16     info_result: InfoResult
17 }
18
19 impl Agent {
20     async fn handle(&mut self) {
21         let mut info = self.info_result.clone();
22         info.node = Some("bar".into());
23         let element = parse_info(info);
24         let _ = send_element(element).await;
25     }
26 }
27
28 struct Element {
29 }
30
31 async fn send_element(_: Element) {}
32
33 fn parse(_: &[u8]) -> Result<(), ()> {
34     Ok(())
35 }
36
37 fn parse_info(_: InfoResult) -> Element {
38     Element { }
39 }
40
41 fn main() {
42     let mut agent = Agent {
43         info_result: InfoResult { node: None }
44     };
45     let _ = agent.handle();
46 }