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