]> git.proxmox.com Git - rustc.git/blame - src/test/ui/closures/2229_closure_analysis/migrations/closure-body-macro-fragment.fixed
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / migrations / closure-body-macro-fragment.fixed
CommitLineData
94222f64
XL
1// run-rustfix
2// edition:2018
3// check-pass
4#![warn(rust_2021_compatibility)]
5
6#[derive(Debug)]
7struct Foo(i32);
8impl Drop for Foo {
9 fn drop(&mut self) {
10 println!("{:?} dropped", self.0);
11 }
12}
13
14macro_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
25fn main() {
26 let a = (Foo(0), Foo(1));
27 m!({
28 let _ = &a;
29 //~^ HELP: add a dummy
30 let x = a.0;
31 println!("{:?}", x);
32 });
33}