summaryrefslogtreecommitdiffstats
path: root/tests/ui/type-alias-impl-trait/structural-match-no-leak.rs
blob: c2ab6a9d10aa6ae2dcc95eb38ebd72993a791f16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![feature(type_alias_impl_trait)]

type Bar = impl Send;

// While i32 is structural-match, we do not want to leak this information.
// (See https://github.com/rust-lang/rust/issues/72156)
const fn leak_free() -> Bar {
    7i32
}
const LEAK_FREE: Bar = leak_free();

fn leak_free_test() {
    match LEAK_FREE {
        LEAK_FREE => (),
        //~^ `Bar` cannot be used in patterns
        _ => (),
    }
}

fn main() {}