3 #![allow(unused_variables)]
4 // Test that we can use `Self` types in impls in the expected way.
6 // pretty-expanded FIXME #23616
8 #![feature(box_syntax)]
12 // Test uses on inherent impl.
14 fn foo(_x: Self, _y: &Self, _z: Box<Self>) -> Self {
19 // Test that Self cannot be shadowed.
21 // There is no empty method on i32.
30 // Test uses when implementing a trait and with a type parameter.
39 trait Bar<X>: SuperBar {
42 fn bar(x: Self, y: &Self, z: Box<Self>, _: Self::SuperQux) -> Self;
43 fn dummy(&self, x: X) { }
46 impl SuperBar for Box<Baz<isize>> {
50 impl Bar<isize> for Box<Baz<isize>> {
53 fn bar(_x: Self, _y: &Self, _z: Box<Self>, _: Self::SuperQux) -> Self {
54 let _: Self::Qux = 42;
55 let _: <Self as Bar<isize>>::Qux = 42;
57 let _: Self::SuperQux = true;
58 let _: <Self as SuperBar>::SuperQux = true;
65 let _: Foo = Foo::foo(Foo, &Foo, box Foo);
66 let _: Box<Baz<isize>> = Bar::bar(box Baz { f: 42 },
68 box box Baz { f: 42 },