]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/type-params-in-different-spaces-2.rs
rollup merge of #17355 : gamazeps/issue17210
[rust.git] / src / test / compile-fail / type-params-in-different-spaces-2.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 trait Tr<T> {
12     fn op(T) -> Self;
13 }
14
15 // these compile as if Self: Tr<U>, even tho only Self: Tr<Self or T>
16 trait A:    Tr<Self> {
17     fn test<U>(u: U) -> Self {
18         Tr::op(u)   //~ ERROR type mismatch
19     }
20 }
21 trait B<T>: Tr<T> {
22     fn test<U>(u: U) -> Self {
23         Tr::op(u)   //~ ERROR type mismatch
24     }
25 }
26
27 impl<T> Tr<T> for T {
28     fn op(t: T) -> T { t }
29 }
30 impl<T> A for T {}
31
32 fn main() {
33     std::io::println(A::test((&7306634593706211700, 8)));
34 }
35