Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Mark sysroot dependencies private #135501

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tgross35
Copy link
Contributor

Follow up of #135278

r? @bjorn3

@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2025

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 14, 2025
@tgross35 tgross35 marked this pull request as draft January 14, 2025 20:07
@tgross35
Copy link
Contributor Author

The test still fails, and I cannot chase down how gimli is getting into the sysroot as non-private. Locally I am testing with submodules updated too.

r? bjorn3

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-18 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#22 exporting to docker image format
#22 sending tarball 28.6s done
#22 DONE 35.0s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-18]
debug: `DISABLE_CI_RUSTC_IF_INCOMPATIBLE` configured.
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-18', '--enable-llvm-link-shared', '--set', 'rust.randomize-layout=true', '--set', 'rust.thin-lto-import-instr-limit=10', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--set', 'rust.lld=false', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-18/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.randomize-layout := True
configure: rust.thin-lto-import-instr-limit := 10
---
diff of stderr:

25   --> $DIR/sysroot-private.rs:21:31
26    |
27 LL | type AssociatedTy = dyn Trait<ExpressionStack = i32, Bar = i32>;
-    |                               ^^^^^^^^^^^^^^^ help: `Trait` has the following associated type: `Bar`
+    |                               ^^^^^^^^^^^^^^^ there is an associated type `ExpressionStack` in the trait `gimli::read::op::EvaluationStorage`
30 error[E0425]: cannot find function `memchr2` in this scope
31   --> $DIR/sysroot-private.rs:39:5



The actual stderr differed from the expected stderr.
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args privacy/sysroot-private.rs`

error in revision `default`: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/privacy/sysroot-private.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--cfg" "default" "--check-cfg" "cfg(test,FALSE,default,rustc_private_enabled)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/privacy/sysroot-private.default" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers"
--- stderr -------------------------------
error[E0405]: cannot find trait `Equivalent` in this scope
##[error]  --> /checkout/tests/ui/privacy/sysroot-private.rs:26:18
   |
   |
LL | trait Trait2<K>: Equivalent<K> {}

error[E0412]: cannot find type `K` in this scope
##[error]  --> /checkout/tests/ui/privacy/sysroot-private.rs:31:35
   |
   |
LL | fn trait_member<T>(val: &T, key: &K) -> bool {
   |                 |
   |                 similarly named type parameter `T` defined here
   |
help: a type parameter with a similar name exists
help: a type parameter with a similar name exists
   |
LL | fn trait_member<T>(val: &T, key: &T) -> bool {
help: you might be missing a type parameter
   |
   |
LL | fn trait_member<T, K>(val: &T, key: &K) -> bool {

error[E0220]: associated type `ExpressionStack` not found for `Trait`
##[error]  --> /checkout/tests/ui/privacy/sysroot-private.rs:21:31
   |
   |
LL | type AssociatedTy = dyn Trait<ExpressionStack = i32, Bar = i32>;
   |                               ^^^^^^^^^^^^^^^ there is an associated type `ExpressionStack` in the trait `gimli::read::op::EvaluationStorage`
error[E0425]: cannot find function `memchr2` in this scope
##[error]  --> /checkout/tests/ui/privacy/sysroot-private.rs:39:5
   |
   |
LL |     memchr2(b'a', b'b', buf)

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0220, E0405, E0412, E0425.

@bors
Copy link
Contributor

bors commented Jan 15, 2025

☔ The latest upstream changes (presumably #135180) made this pull request unmergeable. Please resolve the merge conflicts.

@bjorn3
Copy link
Member

bjorn3 commented Jan 20, 2025

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?

@tgross35
Copy link
Contributor Author

Do you mean to do that as part of the is_private_dep check?

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.

@bjorn3
Copy link
Member

bjorn3 commented Jan 23, 2025

Do you mean to do that as part of the is_private_dep check?

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants