]> git.proxmox.com Git - rustc.git/blob - src/test/ui/specialization/deafult-associated-type-bound-1.rs
New upstream version 1.46.0~beta.2+dfsg1
[rustc.git] / src / test / ui / specialization / deafult-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: std::clone::Clone` is not satisfied
20 }
21
22 pub fn main() {
23 1.unsafe_clone(None);
24 }