about summary refs log tree commit diff
path: root/tests/ui/macros/macro-variable-unused-reporting-5718.rs
blob: 55da925461db51b8236f844ad621a108b5fd3e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// https://github.com/rust-lang/rust/issues/5718
//@ run-pass

struct Element;

macro_rules! foo {
    ($tag: expr, $string: expr) => {
        if $tag == $string {
            let element: Box<_> = Box::new(Element);
            unsafe {
                return std::mem::transmute::<_, usize>(element);
            }
        }
    }
}

fn bar() -> usize {
    foo!("a", "b");
    0
}

fn main() {
    bar();
}