]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/generic-associated-types-where.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / ui / generic-associated-types / generic-associated-types-where.rs
1 #![feature(generic_associated_types)]
2
3 // Checking the interaction with this other feature
4 #![feature(associated_type_defaults)]
5
6 use std::fmt::{Display, Debug};
7
8 trait Foo {
9     type Assoc where Self: Sized;
10     type Assoc2<T> where T: Display;
11     type Assoc3<T>;
12     type WithDefault<'a, T: Debug + 'a>: ?Sized = dyn Iterator<Item=T>;
13     type NoGenerics;
14 }
15
16 struct Bar;
17
18 impl Foo for Bar {
19     type Assoc = usize;
20     type Assoc2<T> = Vec<T>;
21     //~^ ERROR `T` doesn't implement `std::fmt::Display`
22     type Assoc3<T> = Vec<T> where T: Iterator;
23     //~^ ERROR impl has stricter requirements than trait
24     type WithDefault<'a, T: Debug + 'a> = &'a dyn Iterator<Item=T>;
25     type NoGenerics = ::std::cell::Cell<i32>;
26 }
27
28 fn main() {}