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