]> git.proxmox.com Git - rustc.git/blob - src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / migrations / closure-body-macro-fragment.rs
1 // run-rustfix
2 // edition:2018
3 // check-pass
4 #![warn(rust_2021_compatibility)]
5
6 #[derive(Debug)]
7 struct Foo(i32);
8 impl Drop for Foo {
9 fn drop(&mut self) {
10 println!("{:?} dropped", self.0);
11 }
12 }
13
14 macro_rules! m {
15 (@ $body:expr) => {{
16 let f = || $body;
17 //~^ WARNING: drop order
18 f();
19 }};
20 ($body:block) => {{
21 m!(@ $body);
22 }};
23 }
24
25 fn main() {
26 let a = (Foo(0), Foo(1));
27 m!({
28 //~^ HELP: add a dummy
29 let x = a.0;
30 println!("{:?}", x);
31 });
32 }