1 #![feature(specialization)]
3 // Check a number of scenarios in which one impl tries to override another,
4 // without correctly using `default`.
6 ////////////////////////////////////////////////////////////////////////////////
7 // Test 1: one layer of specialization, multiple methods, missing `default`
8 ////////////////////////////////////////////////////////////////////////////////
22 fn foo(&self) {} //~ ERROR E0520
25 fn bar(&self) {} //~ ERROR E0520
28 ////////////////////////////////////////////////////////////////////////////////
29 // Test 2: one layer of specialization, missing `default` on associated type
30 ////////////////////////////////////////////////////////////////////////////////
41 type T = (); //~ ERROR E0520
44 ////////////////////////////////////////////////////////////////////////////////
45 // Test 3a: multiple layers of specialization, missing interior `default`
46 ////////////////////////////////////////////////////////////////////////////////
53 default fn baz(&self) {}
56 impl<T: Clone> Baz for T {
61 fn baz(&self) {} //~ ERROR E0520
64 ////////////////////////////////////////////////////////////////////////////////
65 // Test 3b: multiple layers of specialization, missing interior `default`,
66 // redundant `default` in bottom layer.
67 ////////////////////////////////////////////////////////////////////////////////
73 impl<T> Redundant for T {
74 default fn redundant(&self) {}
77 impl<T: Clone> Redundant for T {
78 fn redundant(&self) {}
81 impl Redundant for i32 {
82 default fn redundant(&self) {} //~ ERROR E0520