about summary refs log tree commit diff
path: root/tests/ui/pattern/deref-patterns/unsatisfied-bounds.rs
blob: 9e95f4ec4096269f4c04407cfa1085b50bfc27e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#![feature(deref_patterns)]
#![allow(incomplete_features)]

struct MyPointer;

impl std::ops::Deref for MyPointer {
    type Target = ();
    fn deref(&self) -> &() {
        &()
    }
}

fn main() {
    // Test that we get a trait error if a user attempts implicit deref pats on their own impls.
    // FIXME(deref_patterns): there should be a special diagnostic for missing `DerefPure`.
    match MyPointer {
        () => {}
        //~^ ERROR the trait bound `MyPointer: DerefPure` is not satisfied
        _ => {}
    }
}