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