@@ -40,7 +40,7 @@ use rustc_middle::ty::query::Providers;
4040use rustc_middle:: ty:: subst:: InternalSubsts ;
4141use rustc_middle:: ty:: util:: Discr ;
4242use rustc_middle:: ty:: util:: IntTypeExt ;
43- use rustc_middle:: ty:: { self , AdtKind , Const , DefIdTree , ToPolyTraitRef , Ty , TyCtxt } ;
43+ use rustc_middle:: ty:: { self , AdtKind , Const , DefIdTree , Ty , TyCtxt } ;
4444use rustc_middle:: ty:: { ReprOptions , ToPredicate , WithConstness } ;
4545use rustc_session:: lint;
4646use rustc_session:: parse:: feature_err;
@@ -607,8 +607,7 @@ fn type_param_predicates(
607607 ItemKind :: Trait ( _, _, ref generics, ..) => {
608608 // Implied `Self: Trait` and supertrait bounds.
609609 if param_id == item_hir_id {
610- let identity_trait_ref =
611- ty:: Binder :: dummy ( ty:: TraitRef :: identity ( tcx, item_def_id) ) ;
610+ let identity_trait_ref = ty:: TraitRef :: identity ( tcx, item_def_id) ;
612611 extend =
613612 Some ( ( identity_trait_ref. without_const ( ) . to_predicate ( tcx) , item. span ) ) ;
614613 }
@@ -2003,14 +2002,11 @@ fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredicates<'_> {
20032002 // *current* state of an external file.
20042003 span = tcx. sess . source_map ( ) . guess_head_span ( span) ;
20052004 }
2006- result. predicates = tcx. arena . alloc_from_iter (
2007- result. predicates . iter ( ) . copied ( ) . chain ( std:: iter:: once ( (
2008- ty:: Binder :: dummy ( ty:: TraitRef :: identity ( tcx, def_id) )
2009- . without_const ( )
2010- . to_predicate ( tcx) ,
2005+ result. predicates =
2006+ tcx. arena . alloc_from_iter ( result. predicates . iter ( ) . copied ( ) . chain ( std:: iter:: once ( (
2007+ ty:: TraitRef :: identity ( tcx, def_id) . without_const ( ) . to_predicate ( tcx) ,
20112008 span,
2012- ) ) ) ,
2013- ) ;
2009+ ) ) ) ) ;
20142010 }
20152011 debug ! ( "predicates_of(def_id={:?}) = {:?}" , def_id, result) ;
20162012 result
@@ -2046,7 +2042,9 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
20462042 match item. kind {
20472043 ItemKind :: Impl ( ref impl_) => {
20482044 if impl_. defaultness . is_default ( ) {
2049- is_default_impl_trait = tcx. impl_trait_ref ( def_id) ;
2045+ is_default_impl_trait = tcx
2046+ . impl_trait_ref ( def_id)
2047+ . map ( |trait_ref| ty:: Binder :: dummy ( trait_ref) ) ;
20502048 }
20512049 & impl_. generics
20522050 }
@@ -2126,10 +2124,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
21262124 // (see below). Recall that a default impl is not itself an impl, but rather a
21272125 // set of defaults that can be incorporated into another impl.
21282126 if let Some ( trait_ref) = is_default_impl_trait {
2129- predicates. insert ( (
2130- trait_ref. to_poly_trait_ref ( ) . without_const ( ) . to_predicate ( tcx) ,
2131- tcx. def_span ( def_id) ,
2132- ) ) ;
2127+ predicates. insert ( ( trait_ref. without_const ( ) . to_predicate ( tcx) , tcx. def_span ( def_id) ) ) ;
21332128 }
21342129
21352130 // Collect the region predicates that were declared inline as
0 commit comments