]> git.lizzy.rs Git - rust.git/blob - src/test/ui/autoref-autoderef/autoref-intermediate-types-issue-3585.rs
Auto merge of #100845 - timvermeulen:iter_compare, r=scottmcm
[rust.git] / src / test / ui / autoref-autoderef / autoref-intermediate-types-issue-3585.rs
1 // run-pass
2
3 trait Foo {
4     fn foo(&self) -> String;
5 }
6
7 impl<T:Foo> Foo for Box<T> {
8     fn foo(&self) -> String {
9         format!("box {}", (**self).foo())
10     }
11 }
12
13 impl Foo for usize {
14     fn foo(&self) -> String {
15         format!("{}", *self)
16     }
17 }
18
19 pub fn main() {
20     let x: Box<_> = Box::new(3);
21     assert_eq!(x.foo(), "box 3".to_string());
22 }