about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTrevor Gross <tmgross@umich.edu>2025-01-14 20:04:59 +0000
committerTrevor Gross <tmgross@umich.edu>2025-02-21 17:37:03 +0000
commitcb1d076d42e9285488436688b8879225ab6db80e (patch)
treef952a5bbe4d7fa3afd3fee60ebc1f04e1f12e8c9
parent1412cfc987b2b6691367c2e7428c083bb207d722 (diff)
Partially revert ed63539282 ("Mark dependencies ... private by default")
Remove the portion of ed63539282 that automatically sets crates private
based on whether they are dependencies of `std`. Instead, this is
controlled by dependency configuration in `Cargo.toml`.
-rw-r--r--compiler/rustc_metadata/src/creader.rs18
1 files changed, 1 insertions, 17 deletions
diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs
index a935bc3662d..b94e32e17d4 100644
--- a/compiler/rustc_metadata/src/creader.rs
+++ b/compiler/rustc_metadata/src/creader.rs
@@ -32,7 +32,7 @@ use rustc_session::lint::{self, BuiltinLintDiag};
 use rustc_session::output::validate_crate_name;
 use rustc_session::search_paths::PathKind;
 use rustc_span::edition::Edition;
-use rustc_span::{DUMMY_SP, Ident, STDLIB_STABLE_CRATES, Span, Symbol, sym};
+use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
 use rustc_target::spec::{PanicStrategy, Target, TargetTuple};
 use tracing::{debug, info, trace};
 
@@ -533,27 +533,11 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
         private_dep: Option<bool>,
         origin: CrateOrigin<'_>,
     ) -> bool {
-        // Standard library crates are never private.
-        if STDLIB_STABLE_CRATES.contains(&name) {
-            tracing::info!("returning false for {name} is private");
-            return false;
-        }
-
         if matches!(origin, CrateOrigin::Injected) {
             return true;
         }
 
         let extern_private = self.sess.opts.externs.get(name.as_str()).map(|e| e.is_private_dep);
-
-        // Any descendants of `std` should be private. These crates are usually not marked
-        // private in metadata, so we ignore that field.
-        if extern_private.is_none()
-            && let Some(dep) = origin.dep_root()
-            && STDLIB_STABLE_CRATES.contains(&dep.name)
-        {
-            return true;
-        }
-
         match (extern_private, private_dep) {
             // Explicit non-private via `--extern`, explicit non-private from metadata, or
             // unspecified with default to public.