Skip to content

Commit 3fc0f76

Browse files
committed
Force compiler_builtins to be a private dependency
`compiler_builtins` is an injected dependency, introduced in AST as `extern crate compiler_builtins as _`. This means that `is_private_dep` has no way of knowing this should be private. To get around this, always mark `compiler_builtins` private. The items in this crate are never used
1 parent b33490f commit 3fc0f76

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

compiler/rustc_builtin_macros/src/standard_library_imports.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ pub fn inject(
5353
//
5454
// FIXME(#113634) We should inject this during post-processing like
5555
// we do for the panic runtime, profiler runtime, etc.
56+
//
57+
// See also `is_private_dep` within `rustc_metadata`.
5658
cx.item(
5759
span,
5860
Ident::new(kw::Underscore, ident_span),

compiler/rustc_metadata/src/creader.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,13 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
402402
/// command parameter is set to `public-dependency`
403403
fn is_private_dep(&self, name: Symbol, private_dep: Option<bool>) -> bool {
404404
let extern_private = self.sess.opts.externs.get(name.as_str()).map(|e| e.is_private_dep);
405+
if name == sym::compiler_builtins {
406+
// compiler_builtins is a private implementation detail and should never show up in
407+
// diagnostics. See also the note referencing #113634 in
408+
// `rustc_builtin_macros::...::inject`.
409+
return true;
410+
}
411+
405412
match (extern_private, private_dep) {
406413
// Explicit non-private via `--extern`, explicit non-private from metadata, or
407414
// unspecified with default to public.

compiler/rustc_resolve/src/build_reduced_graph.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
730730
/// Constructs the reduced graph for one item.
731731
fn build_reduced_graph_for_item(&mut self, item: &'a Item) {
732732
let parent_scope = &self.parent_scope;
733+
let ps2 = self.parent_scope.clone();
733734
let parent = parent_scope.module;
734735
let expansion = parent_scope.expansion;
735736
let ident = item.ident;

0 commit comments

Comments
 (0)