1
1
use crate :: def:: { CtorKind , DefKind , Res } ;
2
2
use crate :: def_id:: { DefId , CRATE_DEF_ID } ;
3
3
crate use crate :: hir_id:: { HirId , ItemLocalId } ;
4
- use crate :: { itemlikevisit , LangItem } ;
4
+ use crate :: LangItem ;
5
5
6
6
use rustc_ast:: util:: parser:: ExprPrecedence ;
7
7
use rustc_ast:: { self as ast, CrateSugar , LlvmAsmDialect } ;
@@ -10,7 +10,6 @@ pub use rustc_ast::{BorrowKind, ImplPolarity, IsAuto};
10
10
pub use rustc_ast:: { CaptureBy , Movability , Mutability } ;
11
11
use rustc_ast:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
12
12
use rustc_data_structures:: fx:: FxHashMap ;
13
- use rustc_data_structures:: sync:: { par_for_each_in, Send , Sync } ;
14
13
use rustc_index:: vec:: IndexVec ;
15
14
use rustc_macros:: HashStable_Generic ;
16
15
use rustc_span:: source_map:: Spanned ;
@@ -672,7 +671,7 @@ pub struct Crate<'hir> {
672
671
pub attrs : BTreeMap < HirId , & ' hir [ Attribute ] > ,
673
672
}
674
673
675
- impl Crate < ' hir > {
674
+ impl < ' hir > Crate < ' hir > {
676
675
pub fn module ( & self ) -> & ' hir Mod < ' hir > {
677
676
if let Some ( OwnerNode :: Crate ( m) ) = self . owners [ CRATE_DEF_ID ] { m } else { panic ! ( ) }
678
677
}
@@ -698,52 +697,6 @@ impl Crate<'hir> {
698
697
}
699
698
}
700
699
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
-
747
700
/// A block of statements `{ .. }`, which may have a label (in this case the
748
701
/// `targeted_by_break` field will be `true`) and may be `unsafe` by means of
749
702
/// the `rules` being anything but `DefaultBlock`.
0 commit comments