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

[-Zbuild-std] Only build libtest when libstd is built #7360

Merged
merged 2 commits into from
Sep 16, 2019

Conversation

phil-opp
Copy link
Contributor

Currently libtest is always compiled when a compilation unit uses a test harness. This implicitly adds builds the standard library too because libtest depends on it. This breaks the use of custom test frameworks in no_std crates as reported in #7216 (comment).

This pull request fixes the issue by only building libtest if libstd is built. This makes sense in my opinion because when the user explicitly specified -Zbuild-std=core, they probably don't want to build the full standard library and rather get a compilation error when they accidentally use libtest.

@rust-highfive
Copy link

r? @ehuss

(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 Sep 13, 2019
@phil-opp phil-opp force-pushed the zbuild-std-custom-test-frameworks branch from 9cdbbc5 to 6b4fd44 Compare September 15, 2019 15:54
@alexcrichton
Copy link
Member

@bors: r+

Seems like a reasonable workaround for now!

@bors
Copy link
Collaborator

bors commented Sep 16, 2019

📌 Commit 6b4fd44 has been approved by alexcrichton

@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 Sep 16, 2019
@bors
Copy link
Collaborator

bors commented Sep 16, 2019

⌛ Testing commit 6b4fd44 with merge a41885e9b40ac3801a48b355a0f95b84c935266a...

@bors
Copy link
Collaborator

bors commented Sep 16, 2019

💔 Test failed - checks-azure

@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 Sep 16, 2019
@ehuss
Copy link
Contributor

ehuss commented Sep 16, 2019

---- freshness::rebuild_on_mid_build_file_modification stdout ----
running d:\a\1\s\target\debug\cargo.exe build
running d:\a\1\s\target\debug\cargo.exe build
thread 'freshness::rebuild_on_mid_build_file_modification' panicked at '
Expected: execs
but: exited with exit code: 101
--- stdout

--- stderr
Compiling root v0.1.0 (D:\a\1\s\target\cit\t703\foo\root)
error: proc-macro derive panicked
--> root\src\lib.rs:5:22
|
5 | #[derive(Noop)]
| ^^^^
|
= help: message: called Result::unwrap() on an Err value: Os { code: 10054, kind: ConnectionReset, message: "An existing connection was forcibly closed by the remote host." }

I have never seen that error before, weird!

@bors retry

@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 Sep 16, 2019
@bors
Copy link
Collaborator

bors commented Sep 16, 2019

⌛ Testing commit 6b4fd44 with merge 7ac51b7...

bors added a commit that referenced this pull request Sep 16, 2019
…lexcrichton

[-Zbuild-std] Only build libtest when libstd is built

Currently `libtest` is always compiled when a compilation unit uses a test harness. This implicitly adds builds the standard library too because `libtest` depends on it. This breaks the use of custom test frameworks in `no_std` crates as reported in #7216 (comment).

This pull request fixes the issue by only building `libtest` if `libstd` is built. This makes sense in my opinion because when the user explicitly specified `-Zbuild-std=core`, they probably don't want to build the full standard library and rather get a compilation error when they accidentally use `libtest`.
@bors
Copy link
Collaborator

bors commented Sep 16, 2019

☀️ Test successful - checks-azure
Approved by: alexcrichton
Pushing 7ac51b7 to master...

@bors bors merged commit 6b4fd44 into rust-lang:master Sep 16, 2019
@phil-opp phil-opp deleted the zbuild-std-custom-test-frameworks branch September 18, 2019 08:42
@ehuss ehuss added this to the 1.39.0 milestone Feb 6, 2022
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.

5 participants