]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-90729.rs
Move some tests with compare-mode=nll output to revisions
[rust.git] / src / test / ui / generic-associated-types / issue-90729.rs
1 // check-pass
2
3 #![feature(generic_associated_types)]
4
5 use std::marker::PhantomData;
6
7 pub trait Type {
8     type Ref<'a>;
9 }
10
11 pub trait AsBytes {}
12
13 impl AsBytes for &str {}
14
15 pub struct Utf8;
16
17 impl Type for Utf8 {
18     type Ref<'a> = &'a str;
19 }
20
21 pub struct Bytes<T: Type> {
22     _marker: PhantomData<T>,
23 }
24
25 impl<T: Type> Bytes<T>
26 where
27     for<'a> T::Ref<'a>: AsBytes,
28 {
29     pub fn new() -> Self {
30         Self {
31             _marker: PhantomData,
32         }
33     }
34 }
35
36 fn main() {
37     let _b = Bytes::<Utf8>::new();
38 }