@@ -356,9 +356,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
356356 poly_projections. extend ( assoc_bindings. iter ( ) . filter_map ( |binding| {
357357 // specify type to assert that error was already reported in Err case:
358358 let predicate: Result < _ , ErrorReported > =
359- self . ast_type_binding_to_poly_projection_predicate ( trait_ref. ref_id ,
360- poly_trait_ref,
361- binding) ;
359+ self . ast_type_binding_to_poly_projection_predicate ( poly_trait_ref, binding) ;
362360 predicate. ok ( ) // ok to ignore Err() because ErrorReported (see above)
363361 } ) ) ;
364362
@@ -423,13 +421,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
423421 -> bool
424422 {
425423 self . tcx ( ) . associated_items ( trait_def_id) . any ( |item| {
426- item. kind == ty:: AssociatedKind :: Type && item. name == assoc_name
424+ item. kind == ty:: AssociatedKind :: Type &&
425+ self . tcx ( ) . hygienic_eq ( assoc_name, item. name , trait_def_id)
427426 } )
428427 }
429428
430429 fn ast_type_binding_to_poly_projection_predicate (
431430 & self ,
432- _path_id : ast:: NodeId ,
433431 trait_ref : ty:: PolyTraitRef < ' tcx > ,
434432 binding : & ConvertedBinding < ' tcx > )
435433 -> Result < ty:: PolyProjectionPredicate < ' tcx > , ErrorReported >
@@ -504,7 +502,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
504502
505503 let candidate = self . one_bound_for_assoc_type ( candidates,
506504 & trait_ref. to_string ( ) ,
507- & binding. item_name . as_str ( ) ,
505+ binding. item_name ,
508506 binding. span ) ?;
509507
510508 Ok ( candidate. map_bound ( |trait_ref| {
@@ -702,7 +700,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
702700 let param_name = tcx. hir . ty_param_name ( param_node_id) ;
703701 self . one_bound_for_assoc_type ( suitable_bounds,
704702 & param_name. as_str ( ) ,
705- & assoc_name. as_str ( ) ,
703+ assoc_name,
706704 span)
707705 }
708706
@@ -712,7 +710,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
712710 fn one_bound_for_assoc_type < I > ( & self ,
713711 mut bounds : I ,
714712 ty_param_name : & str ,
715- assoc_name : & str ,
713+ assoc_name : ast :: Name ,
716714 span : Span )
717715 -> Result < ty:: PolyTraitRef < ' tcx > , ErrorReported >
718716 where I : Iterator < Item =ty:: PolyTraitRef < ' tcx > >
@@ -741,7 +739,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
741739
742740 for bound in bounds {
743741 let bound_span = self . tcx ( ) . associated_items ( bound. def_id ( ) ) . find ( |item| {
744- item. kind == ty:: AssociatedKind :: Type && item. name == assoc_name
742+ item. kind == ty:: AssociatedKind :: Type &&
743+ self . tcx ( ) . hygienic_eq ( assoc_name, item. name , bound. def_id ( ) )
745744 } )
746745 . and_then ( |item| self . tcx ( ) . hir . span_if_local ( item. def_id ) ) ;
747746
@@ -802,10 +801,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
802801 . filter ( |r| self . trait_defines_associated_type_named ( r. def_id ( ) ,
803802 assoc_name) ) ;
804803
805- match self . one_bound_for_assoc_type ( candidates,
806- "Self" ,
807- & assoc_name. as_str ( ) ,
808- span) {
804+ match self . one_bound_for_assoc_type ( candidates, "Self" , assoc_name, span) {
809805 Ok ( bound) => bound,
810806 Err ( ErrorReported ) => return ( tcx. types . err , Def :: Err ) ,
811807 }
@@ -830,14 +826,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
830826 } ;
831827
832828 let trait_did = bound. 0 . def_id ;
833- let item = tcx. associated_items ( trait_did) . find ( |i| i. name == assoc_name)
829+ let ( assoc_ident, def_scope) = tcx. adjust ( assoc_name, trait_did, ref_id) ;
830+ let item = tcx. associated_items ( trait_did) . find ( |i| i. name . to_ident ( ) == assoc_ident)
834831 . expect ( "missing associated type" ) ;
835832
836833 let ty = self . projected_ty_from_poly_trait_ref ( span, item. def_id , bound) ;
837834 let ty = self . normalize_ty ( span, ty) ;
838835
839836 let def = Def :: AssociatedTy ( item. def_id ) ;
840- let def_scope = tcx. adjust ( assoc_name, item. container . id ( ) , ref_id) . 1 ;
841837 if !item. vis . is_accessible_from ( def_scope, tcx) {
842838 let msg = format ! ( "{} `{}` is private" , def. kind_name( ) , assoc_name) ;
843839 tcx. sess . span_err ( span, & msg) ;
0 commit comments