@@ -188,7 +188,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
188188
189189 pub fn lower_item ( & mut self , i : & Item ) -> hir:: Item < ' hir > {
190190 let mut ident = i. ident ;
191- let mut vis = self . lower_visibility ( & i. vis , None ) ;
191+ let mut vis = self . lower_visibility ( & i. vis ) ;
192192 let hir_id = self . lower_node_id ( i. id ) ;
193193 let attrs = self . lower_attrs ( hir_id, & i. attrs ) ;
194194 let kind = self . lower_item_kind ( i. span , i. id , hir_id, & mut ident, attrs, & mut vis, & i. kind ) ;
@@ -493,7 +493,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
493493
494494 self . with_hir_id_owner ( new_node_id, |this| {
495495 let res = this. lower_res ( res) ;
496- let path = this. lower_path_extra ( res, & path, ParamMode :: Explicit , None ) ;
496+ let path = this. lower_path_extra ( res, & path, ParamMode :: Explicit ) ;
497497 let kind = hir:: ItemKind :: Use ( path, hir:: UseKind :: Single ) ;
498498 let vis = this. rebuild_vis ( & vis) ;
499499 if let Some ( attrs) = attrs {
@@ -510,7 +510,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
510510 } ) ;
511511 }
512512
513- let path = self . lower_path_extra ( ret_res, & path, ParamMode :: Explicit , None ) ;
513+ let path = self . lower_path_extra ( ret_res, & path, ParamMode :: Explicit ) ;
514514 hir:: ItemKind :: Use ( path, hir:: UseKind :: Single )
515515 }
516516 UseTreeKind :: Glob => {
@@ -610,7 +610,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
610610
611611 let res = self . expect_full_res_from_use ( id) . next ( ) . unwrap_or ( Res :: Err ) ;
612612 let res = self . lower_res ( res) ;
613- let path = self . lower_path_extra ( res, & prefix, ParamMode :: Explicit , None ) ;
613+ let path = self . lower_path_extra ( res, & prefix, ParamMode :: Explicit ) ;
614614 hir:: ItemKind :: Use ( path, hir:: UseKind :: ListStem )
615615 }
616616 }
@@ -679,17 +679,16 @@ impl<'hir> LoweringContext<'_, 'hir> {
679679 ForeignItemKind :: TyAlias ( ..) => hir:: ForeignItemKind :: Type ,
680680 ForeignItemKind :: MacCall ( _) => panic ! ( "macro shouldn't exist here" ) ,
681681 } ,
682- vis : self . lower_visibility ( & i. vis , None ) ,
682+ vis : self . lower_visibility ( & i. vis ) ,
683683 span : self . lower_span ( i. span ) ,
684684 }
685685 }
686686
687- fn lower_foreign_item_ref ( & mut self , i : & ForeignItem ) -> hir:: ForeignItemRef < ' hir > {
687+ fn lower_foreign_item_ref ( & mut self , i : & ForeignItem ) -> hir:: ForeignItemRef {
688688 hir:: ForeignItemRef {
689689 id : hir:: ForeignItemId { def_id : self . allocate_hir_id_counter ( i. id ) } ,
690690 ident : self . lower_ident ( i. ident ) ,
691691 span : self . lower_span ( i. span ) ,
692- vis : self . lower_visibility ( & i. vis , Some ( i. id ) ) ,
693692 }
694693 }
695694
@@ -757,7 +756,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
757756 // FIXME(jseyfried): positional field hygiene.
758757 None => Ident :: new ( sym:: integer ( index) , self . lower_span ( f. span ) ) ,
759758 } ,
760- vis : self . lower_visibility ( & f. vis , None ) ,
759+ vis : self . lower_visibility ( & f. vis ) ,
761760 ty,
762761 }
763762 }
@@ -899,22 +898,21 @@ impl<'hir> LoweringContext<'_, 'hir> {
899898 def_id : hir_id. expect_owner ( ) ,
900899 ident : self . lower_ident ( i. ident ) ,
901900 generics,
902- vis : self . lower_visibility ( & i. vis , None ) ,
901+ vis : self . lower_visibility ( & i. vis ) ,
903902 defaultness,
904903 kind,
905904 span : self . lower_span ( i. span ) ,
906905 }
907906 }
908907
909- fn lower_impl_item_ref ( & mut self , i : & AssocItem ) -> hir:: ImplItemRef < ' hir > {
908+ fn lower_impl_item_ref ( & mut self , i : & AssocItem ) -> hir:: ImplItemRef {
910909 // Since `default impl` is not yet implemented, this is always true in impls.
911910 let has_value = true ;
912911 let ( defaultness, _) = self . lower_defaultness ( i. kind . defaultness ( ) , has_value) ;
913912 hir:: ImplItemRef {
914913 id : hir:: ImplItemId { def_id : self . allocate_hir_id_counter ( i. id ) } ,
915914 ident : self . lower_ident ( i. ident ) ,
916915 span : self . lower_span ( i. span ) ,
917- vis : self . lower_visibility ( & i. vis , Some ( i. id ) ) ,
918916 defaultness,
919917 kind : match & i. kind {
920918 AssocItemKind :: Const ( ..) => hir:: AssocItemKind :: Const ,
@@ -932,25 +930,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
932930 /// lowered. This can happen during `lower_impl_item_ref()` where we need to
933931 /// lower a `Visibility` value although we haven't lowered the owning
934932 /// `ImplItem` in question yet.
935- fn lower_visibility (
936- & mut self ,
937- v : & Visibility ,
938- explicit_owner : Option < NodeId > ,
939- ) -> hir:: Visibility < ' hir > {
933+ fn lower_visibility ( & mut self , v : & Visibility ) -> hir:: Visibility < ' hir > {
940934 let node = match v. kind {
941935 VisibilityKind :: Public => hir:: VisibilityKind :: Public ,
942936 VisibilityKind :: Crate ( sugar) => hir:: VisibilityKind :: Crate ( sugar) ,
943937 VisibilityKind :: Restricted { ref path, id } => {
944938 debug ! ( "lower_visibility: restricted path id = {:?}" , id) ;
945- let lowered_id = if let Some ( owner) = explicit_owner {
946- self . lower_node_id_with_owner ( id, owner)
947- } else {
948- self . lower_node_id ( id)
949- } ;
950- let res = self . expect_full_res ( id) ;
951- let res = self . lower_res ( res) ;
939+ let lowered_id = self . lower_node_id ( id) ;
952940 hir:: VisibilityKind :: Restricted {
953- path : self . lower_path_extra ( res , path, ParamMode :: Explicit , explicit_owner ) ,
941+ path : self . lower_path ( id , path, ParamMode :: Explicit ) ,
954942 hir_id : lowered_id,
955943 }
956944 }
0 commit comments