summaryrefslogtreecommitdiffstats
path: root/src/test/ui/generic-associated-types/issue-68656-unsized-values.rs
blob: c0d933362567e71182c2d6efabd7f08f6f5d7b00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Regression test for #68656

#![feature(generic_associated_types)]

trait UnsafeCopy<T: Copy> {
    type Item<'a>: std::ops::Deref<Target = T>;

    fn bug<'a>(item: &Self::Item<'a>) -> () {
        let x: T = **item;
        &x as *const _;
    }
}

impl<T: Copy + std::ops::Deref> UnsafeCopy<T> for T {
    type Item<'a> = T;
    //~^ ERROR type mismatch resolving `<T as Deref>::Target == T`
}

fn main() {
    <&'static str>::bug(&"");
}