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
src/bootstrap/metadata.rs Show resolved Hide resolved
src/tools/rust-installer/gen-installer.sh Show resolved Hide resolved
src/tools/rust-installer/make-tarballs.sh Show resolved Hide resolved
src/tools/tidy/src/main.rs Show resolved Hide resolved
@@ -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?

compiler/rustc_metadata/src/creader.rs Outdated Show resolved Hide resolved
// | 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.

library/std/tests/common/mod.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

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
@bors
Copy link
Contributor

bors commented May 25, 2023

⌛ Testing commit 5fb752b with merge ee838d0ea3588d5441eb64196c145322243b5d00...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 25, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 25, 2023
@notriddle notriddle requested a review from lukas-code May 29, 2023 21:54
@cjgillot
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented May 31, 2023

📌 Commit 52bd82f has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 31, 2023
@bors
Copy link
Contributor

bors commented May 31, 2023

⌛ Testing commit 52bd82f with merge ad8304a...

@bors
Copy link
Contributor

bors commented May 31, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing ad8304a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 31, 2023
@bors bors merged commit ad8304a into rust-lang:master May 31, 2023
@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`
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