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

Implement public/private dependency feature #57586

Merged
merged 22 commits into from
Feb 1, 2019

Conversation

Aaron1011
Copy link
Member

@Aaron1011 Aaron1011 commented Jan 14, 2019

Implements #44663

The core implementation is done - however, there are a few issues that still need to be resolved:

  • The EXTERNAL_PRIVATE_DEPENDENCY lint currently does notthing when the public_private_dependencies is not enabled. Should mentioning the lint (in an allow or deny attribute) be an error if the feature is not enabled? (Resolved- the feature was removed)
  • Crates with the name core and std are always marked public, without the need to explcitily specify them on the command line. Is this what we want to do? Do we want to allowno_std/no_core crates to explicitly control this in some way? (Resolved - private crates are now explicitly specified)
  • Should I add additional UI tests? (Resolved - added more tests)
  • Does it make sense to be able to allow/deny the EXTERNAL_PRIVATE_DEPENDENCY on an individual item? (Resolved - this is implemented)

@rust-highfive
Copy link
Collaborator

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 14, 2019
@Aaron1011
Copy link
Member Author

r? @alexcrichton

@petrochenkov petrochenkov self-assigned this Jan 14, 2019
if !self.tcx.features().public_private_dependencies {
return false
}
let ret = self.required_visibility == ty::Visibility::Public &&
Copy link
Contributor

Choose a reason for hiding this comment

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

This will report things used in pub, but unreachable items, e.g.

mod private_details {
    pub fn details() -> PrivateDep { ... } // Will be linted
}

, but that's probably okay for a start.

@petrochenkov petrochenkov removed their assignment Jan 16, 2019
@Aaron1011 Aaron1011 force-pushed the feature/pub-priv-dep branch from 0cd5623 to debcece Compare January 21, 2019 01:18
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:039df983:start=1548033551792912346,finish=1548033554187915130,duration=2395002784
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[00:22:31] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:22:31] expected success, got: exit code: 101
[00:22:31] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:22:31] Build completed unsuccessfully in 0:18:33
[00:22:31] make: *** [all] Error 1
[00:22:31] Makefile:18: recipe for target 'all' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:23b0df10
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Jan 21 01:41:56 UTC 2019

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@estebank
Copy link
Contributor

r? @petrochenkov

@petrochenkov
Copy link
Contributor

@estebank
The needs a review from someone from Cargo side, that's why @alexcrichton was assigned.

Otherwise, comments beside #57586 (comment) still need to be addressed.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 22, 2019
@alexcrichton
Copy link
Member

This is looking good to me, it is a lot smaller than I was expecting!

Were there particular design questions that I should weigh in on? Or is it just technical details?

@petrochenkov
Copy link
Contributor

@alexcrichton

Were there particular design questions that I should weigh in on?

#57586 (comment)

@bors
Copy link
Contributor

bors commented Jan 26, 2019

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

@Aaron1011 Aaron1011 force-pushed the feature/pub-priv-dep branch from 9eda2dd to fb74e48 Compare January 29, 2019 21:12
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
travis_time:end:05fb5810:start=1548796732319083221,finish=1548796818901711168,duration=86582627947
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
Setting environment variables from .travis.yml
$ export IMAGE=x86_64-gnu-llvm-6.0
---
[01:03:18] ................................................................................................i... 3800/5358
[01:03:20] .................................................................................................... 3900/5358
[01:03:22] .....................................................i.............................................. 4000/5358
[01:03:25] .................................................................................................... 4100/5358
[01:03:33] .........................................F.......................................................... 4200/5358
[01:03:41] .................................................................................................... 4400/5358
[01:03:45] .................................................................................................... 4500/5358
[01:03:50] .........i.......................................................................................... 4600/5358
[01:03:54] .................................................................................................... 4700/5358
---
[01:04:14] .................................................................................................i.. 5300/5358
[01:04:15] ..........................................................
[01:04:15] failures:
[01:04:15] 
[01:04:15] ---- [ui] ui/privacy/pub-priv-dep/std-pub.rs stdout ----
[01:04:15] 
[01:04:15] error: test compilation failed although it shouldn't!
[01:04:15] status: exit code: 1
[01:04:15] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/privacy/pub-priv-dep/std-pub.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/privacy/pub-priv-dep/std-pub/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/privacy/pub-priv-dep/std-pub/auxiliary" "-A" "unused"
[01:04:15] ------------------------------------------
[01:04:15] 
[01:04:15] ------------------------------------------
[01:04:15] stderr:
[01:04:15] stderr:
[01:04:15] ------------------------------------------
[01:04:15] {"message":"unknown feature `public_private_dependencies`","code":{"code":"E0635","explanation":"\nThe `#![feature]` attribute specified an unknown feature.\n\nErroneous code example:\n\n```compile_fail,E0635\n#![feature(nonexistent_rust_feature)] // error: unknown feature\n```\n\n"},"level":"error","spans":[{"file_name":"/checkout/src/test/ui/privacy/pub-priv-dep/std-pub.rs","byte_start":130,"byte_end":157,"line_start":6,"line_end":6,"column_start":12,"column_end":39,"is_primary":true,"text":[{"text":"#![feature(public_private_dependencies)]","highlight_start":12,"highlight_end":39}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error[E0635]: unknown feature `public_private_dependencies`\n  --> /checkout/src/test/ui/privacy/pub-priv-dep/std-pub.rs:6:12\n   |\nLL | #![feature(public_private_dependencies)]\n   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
[01:04:15] {"message":"For more information about this error, try `rustc --explain E0635`.","code":null,"level":"","spans":[],"children":[],"rendered":"For more information about this error, try `rustc --explain E0635`.\n"}
[01:04:15] 
[01:04:15] ------------------------------------------
[01:04:15] 
[01:04:15] 
[01:04:15] thread '[ui] ui/privacy/pub-priv-dep/std-pub.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3291:9
[01:04:15] 
[01:0t code: 101
[01:04:15] 
[01:04:15] 
[01:04:15] 
[01:04:15] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:04:15] Build completed unsuccessfully in 0:04:07
[01:04:15] make: *** [check] Error 1
[01:04:15] Makefile:48: recipe for target 'check' failed

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@Aaron1011 Aaron1011 force-pushed the feature/pub-priv-dep branch from d2dadee to 369faae Compare February 1, 2019 14:44
@Aaron1011
Copy link
Member Author

@petrochenkov: I've rebased against master.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 1, 2019

📌 Commit 369faae has been approved by petrochenkov

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 1, 2019
@bors
Copy link
Contributor

bors commented Feb 1, 2019

⌛ Testing commit 369faae with merge 742fcc7...

bors added a commit that referenced this pull request Feb 1, 2019
Implement public/private dependency feature

Implements #44663

The core implementation is done - however, there are a few issues that still need to be resolved:

- [x] The `EXTERNAL_PRIVATE_DEPENDENCY` lint currently does notthing when the `public_private_dependencies` is not enabled. Should mentioning the lint (in an `allow` or `deny` attribute) be an error if the feature is not enabled? (Resolved- the feature was removed)
- [x] Crates with the name `core` and `std` are always marked public, without the need to explcitily specify them on the command line. Is this what we want to do? Do we want to allow`no_std`/`no_core` crates to explicitly control this in some way? (Resolved - private crates are now explicitly specified)
- [x] Should I add additional UI tests? (Resolved - added more tests)
- [x] Does it make sense to be able to allow/deny the `EXTERNAL_PRIVATE_DEPENDENCY` on an individual item? (Resolved - this is implemented)
@bors
Copy link
Contributor

bors commented Feb 1, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: petrochenkov
Pushing 742fcc7 to master...

@bors bors merged commit 369faae into rust-lang:master Feb 1, 2019
@Eh2406
Copy link
Contributor

Eh2406 commented Feb 1, 2019

Grate work on getting this landed! Thank you! That is 1 of 3 major parts of the implementation for that RFC done! I am working on the cargo dependency resolution part. It is working, just exponentially slow. At any time I can make a PR (with the fuzz testing turned off) with something functional enough for someone to start working on the 3ed part. Namely the cargo front end part, adding it to the Cargo.toml, to the registry, a future flag, and passing the args to rustc. Let me know if I should make that PR.

@Aaron1011
Copy link
Member Author

@Eh2406: That sounds like a good idea

@Eh2406
Copy link
Contributor

Eh2406 commented Feb 12, 2019

PR is up rust-lang/cargo#6653

bors added a commit to rust-lang/cargo that referenced this pull request Mar 6, 2019
part of the infrastructure for public & private dependencies in the resolver

This is part of my work on public & private dependencies in the resolver from #6129. As discussed there the proptest fuzzers are happy to find exponential blow up with all the back jumping strategies I have tried. So this PR does not have a back jumping strategie nor does it have the proptest fuzzers generating public dependencies. These will both need to change for the feature to stabilize. In the meantime it gives the correct results on the cases it can handle.

With rust-lang/rust#57586 landed there is a lot of work to do on Cargos front end. Adding a UI for this, passing the relevant things to rustc, passing it to crates.io, passing it to cargo-metadata. This is good enough to allow that work to proceed.
@Eh2406
Copy link
Contributor

Eh2406 commented Mar 13, 2019

@Aaron1011 The PR is merged, we would love to guide you (or anyone) to doing the cargo-frontend side!

@Aaron1011
Copy link
Member Author

I've started work on the cargo-frontend side.

cramertj added a commit to cramertj/rust that referenced this pull request Apr 11, 2019
…petrochenkov

Properly parse '--extern-private' with name and path

It turns out that rust-lang#57586 didn't properly parse `--extern-private name=path`.

This PR properly implements the `--extern-private` option. I've added a new `extern-private` option to `compiletest`, which causes an `--extern-private` option to be passed to the compiler with the proper path.

Part of rust-lang#44663
bors added a commit that referenced this pull request Apr 13, 2019
Properly parse '--extern-private' with name and path

It turns out that #57586 didn't properly parse `--extern-private name=path`.

This PR properly implements the `--extern-private` option. I've added a new `extern-private` option to `compiletest`, which causes an `--extern-private` option to be passed to the compiler with the proper path.

Part of #44663
bors added a commit that referenced this pull request Apr 14, 2019
Properly parse '--extern-private' with name and path

It turns out that #57586 didn't properly parse `--extern-private name=path`.

This PR properly implements the `--extern-private` option. I've added a new `extern-private` option to `compiletest`, which causes an `--extern-private` option to be passed to the compiler with the proper path.

Part of #44663
@ehuss
Copy link
Contributor

ehuss commented Apr 19, 2019

@Aaron1011 Was src/test/ui/feature-gates/feature-gate-public_private_dependencies.rs supposed to be deleted now that there is no feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants