mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
20 lines
258 B
Rust
20 lines
258 B
Rust
//@ run-pass
|
|
|
|
trait Foo {
|
|
const NUM: usize;
|
|
}
|
|
|
|
impl Foo for i32 {
|
|
const NUM: usize = 1;
|
|
}
|
|
|
|
const FOO: usize = <i32 as Foo>::NUM;
|
|
|
|
fn main() {
|
|
assert_eq!(1, FOO);
|
|
|
|
match 1 {
|
|
<i32 as Foo>::NUM => {},
|
|
_ => assert!(false)
|
|
}
|
|
}
|