rust/tests/ui/pattern/deref-patterns/needs-gate.rs
dianne 4c4b61b730 add a feature gate test
Implicit deref patterns allow previously ill-typed programs. Make sure
they're still ill-typed without the feature gate. I've thrown in a test
for `deref!(_)` too, though it seems it refers to `deref_patterns` as a
library feature.
2025-04-16 15:42:13 -07:00

15 lines
321 B
Rust

// gate-test-deref_patterns
fn main() {
match Box::new(0) {
deref!(0) => {}
//~^ ERROR: use of unstable library feature `deref_patterns`: placeholder syntax for deref patterns
_ => {}
}
match Box::new(0) {
0 => {}
//~^ ERROR: mismatched types
_ => {}
}
}