]> git.lizzy.rs Git - rust.git/blob - tests/ui/specialization/default-associated-type-bound-1.rs
Rollup merge of #106638 - RalfJung:realstd, r=thomcc
[rust.git] / tests / ui / specialization / default-associated-type-bound-1.rs
1 // Check that we check that default associated types satisfy the required
2 // bounds on them.
3
4 #![feature(specialization)]
5 //~^ WARNING `specialization` is incomplete
6
7 trait X {
8     type U: Clone;
9     fn unsafe_clone(&self, x: Option<&Self::U>) {
10         x.cloned();
11     }
12 }
13
14 // We cannot normalize `<T as X>::U` to `str` here, because the default could
15 // be overridden. The error here must therefore be found by a method other than
16 // normalization.
17 impl<T> X for T {
18     default type U = str;
19     //~^ ERROR the trait bound `str: Clone` is not satisfied
20 }
21
22 pub fn main() {
23     1.unsafe_clone(None);
24 }