Skip to content

Commit d383fd9

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 9c522b6 commit d383fd9

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
@@ -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

@@ -537,27 +537,12 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
537537
private_dep: Option<bool>,
538538
origin: CrateOrigin<'_>,
539539
) -> bool {
540-
// Standard library crates are never private.
541-
if STDLIB_STABLE_CRATES.contains(&name) {
542-
tracing::info!("returning false for {name} is private");
543-
return false;
544-
}
545-
546540
let extern_private = self.sess.opts.externs.get(name.as_str()).map(|e| e.is_private_dep);
547541

548542
if matches!(origin, CrateOrigin::Injected) {
549543
return true;
550544
}
551545

552-
// Any descendants of `std` should be private. These crates are usually not marked
553-
// private in metadata, so we ignore that field.
554-
if extern_private.is_none()
555-
&& let Some(dep) = origin.dep_root()
556-
&& STDLIB_STABLE_CRATES.contains(&dep.name)
557-
{
558-
return true;
559-
}
560-
561546
match (extern_private, private_dep) {
562547
// Explicit non-private via `--extern`, explicit non-private from metadata, or
563548
// unspecified with default to public.

0 commit comments

Comments
 (0)