]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/issue_41110.rs
Rollup merge of #107779 - compiler-errors:issue-107775, r=jackh726
[rust.git] / tests / mir-opt / issue_41110.rs
1 // ignore-wasm32-bare compiled with panic=abort by default
2
3 // check that we don't emit multiple drop flags when they are not needed.
4
5
6 // EMIT_MIR issue_41110.main.ElaborateDrops.after.mir
7 fn main() {
8     let x = S.other(S.id());
9 }
10
11 // no_mangle to make sure this gets instantiated even in an executable.
12 #[no_mangle]
13 // EMIT_MIR issue_41110.test.ElaborateDrops.after.mir
14 pub fn test() {
15     let u = S;
16     let mut v = S;
17     drop(v);
18     v = u;
19 }
20
21 struct S;
22 impl Drop for S {
23     fn drop(&mut self) {
24     }
25 }
26
27 impl S {
28     fn id(self) -> Self { self }
29     fn other(self, s: Self) {}
30 }