about summary refs log tree commit diff
path: root/tests/ui/sized-hierarchy/alias-bounds.rs
blob: 87b4bab11b7468814fab8b009ef16989f95f47c4 (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
//@ compile-flags: --crate-type=lib
//@ revisions: old next
//@[next] compile-flags: -Znext-solver
#![feature(sized_hierarchy)]

use std::marker::{PointeeSized, MetaSized};

trait Id: PointeeSized {
    type This: PointeeSized;
}

impl<T: PointeeSized> Id for T {
    type This = T;
}

fn requires_metasized<T: MetaSized>() {}

fn foo<T>()
where
    T: PointeeSized,
    <T as Id>::This: Sized
{
    // `T: Sized` from where bounds (`T: PointeeSized` removes any default bounds and
    // `<T as Id>::This: Sized` normalizes to `T: Sized`). This should trivially satisfy
    // `T: MetaSized`.
    requires_metasized::<T>();
}