Files
rust/tests/ui/pattern/unused-parameters-const-pattern.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
329 B
Rust
Raw Normal View History

//@ check-pass
// Tests that const patterns that use generic parameters are
// allowed if we are still able to evaluate them.
trait Trait { const ASSOC: usize; }
impl<T> Trait for T {
const ASSOC: usize = 10;
}
fn foo<T>(a: usize) {
match a {
<T as Trait>::ASSOC => (),
_ => (),
}
}
fn main() {}