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

[beta] Fix LTO with doctests. #8658

Merged
merged 3 commits into from
Aug 28, 2020
Merged

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Aug 28, 2020

Beta packports:

Although the LTO regression is on 1.46, I probably won't do a stable backport even if there is a point release, as I think it would be good to have sufficient time for testing on nightly, and I don't want to rush it. I'm willing to reconsider that, though.

bors added 3 commits August 28, 2020 09:37
… r=alexcrichton

Fix cache_messages::rustdoc test broken on beta.

The most recent beta `rustc 1.47.0-beta.1` broke this test (rust-lang/rust#75951).  Just switch to a different lint to get the test working again.
Add spaces after -C and -Z flags for consistency

Most other options have a space after flag name.
This commit makes verbose output of rustc invocations a little bit cleaner.
Fix LTO with doctests.

This fixes an issue where `cargo test --release` would fail to run doctests if LTO is set in `profile.release` or `profile.bench`.

The issue is that dependencies were built with `-Clinker-plugin-lto`, but the final rustdoc invocation did not issue `-C lto`. This causes a link failure (or crash!) because the necessary object code was missing.  This is because rustdoc historically did not support codegen flags, so Cargo has never passed them in.  Rustdoc now supports codegen flags (via rust-lang/rust#63827), so it should be safe to start passing them in.  For now, I am only adding LTO, but more should be added in the future.

There are two bugs here. One is that LTO flags aren't passed to rustdoc. The other is that the "doctest" unit was using the wrong profile (it was using dev/release when it should be using test/bench).

There are two distinct scenarios here.  One where just `release` has `lto` set.  And one where both `release` and `bench` have `lto` set.  This is relevant because LTO mostly cares about what the final artifact wants, and in the case where `bench` does not have `lto` set, then LTO will not be used for tests. This will hopefully be a little cleaner in the future when rust-lang#6988 is stabilized, which causes the test/bench profiles to *inherit* from the dev/bench profiles, which means you won't need to manually synchronize the test/bench profiles with dev/release.

Fixes rust-lang#8654
@rust-highfive
Copy link

r? @Eh2406

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

@rust-highfive
Copy link

⚠️ Warning ⚠️

  • Pull requests are usually filed against the master branch for this repo, but this one is against rust-1.47.0. Please double check that you specified the right target!

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 28, 2020
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Aug 28, 2020

📌 Commit d1ff577 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 Aug 28, 2020
@bors
Copy link
Contributor

bors commented Aug 28, 2020

⌛ Testing commit d1ff577 with merge f3c7e06...

@bors
Copy link
Contributor

bors commented Aug 28, 2020

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing f3c7e06 to rust-1.47.0...

@bors bors merged commit f3c7e06 into rust-lang:rust-1.47.0 Aug 28, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 10, 2020
…acrum

[beta] Update cargo

1 commits in 51b66125ba97d2906f461b3f4e0408f206299bb6..f3c7e066ad66e05439cf8eab165a2de580b41aaf
2020-08-19 20:22:52 +0000 to 2020-08-28 19:37:58 +0000
- [beta] Fix LTO with doctests. (rust-lang/cargo#8658)
@ehuss ehuss added this to the 1.47.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