Inject compiler_builtins during postprocessing and ensure it is made private#135501
Inject compiler_builtins during postprocessing and ensure it is made private#135501bors merged 7 commits intorust-lang:masterfrom
compiler_builtins during postprocessing and ensure it is made private#135501Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
The test still fails, and I cannot chase down how r? bjorn3 |
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
|
Maybe you can make the code that checks if a crate is private for diagnostics check if all paths to reach a dependency are private and if so consider the dependency to be private even if the direct dependent crate doesn't mark it as private? |
|
Do you mean to do that as part of the I am apparently missing some path since exposing more traits in builtins seems to leak into diagnostics still #135560. Haven't looked into it yet, but I suppose that might fix it. |
Yes |
560b580 to
ee49697
Compare
|
It looks like the reason |
|
This looks like a possibility rust/compiler/rustc_builtin_macros/src/standard_library_imports.rs Lines 49 to 61 in 77a4553 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b32d8d1 to
7a6a6cd
Compare
This comment has been minimized.
This comment has been minimized.
Currently, marking a dependency private does not automatically make all its child dependencies private. Resolve this by making its children private by default as well. [1]: rust-lang#135501 (comment)
Currently, marking a dependency private does not automatically make all its child dependencies private. Resolve this by making its children private by default as well. [1]: rust-lang#135501 (comment)
5354933 to
9c9ea48
Compare
|
@bors try |
compiler_builtins not being treated as private; clean up #135278
…, r=<try> Resolve `compiler_builtins` not being treated as private; clean up rust-lang#135278 Follow up of rust-lang#135278 try-job: test-various
This comment was marked as outdated.
This comment was marked as outdated.
|
☀️ Try build successful - checks-actions |
|
@rustbot ready |
|
Looks like you still have the DO NOT MERGE commit. |
`compiler_builtins` is currently injected as `extern crate compiler_builtins as _`. This has made gating via diagnostics difficult because it appears in the crate graph as a non-private dependency, and there isn't an easy way to differentiate between the injected AST and user-specified `extern crate compiler_builtins`. Resolve this by injecting `compiler_builtins` during postprocessing rather than early in the AST. Most of the time this isn't even needed because it shows up in `std` or `core`'s crate graph, but injection is still needed to ensure `#![no_core]` works correctly. A similar change was attempted at [1] but this encountered errors building `proc_macro` and `rustc-std-workspace-std`. Similar failures showed up while working on this patch, which were traced back to `compiler_builtins` showing up in the graph twice (once via dependency and once via injection). This is resolved by not injecting if a `#![compiler_builtins]` crate already exists. [1]: rust-lang#113634
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`.
In [1], most dependencies of `std` and other sysroot crates were marked private, but this did not happen for `alloc` and `test`. Update these here, marking public standard library crates as the only non-private dependencies. [1]: rust-lang#111076
Currently, marking a dependency private does not automatically make all its child dependencies private. Resolve this by making its children private by default as well. This also resolves some FIXMEs for tests that are intended to fail but previously passed. [1]: rust-lang#135501 (comment)
The recent fixes to private dependencies exposed some cases in the UEFI module where private dependencies are exposed in a public interface. These do not need to be crate-public, so change them to `pub(crate)`.
0827f25 to
9392580
Compare
|
I kept that in case a retest with further changes was needed. Dropped it now and squashed the last fixup. |
|
@bors r+ |
…te, r=bjorn3 Inject `compiler_builtins` during postprocessing and ensure it is made private Follow up of rust-lang#135278 Do the following: * Inject `compiler_builtins` during postprocessing, rather than injecting `extern crate compiler_builtins as _` into the AST * Do not make dependencies of `std` private by default (this was added in rust-lang#135278) * Make sure sysroot crates correctly mark their dependencies private/public * Ensure that marking a dependency private makes its dependents private by default as well, unless otherwise specified * Do the `compiler_builtins` update that has been blocked on this There is more detail in the commit messages. This includes the changes I was working on in rust-lang#136226. try-job: test-various try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: i686-mingw-1 try-job: i686-mingw-2
…te, r=bjorn3 Inject `compiler_builtins` during postprocessing and ensure it is made private Follow up of rust-lang#135278 Do the following: * Inject `compiler_builtins` during postprocessing, rather than injecting `extern crate compiler_builtins as _` into the AST * Do not make dependencies of `std` private by default (this was added in rust-lang#135278) * Make sure sysroot crates correctly mark their dependencies private/public * Ensure that marking a dependency private makes its dependents private by default as well, unless otherwise specified * Do the `compiler_builtins` update that has been blocked on this There is more detail in the commit messages. This includes the changes I was working on in rust-lang#136226. try-job: test-various try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: i686-mingw-1 try-job: i686-mingw-2
Follow up of #135278
Do the following:
compiler_builtinsduring postprocessing, rather than injectingextern crate compiler_builtins as _into the ASTstdprivate by default (this was added in Exclude dependencies ofstdfor diagnostics #135278)compiler_builtinsupdate that has been blocked on thisThere is more detail in the commit messages. This includes the changes I was working on in #136226.
try-job: test-various
try-job: x86_64-msvc-1
try-job: x86_64-msvc-2
try-job: i686-mingw-1
try-job: i686-mingw-2
r? @bjorn3