summaryrefslogtreecommitdiffstats
path: root/tests/ui/typeck/return-dyn-type-mismatch.rs
blob: 93718f70f41938a651fc7423e99130c5a70b7124 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
pub trait TestTrait {
    type MyType;

    fn func() -> Option<Self>
    where
        Self: Sized;
}

impl<T> dyn TestTrait<MyType = T>
where
    Self: Sized, // pesky sized predicate
{
    fn other_func() -> dyn TestTrait<MyType = T> {
        match Self::func() {
            None => None,
            //~^ ERROR mismatched types
        }
    }
}

fn main() {}