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

fix: pass -C debuginfo after weakening if explicitly set #12165

Merged
merged 1 commit into from
May 22, 2023

Conversation

weihanglo
Copy link
Member

@weihanglo weihanglo commented May 21, 2023

What does this PR try to resolve?

The weakening of debuginfo for build script shouldn't turn debuginfo
to DebugInfo::None. That will result in not passing -C debuginfo=0
to rustc, leading to build artifact cache miss.

Fixes #12163

How should we test and review this PR?

The existing test cases should cover this change.

You can also follow the reproducer in #12163.

I don't think we need more new test cases, since #12163 is not really a new scenario. See #12163 (comment).

Additional information

Will it introduce more cache miss? The following table shows whether -C debuginfo is passed to rustc:

(before/after means before/after this pull request)

profile\dependency Before: build-deps After: build-deps normal-deps
dev default No flag (weakened) -C debuginfo=0 -C debuginfo=2
dev.debug=0 No flag (weakened) -C debuginfo=0 -C debuginfo=0
dev.build-override.debug=0 -C debuginfo=0 -C debuginfo=0 -C debuginfo=2
release default No flag (not set) No flag (not set) No flag (not set)
release.debug=0 No flag (weakened) -C debuginfo=0 -C debuginfo=0
release.build-override.debug=0 -C debuginfo=0 -C debuginfo=0 -C debuginfo=2

We can see that even with debug=0 set explicitly, some build-deps were weakened to no flag passed at all. I am still not sure if there is any cache miss, but at least we can potentially reuse artifacts between build-deps and normal-deps when dev.debug=0.

(Artifacts cannot be reused for release.debug=0 because other flags like opt-level may have different values)

@rustbot
Copy link
Collaborator

rustbot commented May 21, 2023

r? @ehuss

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

@rustbot rustbot added A-profiles Area: profiles S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 21, 2023
The weakening of debuginfo for build script shouldn't turn debuginfo
to `DebugInfo::None`. That will result in not passing `-C debuginfo=0`
to rustc, leading to build artifact cache miss.
@ehuss
Copy link
Contributor

ehuss commented May 22, 2023

Thanks!

@bors r+

Do you think this needs to be backported to beta?

@bors
Copy link
Contributor

bors commented May 22, 2023

📌 Commit 277e65b has been approved by ehuss

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

bors commented May 22, 2023

⌛ Testing commit 277e65b with merge a27af88...

@weihanglo
Copy link
Member Author

Do you think this needs to be backported to beta?

Feel like the bug shouldn't affect too many people, as you need to have both a crate in normal and build dependencies and switch back-and-forth between builds with different dependency resolutions. That said, no harm for a backport I guess? I do one then.

@bors
Copy link
Contributor

bors commented May 22, 2023

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing a27af88 to master...

@bors bors merged commit a27af88 into rust-lang:master May 22, 2023
@weihanglo weihanglo deleted the issue/12163 branch May 22, 2023 17:45
@weihanglo weihanglo added the beta-nominated Nominated to backport to the beta branch. label May 22, 2023
bors added a commit that referenced this pull request May 23, 2023
[beta-1.70] backport #12165

Beta backports:

- #12165
  - Adjusted a bit since `TomlDebugInfo::None` was not there in 1.70.0. It was a simple u32 `0`.

In order to make CI pass, the following PRs are also cherry-picked:

- #12136
bors added a commit to rust-lang-ci/rust that referenced this pull request May 23, 2023
Update cargo

10 commits in 09276c703a473ab33daaeb94917232e80eefd628..64fb38c97ac4d3a327fc9032c862dd28c8833b17
2023-05-16 21:43:35 +0000 to 2023-05-23 18:53:23 +0000
- Consider rust-version when selecting packages for cargo add (rust-lang/cargo#12078)
- fix(lints): Switch to -Zlints so stable projects can experiment (rust-lang/cargo#12168)
- Automatically inherit workspace fields when running cargo new/init (rust-lang/cargo#12069)
- ci: check if any version bump needed for member crates (rust-lang/cargo#12126)
- feat: `lints` feature (rust-lang/cargo#12148)
- fix: pass `-C debuginfo` after weakening if explicitly set (rust-lang/cargo#12165)
- Tweak build help to clarify role of --bin (rust-lang/cargo#12157)
- fix: Pass CI on nightly (rust-lang/cargo#12160)
- docs(source): doc comments for Source and its impls (rust-lang/cargo#12159)
- docs(source): doc comments for `Source` and friends (rust-lang/cargo#12153)

r? `@ghost`
saethlin pushed a commit to saethlin/miri that referenced this pull request May 26, 2023
Update cargo

10 commits in 09276c703a473ab33daaeb94917232e80eefd628..64fb38c97ac4d3a327fc9032c862dd28c8833b17
2023-05-16 21:43:35 +0000 to 2023-05-23 18:53:23 +0000
- Consider rust-version when selecting packages for cargo add (rust-lang/cargo#12078)
- fix(lints): Switch to -Zlints so stable projects can experiment (rust-lang/cargo#12168)
- Automatically inherit workspace fields when running cargo new/init (rust-lang/cargo#12069)
- ci: check if any version bump needed for member crates (rust-lang/cargo#12126)
- feat: `lints` feature (rust-lang/cargo#12148)
- fix: pass `-C debuginfo` after weakening if explicitly set (rust-lang/cargo#12165)
- Tweak build help to clarify role of --bin (rust-lang/cargo#12157)
- fix: Pass CI on nightly (rust-lang/cargo#12160)
- docs(source): doc comments for Source and its impls (rust-lang/cargo#12159)
- docs(source): doc comments for `Source` and friends (rust-lang/cargo#12153)

r? `@ghost`
@ehuss ehuss added this to the 1.71.0 milestone May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-profiles Area: profiles beta-nominated Nominated to backport to the beta branch. 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.

Inconsistent handling of debug = 0 vs debug = false in profiles
4 participants