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

diagnostics: exclude indirect private deps from trait impl suggest #111076

Conversation

notriddle
Copy link
Contributor

@notriddle notriddle commented May 1, 2023

Fixes #88696

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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 May 1, 2023
@rustbot
Copy link
Collaborator

rustbot commented May 1, 2023

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@notriddle notriddle marked this pull request as draft May 1, 2023 19:17
@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/silence-private-dep-trait-impl-suggestions branch from 8453818 to 8bf782f Compare May 1, 2023 19:33
@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/silence-private-dep-trait-impl-suggestions branch 2 times, most recently from e96a4b5 to 60ed017 Compare May 1, 2023 20:18
@notriddle notriddle marked this pull request as ready for review May 1, 2023 20:18
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/silence-private-dep-trait-impl-suggestions branch 2 times, most recently from 06f0be5 to 2bffa4c Compare May 1, 2023 22:41
Copy link
Contributor

@b-naber b-naber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach seems better than the previous one, but I'm not sure I fully understand what you're doing here since I don't really know the code in rustc_metadata.

@@ -111,7 +111,7 @@ pub(crate) struct CrateMetadata {
source: Lrc<CrateSource>,
/// Whether or not this crate should be consider a private dependency
/// for purposes of the 'exported_private_dependencies' lint
private_dep: bool,
private_dep: Lock<bool>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AtomicBool should suffice here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the comment?

@b-naber
Copy link
Contributor

b-naber commented May 7, 2023

r? rust-lang/compiler

@rustbot rustbot assigned oli-obk and unassigned b-naber May 7, 2023
@@ -111,7 +111,7 @@ pub(crate) struct CrateMetadata {
source: Lrc<CrateSource>,
/// Whether or not this crate should be consider a private dependency
/// for purposes of the 'exported_private_dependencies' lint
private_dep: bool,
private_dep: Lock<bool>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the comment?

// | Yes | No | No | !(true && !false) |
// | No | No | Yes | !(false && !false) |
!(self.is_private_dep(key)
&& !self.extern_crate(key.as_def_id()).expect("crate must exist").is_direct())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not what None means. See the doc on extern_crate field in rustc_metadata::rmeta::decoder::CrateMetadata.

@bors
Copy link
Collaborator

bors commented May 8, 2023

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

@notriddle notriddle force-pushed the notriddle/silence-private-dep-trait-impl-suggestions branch from 8482f07 to 394d31c Compare May 8, 2023 21:31
@rust-log-analyzer

This comment has been minimized.

@notriddle notriddle force-pushed the notriddle/silence-private-dep-trait-impl-suggestions branch from 97264e2 to fcee118 Compare May 8, 2023 21:57
@rustbot rustbot added this to the 1.72.0 milestone May 31, 2023
@notriddle notriddle deleted the notriddle/silence-private-dep-trait-impl-suggestions branch May 31, 2023 16:56
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ad8304a): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 14
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 643.343s -> 642.658s (-0.11%)

@danakj
Copy link
Contributor

danakj commented Jun 2, 2023

Hey, it looks like this PR breaks building the toolchain with the Cargo binaries specified in https://github.com/rust-lang/rust/blob/master/src/stage0.json#L28-L83

The public-dependencies feature is a nightly feature, but the Cargo given there is beta.

linux_upload_rust log:
 Downloading https://chrome-infra-packages.appspot.com/dl/infra/3pp/static_libs/openssl/linux-amd64/+/version:2@1.1.1j.chromium.2 .......... Done.
 Downloading https://static.rust-lang.org/dist/2023-05-30/cargo-beta-x86_64-unknown-linux-gnu.tar.gz .......... Done.
 Running git submodule update --init --recursive --depth 1
 Running /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/cargo-beta-x86_64-unknown-linux-gnu/cargo/bin/cargo vendor --locked --versioned-dirs --sync ./src/tools/cargo/Cargo.toml --sync ./src/tools/rust-analyzer/Cargo.toml --sync ./compiler/rustc_codegen_cranelift/Cargo.toml --sync ./src/bootstrap/Cargo.toml
 error: failed to load manifest for workspace member `/b/s/w/ir/cache/builder/src/third_party/rust_src/src/library/std`
 
 Caused by:
   failed to parse manifest at `/b/s/w/ir/cache/builder/src/third_party/rust_src/src/library/std/Cargo.toml`
 
 Caused by:
   the cargo feature `public-dependency` requires a nightly version of Cargo, but this is the `beta` channel
   See https://doc.rust-lang.org/book/appendix-07-nightly-rust.html for more information about Rust release channels.
   See https://doc.rust-lang.org/beta/cargo/reference/unstable.html#public-dependency for more information about using this feature.
 Failed.

How do we continue building the toolchain in this state?

Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1450894

@danakj
Copy link
Contributor

danakj commented Jun 2, 2023

Maybe answering for myself but it looks like specifying RUSTC_BOOTSTRAP=1 in the environment is required now. Is this something that will stay and cover any other nightly stuff going forward?

@bjorn3
Copy link
Member

bjorn3 commented Jun 12, 2023

I'm not sure RUSTC_BOOTSTRAP should be suggested. The cargo version used to vendor may not support public-dependency or it may have an incompatible implementation. By the way I opened #112391 a couple of days ago as I didn't notice this discussion.

onur-ozkan added a commit to onur-ozkan/rust that referenced this pull request Nov 9, 2023
Since rust-lang#111076 enables
unstable cargo feature (`public-dependency`), we need to ensure
that unstable features are enabled before reading libstd Cargo.toml.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 10, 2023
enable unstable feature on `x clean [PATH]`

Since rust-lang#111076 enables unstable cargo feature (`public-dependency`), we need to ensure that unstable features are enabled before reading libstd Cargo.toml.

Fixes rust-lang#117762

cc `@Nilstrieb`
tgross35 added a commit to tgross35/rust that referenced this pull request Jan 28, 2025
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
tgross35 added a commit to tgross35/rust that referenced this pull request Jan 29, 2025
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
tgross35 added a commit to tgross35/rust that referenced this pull request Jan 30, 2025
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
tgross35 added a commit to tgross35/rust that referenced this pull request Jan 30, 2025
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
tgross35 added a commit to tgross35/rust that referenced this pull request Jan 30, 2025
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
tgross35 added a commit to tgross35/rust that referenced this pull request Feb 20, 2025
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
tgross35 added a commit to tgross35/rust that referenced this pull request Feb 20, 2025
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
tgross35 added a commit to tgross35/rust that referenced this pull request Feb 20, 2025
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
tgross35 added a commit to tgross35/rust that referenced this pull request Feb 20, 2025
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
tgross35 added a commit to tgross35/rust that referenced this pull request Feb 21, 2025
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
bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request Feb 24, 2025
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/rust#111076
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this pull request Mar 6, 2025
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
github-actions bot pushed a commit to thanhnguyen-aws/verify-rust-std that referenced this pull request Mar 6, 2025
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
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this pull request Mar 11, 2025
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
github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this pull request Mar 11, 2025
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
github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request Mar 11, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

Suggestions for miniz_oxide included in diagnostics in crate with no dependencies