]> git.lizzy.rs Git - rust.git/blob - tests/ui/associated-types/associated-types-bound-failure.rs
Rollup merge of #106717 - klensy:typo, r=lcnr
[rust.git] / tests / ui / associated-types / associated-types-bound-failure.rs
1 // run-rustfix
2 // Test equality constraints on associated types in a where clause.
3 #![allow(dead_code)]
4
5 pub trait ToInt {
6     fn to_int(&self) -> isize;
7 }
8
9 pub trait GetToInt
10 {
11     type R;
12
13     fn get(&self) -> <Self as GetToInt>::R;
14 }
15
16 fn foo<G>(g: G) -> isize
17     where G : GetToInt
18 {
19     ToInt::to_int(&g.get()) //~ ERROR E0277
20 }
21
22 fn bar<G : GetToInt>(g: G) -> isize
23     where G::R : ToInt
24 {
25     ToInt::to_int(&g.get()) // OK
26 }
27
28 pub fn main() {
29 }