rust/tests/ui/consts/const_in_pattern/cross-crate-pass.rs

24 lines
409 B
Rust
Raw Normal View History

2020-04-07 15:01:41 -05:00
// run-pass
// aux-build:consts.rs
#![warn(indirect_structural_match)]
extern crate consts;
use consts::CustomEq;
2020-04-07 15:01:41 -05:00
struct Defaulted;
impl consts::AssocConst for Defaulted {}
2020-04-07 15:01:41 -05:00
fn main() {
let _ = Defaulted;
2020-04-07 15:01:41 -05:00
match Some(CustomEq) {
consts::NONE => panic!(),
2020-04-07 15:01:41 -05:00
_ => {}
}
match Some(CustomEq) {
<Defaulted as consts::AssocConst>::NONE => panic!(),
_ => {}
}
2020-04-07 15:01:41 -05:00
}