3 #![allow(unused_variables)]
4 // Test that we can use `Self` types in impls in the expected way.
6 // pretty-expanded FIXME #23616
10 // Test uses on inherent impl.
12 fn foo(_x: Self, _y: &Self, _z: Box<Self>) -> Self {
17 // Test that Self cannot be shadowed.
19 // There is no empty method on i32.
28 // Test uses when implementing a trait and with a type parameter.
37 trait Bar<X>: SuperBar {
40 fn bar(x: Self, y: &Self, z: Box<Self>, _: Self::SuperQux) -> Self;
41 fn dummy(&self, x: X) { }
44 impl SuperBar for Box<Baz<isize>> {
48 impl Bar<isize> for Box<Baz<isize>> {
51 fn bar(_x: Self, _y: &Self, _z: Box<Self>, _: Self::SuperQux) -> Self {
52 let _: Self::Qux = 42;
53 let _: <Self as Bar<isize>>::Qux = 42;
55 let _: Self::SuperQux = true;
56 let _: <Self as SuperBar>::SuperQux = true;
58 Box::new(Baz { f: 42 })
63 let _: Foo = Foo::foo(Foo, &Foo, Box::new(Foo));
64 let _: Box<Baz<isize>> = Bar::bar(Box::new(Baz { f: 42 }),
65 &Box::new(Baz { f: 42 }),
66 Box::new(Box::new(Baz { f: 42 })),