@@ -9,7 +9,7 @@ use rustc_data_structures::captures::Captures;
9
9
use rustc_data_structures:: fx:: FxHashMap ;
10
10
use rustc_data_structures:: owned_slice:: OwnedSlice ;
11
11
use rustc_data_structures:: svh:: Svh ;
12
- use rustc_data_structures:: sync:: { AppendOnlyVec , Lock , Lrc , OnceCell } ;
12
+ use rustc_data_structures:: sync:: { AppendOnlyVec , AtomicBool , Lock , Lrc , OnceCell } ;
13
13
use rustc_data_structures:: unhash:: UnhashMap ;
14
14
use rustc_expand:: base:: { SyntaxExtension , SyntaxExtensionKind } ;
15
15
use rustc_expand:: proc_macro:: { AttrProcMacro , BangProcMacro , DeriveProcMacro } ;
@@ -40,6 +40,7 @@ use proc_macro::bridge::client::ProcMacro;
40
40
use std:: iter:: TrustedLen ;
41
41
use std:: num:: NonZeroUsize ;
42
42
use std:: path:: Path ;
43
+ use std:: sync:: atomic:: Ordering ;
43
44
use std:: { io, iter, mem} ;
44
45
45
46
pub ( super ) use cstore_impl:: provide;
@@ -112,9 +113,10 @@ pub(crate) struct CrateMetadata {
112
113
dep_kind : Lock < CrateDepKind > ,
113
114
/// Filesystem location of this crate.
114
115
source : Lrc < CrateSource > ,
115
- /// Whether or not this crate should be consider a private dependency
116
- /// for purposes of the 'exported_private_dependencies' lint
117
- private_dep : bool ,
116
+ /// Whether or not this crate should be consider a private dependency.
117
+ /// Used by the 'exported_private_dependencies' lint, and for determining
118
+ /// whether to emit suggestions that reference this crate.
119
+ private_dep : AtomicBool ,
118
120
/// The hash for the host proc macro. Used to support `-Z dual-proc-macro`.
119
121
host_hash : Option < Svh > ,
120
122
@@ -701,12 +703,13 @@ impl MetadataBlob {
701
703
writeln ! ( out, "=External Dependencies=" ) ?;
702
704
703
705
for ( i, dep) in root. crate_deps . decode ( self ) . enumerate ( ) {
704
- let CrateDep { name, extra_filename, hash, host_hash, kind } = dep;
706
+ let CrateDep { name, extra_filename, hash, host_hash, kind, is_private } = dep;
705
707
let number = i + 1 ;
706
708
707
709
writeln ! (
708
710
out,
709
- "{number} {name}{extra_filename} hash {hash} host_hash {host_hash:?} kind {kind:?}"
711
+ "{number} {name}{extra_filename} hash {hash} host_hash {host_hash:?} kind {kind:?} {privacy}" ,
712
+ privacy = if is_private { "private" } else { "public" }
710
713
) ?;
711
714
}
712
715
write ! ( out, "\n " ) ?;
@@ -1624,7 +1627,7 @@ impl CrateMetadata {
1624
1627
dependencies,
1625
1628
dep_kind : Lock :: new ( dep_kind) ,
1626
1629
source : Lrc :: new ( source) ,
1627
- private_dep,
1630
+ private_dep : AtomicBool :: new ( private_dep ) ,
1628
1631
host_hash,
1629
1632
extern_crate : Lock :: new ( None ) ,
1630
1633
hygiene_context : Default :: default ( ) ,
@@ -1672,6 +1675,10 @@ impl CrateMetadata {
1672
1675
self . dep_kind . with_lock ( |dep_kind| * dep_kind = f ( * dep_kind) )
1673
1676
}
1674
1677
1678
+ pub ( crate ) fn update_and_private_dep ( & self , private_dep : bool ) {
1679
+ self . private_dep . fetch_and ( private_dep, Ordering :: SeqCst ) ;
1680
+ }
1681
+
1675
1682
pub ( crate ) fn required_panic_strategy ( & self ) -> Option < PanicStrategy > {
1676
1683
self . root . required_panic_strategy
1677
1684
}
0 commit comments