11use crate :: def:: { CtorKind , DefKind , Res } ;
22use crate :: def_id:: { DefId , CRATE_DEF_ID } ;
33crate use crate :: hir_id:: { HirId , ItemLocalId } ;
4- use crate :: { itemlikevisit , LangItem } ;
4+ use crate :: LangItem ;
55
66use rustc_ast:: util:: parser:: ExprPrecedence ;
77use rustc_ast:: { self as ast, CrateSugar , LlvmAsmDialect } ;
@@ -10,7 +10,6 @@ pub use rustc_ast::{BorrowKind, ImplPolarity, IsAuto};
1010pub use rustc_ast:: { CaptureBy , Movability , Mutability } ;
1111use rustc_ast:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
1212use rustc_data_structures:: fx:: FxHashMap ;
13- use rustc_data_structures:: sync:: { par_for_each_in, Send , Sync } ;
1413use rustc_index:: vec:: IndexVec ;
1514use rustc_macros:: HashStable_Generic ;
1615use rustc_span:: source_map:: Spanned ;
@@ -672,7 +671,7 @@ pub struct Crate<'hir> {
672671 pub attrs : BTreeMap < HirId , & ' hir [ Attribute ] > ,
673672}
674673
675- impl Crate < ' hir > {
674+ impl < ' hir > Crate < ' hir > {
676675 pub fn module ( & self ) -> & ' hir Mod < ' hir > {
677676 if let Some ( OwnerNode :: Crate ( m) ) = self . owners [ CRATE_DEF_ID ] { m } else { panic ! ( ) }
678677 }
@@ -698,52 +697,6 @@ impl Crate<'hir> {
698697 }
699698}
700699
701- impl Crate < ' _ > {
702- /// Visits all items in the crate in some deterministic (but
703- /// unspecified) order. If you just need to process every item,
704- /// but don't care about nesting, this method is the best choice.
705- ///
706- /// If you do care about nesting -- usually because your algorithm
707- /// follows lexical scoping rules -- then you want a different
708- /// approach. You should override `visit_nested_item` in your
709- /// visitor and then call `intravisit::walk_crate` instead.
710- pub fn visit_all_item_likes < ' hir , V > ( & ' hir self , visitor : & mut V )
711- where
712- V : itemlikevisit:: ItemLikeVisitor < ' hir > ,
713- {
714- for owner in self . owners . iter ( ) . filter_map ( Option :: as_ref) {
715- match owner {
716- OwnerNode :: Item ( item) => visitor. visit_item ( item) ,
717- OwnerNode :: ForeignItem ( item) => visitor. visit_foreign_item ( item) ,
718- OwnerNode :: ImplItem ( item) => visitor. visit_impl_item ( item) ,
719- OwnerNode :: TraitItem ( item) => visitor. visit_trait_item ( item) ,
720- OwnerNode :: Crate ( _) => { }
721- }
722- }
723- }
724-
725- /// A parallel version of `visit_all_item_likes`.
726- pub fn par_visit_all_item_likes < ' hir , V > ( & ' hir self , visitor : & V )
727- where
728- V : itemlikevisit:: ParItemLikeVisitor < ' hir > + Sync + Send ,
729- {
730- par_for_each_in ( & self . owners . raw , |owner| match owner {
731- Some ( OwnerNode :: Item ( item) ) => visitor. visit_item ( item) ,
732- Some ( OwnerNode :: ForeignItem ( item) ) => visitor. visit_foreign_item ( item) ,
733- Some ( OwnerNode :: ImplItem ( item) ) => visitor. visit_impl_item ( item) ,
734- Some ( OwnerNode :: TraitItem ( item) ) => visitor. visit_trait_item ( item) ,
735- Some ( OwnerNode :: Crate ( _) ) | None => { }
736- } )
737- }
738-
739- pub fn items < ' hir > ( & ' hir self ) -> impl Iterator < Item = & ' hir Item < ' hir > > + ' hir {
740- self . owners . iter ( ) . filter_map ( |owner| match owner {
741- Some ( OwnerNode :: Item ( item) ) => Some ( * item) ,
742- _ => None ,
743- } )
744- }
745- }
746-
747700/// A block of statements `{ .. }`, which may have a label (in this case the
748701/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
749702/// the `rules` being anything but `DefaultBlock`.
0 commit comments