@@ -4,7 +4,7 @@ use crate::rmeta::*;
44use crate :: rmeta:: table:: { FixedSizeEncoding , Table } ;
55
66use rustc_index:: vec:: { Idx , IndexVec } ;
7- use rustc_data_structures:: sync:: { Lrc , Lock , Once , AtomicCell } ;
7+ use rustc_data_structures:: sync:: { Lrc , Lock , LockGuard , Once , AtomicCell } ;
88use rustc:: hir:: map:: { DefKey , DefPath , DefPathData , DefPathHash } ;
99use rustc:: hir:: map:: definitions:: DefPathTable ;
1010use rustc:: hir;
@@ -97,7 +97,7 @@ crate struct CrateMetadata {
9797 /// IDs as they are seen from the current compilation session.
9898 cnum_map : CrateNumMap ,
9999 /// Same ID set as `cnum_map` plus maybe some injected crates like panic runtime.
100- crate dependencies : Lock < Vec < CrateNum > > ,
100+ dependencies : Lock < Vec < CrateNum > > ,
101101 /// How to link (or not link) this crate to the currently compiled crate.
102102 crate dep_kind : Lock < DepKind > ,
103103 /// Filesystem location of this crate.
@@ -1517,6 +1517,14 @@ impl<'a, 'tcx> CrateMetadata {
15171517
15181518 dep_node_index
15191519 }
1520+
1521+ crate fn dependencies ( & self ) -> LockGuard < ' _ , Vec < CrateNum > > {
1522+ self . dependencies . borrow ( )
1523+ }
1524+
1525+ crate fn add_dependency ( & self , cnum : CrateNum ) {
1526+ self . dependencies . borrow_mut ( ) . push ( cnum) ;
1527+ }
15201528}
15211529
15221530// Cannot be implemented on 'ProcMacro', as libproc_macro
0 commit comments