@@ -169,7 +169,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
169
169
trait_def_id : DefId ,
170
170
supertraits_only : bool ) -> bool
171
171
{
172
- let trait_self_ty = self . mk_self_type ( ) ;
172
+ let trait_self_ty = self . mk_self_type ( trait_def_id ) ;
173
173
let trait_ref = ty:: Binder :: dummy ( ty:: TraitRef :: identity ( self , trait_def_id) ) ;
174
174
let predicates = if supertraits_only {
175
175
self . super_predicates_of ( trait_def_id)
@@ -203,11 +203,11 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
203
203
}
204
204
205
205
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 )
207
207
}
208
208
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 ) ;
211
211
let sized_def_id = match self . lang_items ( ) . sized_trait ( ) {
212
212
Some ( def_id) => def_id,
213
213
None => { return false ; /* No Sized trait, can't require it! */ }
@@ -245,7 +245,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
245
245
{
246
246
// Any method that has a `Self : Sized` requisite is otherwise
247
247
// 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 ) {
249
249
return None ;
250
250
}
251
251
@@ -262,7 +262,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
262
262
-> bool
263
263
{
264
264
// 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 ) {
266
266
return false ;
267
267
}
268
268
@@ -290,7 +290,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
290
290
291
291
let sig = self . fn_sig ( method. def_id ) ;
292
292
293
- let self_ty = self . mk_self_type ( ) ;
293
+ let self_ty = self . mk_self_type ( trait_def_id ) ;
294
294
let self_arg_ty = sig. skip_binder ( ) . inputs ( ) [ 0 ] ;
295
295
if let ExplicitSelf :: Other = ExplicitSelf :: determine ( self_arg_ty, |ty| ty == self_ty) {
296
296
return Some ( MethodViolationCode :: NonStandardSelfType ) ;
@@ -371,7 +371,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
371
371
// object type, and we cannot resolve `Self as SomeOtherTrait`
372
372
// without knowing what `Self` is.
373
373
374
- let trait_self_ty = self . mk_self_type ( ) ;
374
+ let trait_self_ty = self . mk_self_type ( trait_def_id ) ;
375
375
let mut supertraits: Option < Vec < ty:: PolyTraitRef < ' tcx > > > = None ;
376
376
let mut error = false ;
377
377
ty. maybe_walk ( |ty| {
0 commit comments