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.
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.
11 // Test equality constrai32s on associated types in a where clause.
13 // pretty-expanded FIXME #23616
16 fn to_i32(&self) -> i32;
20 fn to_i32(&self) -> i32 { *self }
24 fn to_i32(&self) -> i32 { *self as i32 }
31 fn get(&self) -> <Self as GetToI32>::R;
34 impl GetToI32 for i32 {
36 fn get(&self) -> i32 { *self }
39 impl GetToI32 for u32 {
41 fn get(&self) -> u32 { *self }
44 fn foo<G>(g: G) -> i32
47 ToI32::to_i32(&g.get())
51 assert_eq!(foo(22i32), 22);
52 assert_eq!(foo(22u32), 22);