about summary refs log tree commit diff
path: root/tests/ui/sized-hierarchy/pointee-supertrait.rs
blob: 4bf486890bf2351faad465da60fc59c89e58b580 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//@ check-pass
#![feature(sized_hierarchy)]

// This is a reduction of some code in `library/core/src/cmp.rs` that would ICE if a default
// `Pointee` bound is added - motivating the current status quo of `PointeeSized` being syntactic
// sugar for an absense of any bounds whatsoever.

use std::marker::PhantomData;

pub trait Bar<'a> {
    type Foo;
}

pub struct Foo<'a, T: Bar<'a>> {
    phantom: PhantomData<&'a T>,
}

impl<'a, 'b, T> PartialEq<Foo<'b, T>> for Foo<'a, T>
    where
        T: for<'c> Bar<'c>,
        <T as Bar<'a>>::Foo: PartialEq<<T as Bar<'b>>::Foo>,
{
    fn eq(&self, _: &Foo<'b, T>) -> bool {
        loop {}
    }
}

fn main() { }