File tree Expand file tree Collapse file tree 1 file changed +14
-7
lines changed
compiler/rustc_hir_analysis/src/check Expand file tree Collapse file tree 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -1995,13 +1995,20 @@ pub(super) fn check_type_bounds<'tcx>(
19951995 let infcx = tcx. infer_ctxt ( ) . build ( ) ;
19961996 let ocx = ObligationCtxt :: new ( & infcx) ;
19971997
1998- let impl_ty_span = match tcx. hir ( ) . get_by_def_id ( impl_ty_def_id) {
1999- hir:: Node :: TraitItem ( hir:: TraitItem {
2000- kind : hir:: TraitItemKind :: Type ( _, Some ( ty) ) ,
2001- ..
2002- } ) => ty. span ,
2003- hir:: Node :: ImplItem ( hir:: ImplItem { kind : hir:: ImplItemKind :: Type ( ty) , .. } ) => ty. span ,
2004- _ => bug ! ( ) ,
1998+ // A synthetic impl Trait for RPITIT desugaring has no HIR, which we currently use to get the
1999+ // span for an impl's associated type. Instead, for these, use the def_span for the synthesized
2000+ // associated type.
2001+ let impl_ty_span = if tcx. opt_rpitit_info ( impl_ty. def_id ) . is_some ( ) {
2002+ tcx. def_span ( impl_ty_def_id)
2003+ } else {
2004+ match tcx. hir ( ) . get_by_def_id ( impl_ty_def_id) {
2005+ hir:: Node :: TraitItem ( hir:: TraitItem {
2006+ kind : hir:: TraitItemKind :: Type ( _, Some ( ty) ) ,
2007+ ..
2008+ } ) => ty. span ,
2009+ hir:: Node :: ImplItem ( hir:: ImplItem { kind : hir:: ImplItemKind :: Type ( ty) , .. } ) => ty. span ,
2010+ _ => bug ! ( ) ,
2011+ }
20052012 } ;
20062013 let assumed_wf_types = ocx. assumed_wf_types ( param_env, impl_ty_span, impl_ty_def_id) ;
20072014
You can’t perform that action at this time.
0 commit comments