1 #![feature(associated_type_defaults)]
61 // B is pub, not in scope
62 // C : A + B is pub, in scope
65 // Methods, method call
66 // a, b, c are resolved as trait items, their traits need to be in scope
67 S.a(); //~ ERROR no method named `a` found
68 S.b(); //~ ERROR no method named `b` found
70 // a, b, c are resolved as inherent items, their traits don't need to be in scope
72 c.a(); //~ ERROR associated function `a` is private
77 // a, b, c are resolved as trait items, their traits need to be in scope
79 //~^ ERROR no function or associated item named `a` found
81 //~^ ERROR no function or associated item named `b` found
83 // a, b, c are resolved as inherent items, their traits don't need to be in scope
84 C::a(&S); //~ ERROR associated function `a` is private
89 fn check_assoc_const() {
91 // B is pub, not in scope
92 // C : A + B is pub, in scope
95 // Associated constants
96 // A, B, C are resolved as trait items, their traits need to be in scope
97 S::A; //~ ERROR no associated item named `A` found
98 S::B; //~ ERROR no associated item named `B` found
100 // A, B, C are resolved as inherent items, their traits don't need to be in scope
101 C::A; //~ ERROR associated constant `A` is private
102 //~^ ERROR the trait `assoc_const::C` cannot be made into an object
103 C::B; // ERROR the trait `assoc_const::C` cannot be made into an object
107 fn check_assoc_ty<T: assoc_ty::C>() {
109 // B is pub, not in scope
110 // C : A + B is pub, in scope
114 // A, B, C are resolved as trait items, their traits need to be in scope, not implemented yet
115 let _: S::A; //~ ERROR ambiguous associated type
116 let _: S::B; //~ ERROR ambiguous associated type
117 let _: S::C; //~ ERROR ambiguous associated type
118 // A, B, C are resolved as inherent items, their traits don't need to be in scope
119 let _: T::A; //~ ERROR associated type `A` is private
123 // Associated types, bindings
124 let _: dyn assoc_ty::B<
128 A = u8, //~ ERROR associated type `A` is private