Skip to content

Commit cb1d076

Browse files
committed
Partially revert ed63539 ("Mark dependencies ... private by default")
Remove the portion of ed63539 that automatically sets crates private based on whether they are dependencies of `std`. Instead, this is controlled by dependency configuration in `Cargo.toml`.
1 parent 1412cfc commit cb1d076

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

compiler/rustc_metadata/src/creader.rs

+1-17
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use rustc_session::lint::{self, BuiltinLintDiag};
3232
use rustc_session::output::validate_crate_name;
3333
use rustc_session::search_paths::PathKind;
3434
use rustc_span::edition::Edition;
35-
use rustc_span::{DUMMY_SP, Ident, STDLIB_STABLE_CRATES, Span, Symbol, sym};
35+
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
3636
use rustc_target::spec::{PanicStrategy, Target, TargetTuple};
3737
use tracing::{debug, info, trace};
3838

@@ -533,27 +533,11 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
533533
private_dep: Option<bool>,
534534
origin: CrateOrigin<'_>,
535535
) -> bool {
536-
// Standard library crates are never private.
537-
if STDLIB_STABLE_CRATES.contains(&name) {
538-
tracing::info!("returning false for {name} is private");
539-
return false;
540-
}
541-
542536
if matches!(origin, CrateOrigin::Injected) {
543537
return true;
544538
}
545539

546540
let extern_private = self.sess.opts.externs.get(name.as_str()).map(|e| e.is_private_dep);
547-
548-
// Any descendants of `std` should be private. These crates are usually not marked
549-
// private in metadata, so we ignore that field.
550-
if extern_private.is_none()
551-
&& let Some(dep) = origin.dep_root()
552-
&& STDLIB_STABLE_CRATES.contains(&dep.name)
553-
{
554-
return true;
555-
}
556-
557541
match (extern_private, private_dep) {
558542
// Explicit non-private via `--extern`, explicit non-private from metadata, or
559543
// unspecified with default to public.

0 commit comments

Comments
 (0)