]> git.proxmox.com Git - rustc.git/blame - src/test/mir-opt/issue-41110.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / mir-opt / issue-41110.rs
CommitLineData
ff7c6d11
XL
1// ignore-wasm32-bare compiled with panic=abort by default
2
cc61c64b
XL
3// check that we don't emit multiple drop flags when they are not needed.
4
ba9703b0 5
3dfed10e 6// EMIT_MIR issue_41110.main.ElaborateDrops.after.mir
cc61c64b
XL
7fn main() {
8 let x = S.other(S.id());
9}
10
abe05a73
XL
11// no_mangle to make sure this gets instantiated even in an executable.
12#[no_mangle]
3dfed10e 13// EMIT_MIR issue_41110.test.ElaborateDrops.after.mir
cc61c64b
XL
14pub fn test() {
15 let u = S;
16 let mut v = S;
17 drop(v);
18 v = u;
19}
20
21struct S;
22impl Drop for S {
23 fn drop(&mut self) {
24 }
25}
26
27impl S {
28 fn id(self) -> Self { self }
29 fn other(self, s: Self) {}
30}