@@ -7,7 +7,7 @@ use rustc_ast as ast;
7
7
use rustc_data_structures:: captures:: Captures ;
8
8
use rustc_data_structures:: fx:: FxHashMap ;
9
9
use 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 } ;
11
11
use rustc_data_structures:: unhash:: UnhashMap ;
12
12
use rustc_expand:: base:: { SyntaxExtension , SyntaxExtensionKind } ;
13
13
use rustc_expand:: proc_macro:: { AttrProcMacro , BangProcMacro , DeriveProcMacro } ;
@@ -109,7 +109,7 @@ pub(crate) struct CrateMetadata {
109
109
/// IDs as they are seen from the current compilation session.
110
110
cnum_map : CrateNumMap ,
111
111
/// Same ID set as `cnum_map` plus maybe some injected crates like panic runtime.
112
- dependencies : Lock < Vec < CrateNum > > ,
112
+ dependencies : AppendOnlyVec < CrateNum > ,
113
113
/// How to link (or not link) this crate to the currently compiled crate.
114
114
dep_kind : Lock < CrateDepKind > ,
115
115
/// Filesystem location of this crate.
@@ -1594,7 +1594,7 @@ impl CrateMetadata {
1594
1594
. collect ( ) ;
1595
1595
let alloc_decoding_state =
1596
1596
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 ( ) ;
1598
1598
1599
1599
// Pre-decode the DefPathHash->DefIndex table. This is a cheap operation
1600
1600
// that does not copy any data. It just does some data verification.
@@ -1634,12 +1634,12 @@ impl CrateMetadata {
1634
1634
cdata
1635
1635
}
1636
1636
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 ( )
1639
1639
}
1640
1640
1641
1641
pub ( crate ) fn add_dependency ( & self , cnum : CrateNum ) {
1642
- self . dependencies . borrow_mut ( ) . push ( cnum) ;
1642
+ self . dependencies . push ( cnum) ;
1643
1643
}
1644
1644
1645
1645
pub ( crate ) fn update_extern_crate ( & self , new_extern_crate : ExternCrate ) -> bool {
0 commit comments