]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/associated-types-no-suitable-supertrait.rs
Auto merge of #22517 - brson:relnotes, r=Gankro
[rust.git] / src / test / compile-fail / associated-types-no-suitable-supertrait.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 // Check that we get an error when you use `<Self as Get>::Value` in
12 // the trait definition but `Self` does not, in fact, implement `Get`.
13
14 trait Get {
15     type Value;
16 }
17
18 trait Other {
19     fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
20     //~^ ERROR the trait `Get` is not implemented for the type `Self`
21 }
22
23 impl<T:Get> Other for T {
24     fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
25     //~^ ERROR the trait `Get` is not implemented for the type `(T, U)`
26     //~| ERROR the trait `Get` is not implemented for the type `(T, U)`
27 }
28
29 fn main() { }