@@ -7,7 +7,7 @@ use rustc_ast as ast;
77use rustc_data_structures:: captures:: Captures ;
88use rustc_data_structures:: fx:: FxHashMap ;
99use rustc_data_structures:: svh:: Svh ;
10- use rustc_data_structures:: sync:: { Lock , LockGuard , Lrc , OnceCell } ;
10+ use rustc_data_structures:: sync:: { AppendOnlyVec , Lock , Lrc , OnceCell } ;
1111use rustc_data_structures:: unhash:: UnhashMap ;
1212use rustc_expand:: base:: { SyntaxExtension , SyntaxExtensionKind } ;
1313use rustc_expand:: proc_macro:: { AttrProcMacro , BangProcMacro , DeriveProcMacro } ;
@@ -109,7 +109,7 @@ pub(crate) struct CrateMetadata {
109109 /// IDs as they are seen from the current compilation session.
110110 cnum_map : CrateNumMap ,
111111 /// Same ID set as `cnum_map` plus maybe some injected crates like panic runtime.
112- dependencies : Lock < Vec < CrateNum > > ,
112+ dependencies : AppendOnlyVec < CrateNum > ,
113113 /// How to link (or not link) this crate to the currently compiled crate.
114114 dep_kind : Lock < CrateDepKind > ,
115115 /// Filesystem location of this crate.
@@ -1594,7 +1594,7 @@ impl CrateMetadata {
15941594 . collect ( ) ;
15951595 let alloc_decoding_state =
15961596 AllocDecodingState :: new ( root. interpret_alloc_index . decode ( & blob) . collect ( ) ) ;
1597- let dependencies = Lock :: new ( cnum_map. iter ( ) . cloned ( ) . collect ( ) ) ;
1597+ let dependencies = cnum_map. iter ( ) . copied ( ) . collect ( ) ;
15981598
15991599 // Pre-decode the DefPathHash->DefIndex table. This is a cheap operation
16001600 // that does not copy any data. It just does some data verification.
@@ -1634,12 +1634,12 @@ impl CrateMetadata {
16341634 cdata
16351635 }
16361636
1637- pub ( crate ) fn dependencies ( & self ) -> LockGuard < ' _ , Vec < CrateNum > > {
1638- self . dependencies . borrow ( )
1637+ pub ( crate ) fn dependencies ( & self ) -> impl Iterator < Item = CrateNum > + ' _ {
1638+ self . dependencies . iter ( )
16391639 }
16401640
16411641 pub ( crate ) fn add_dependency ( & self , cnum : CrateNum ) {
1642- self . dependencies . borrow_mut ( ) . push ( cnum) ;
1642+ self . dependencies . push ( cnum) ;
16431643 }
16441644
16451645 pub ( crate ) fn update_extern_crate ( & self , new_extern_crate : ExternCrate ) -> bool {
0 commit comments