@@ -169,7 +169,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
169169 trait_def_id : DefId ,
170170 supertraits_only : bool ) -> bool
171171 {
172- let trait_self_ty = self . mk_self_type ( ) ;
172+ let trait_self_ty = self . mk_self_type ( trait_def_id ) ;
173173 let trait_ref = ty:: Binder :: dummy ( ty:: TraitRef :: identity ( self , trait_def_id) ) ;
174174 let predicates = if supertraits_only {
175175 self . super_predicates_of ( trait_def_id)
@@ -203,11 +203,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
203203 }
204204
205205 fn trait_has_sized_self ( self , trait_def_id : DefId ) -> bool {
206- self . generics_require_sized_self ( trait_def_id)
206+ self . generics_require_sized_self ( trait_def_id, trait_def_id )
207207 }
208208
209- fn generics_require_sized_self ( self , def_id : DefId ) -> bool {
210- let trait_self_ty = self . mk_self_type ( ) ;
209+ fn generics_require_sized_self ( self , trait_def_id : DefId , def_id : DefId ) -> bool {
210+ let trait_self_ty = self . mk_self_type ( trait_def_id ) ;
211211 let sized_def_id = match self . lang_items ( ) . sized_trait ( ) {
212212 Some ( def_id) => def_id,
213213 None => { return false ; /* No Sized trait, can't require it! */ }
@@ -245,7 +245,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
245245 {
246246 // Any method that has a `Self : Sized` requisite is otherwise
247247 // exempt from the regulations.
248- if self . generics_require_sized_self ( method. def_id ) {
248+ if self . generics_require_sized_self ( trait_def_id , method. def_id ) {
249249 return None ;
250250 }
251251
@@ -262,7 +262,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
262262 -> bool
263263 {
264264 // Any method that has a `Self : Sized` requisite can't be called.
265- if self . generics_require_sized_self ( method. def_id ) {
265+ if self . generics_require_sized_self ( trait_def_id , method. def_id ) {
266266 return false ;
267267 }
268268
@@ -290,7 +290,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
290290
291291 let sig = self . fn_sig ( method. def_id ) ;
292292
293- let self_ty = self . mk_self_type ( ) ;
293+ let self_ty = self . mk_self_type ( trait_def_id ) ;
294294 let self_arg_ty = sig. skip_binder ( ) . inputs ( ) [ 0 ] ;
295295 if let ExplicitSelf :: Other = ExplicitSelf :: determine ( self_arg_ty, |ty| ty == self_ty) {
296296 return Some ( MethodViolationCode :: NonStandardSelfType ) ;
@@ -371,7 +371,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
371371 // object type, and we cannot resolve `Self as SomeOtherTrait`
372372 // without knowing what `Self` is.
373373
374- let trait_self_ty = self . mk_self_type ( ) ;
374+ let trait_self_ty = self . mk_self_type ( trait_def_id ) ;
375375 let mut supertraits: Option < Vec < ty:: PolyTraitRef < ' tcx > > > = None ;
376376 let mut error = false ;
377377 ty. maybe_walk ( |ty| {
0 commit comments