Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 49e814b

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 55facbb commit 49e814b

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

compiler/rustc_metadata/src/creader.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use rustc_session::lint::{self, BuiltinLintDiag};
2929
use rustc_session::output::validate_crate_name;
3030
use rustc_session::search_paths::PathKind;
3131
use rustc_span::edition::Edition;
32-
use rustc_span::{DUMMY_SP, Ident, STDLIB_STABLE_CRATES, Span, Symbol, sym};
32+
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, sym};
3333
use rustc_target::spec::{PanicStrategy, Target, TargetTuple};
3434
use tracing::{debug, info, trace};
3535

@@ -444,27 +444,12 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
444444
private_dep: Option<bool>,
445445
origin: CrateOrigin<'_>,
446446
) -> bool {
447-
// Standard library crates are never private.
448-
if STDLIB_STABLE_CRATES.contains(&name) {
449-
tracing::info!("returning false for {name} is private");
450-
return false;
451-
}
452-
453447
let extern_private = self.sess.opts.externs.get(name.as_str()).map(|e| e.is_private_dep);
454448

455449
if matches!(origin, CrateOrigin::Injected) {
456450
return true;
457451
}
458452

459-
// Any descendants of `std` should be private. These crates are usually not marked
460-
// private in metadata, so we ignore that field.
461-
if extern_private.is_none()
462-
&& let Some(dep) = origin.dep_root()
463-
&& STDLIB_STABLE_CRATES.contains(&dep.name)
464-
{
465-
return true;
466-
}
467-
468453
match (extern_private, private_dep) {
469454
// Explicit non-private via `--extern`, explicit non-private from metadata, or
470455
// unspecified with default to public.

0 commit comments

Comments
 (0)