Skip to content

fix(profile): preserve inherited strip - #17678

Merged
Muscraft merged 2 commits into
rust-lang:masterfrom
weihanglo:fix-inherited-strip
Nov 5, 2026
Merged

Muscraft merged 2 commits into
rust-lang:masterfrom
weihanglo:fix-inherited-strip

Conversation

@weihanglo

@weihanglo weihanglo commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

What does this PR try to resolve?

Profile override wasn't respected for the strip option.

The changed was introduced in 0608fcd99d (1.52),
and the smarter stripping also failed to notice the bug (58da1cec19a, 1.77).

After this PR, overridding the strip profile option is respected.

Notes to reviewers

I believe this was an oversight as nobody really override the strip option,
though I could be wrong.


🤖 LLM involvement: This was pointed out during Codex reviewing my other experiments. I was really mad that they submitted a PR without my consent: #17677. Tests are anyway generated. Change is one-line change. I deleted and typed it manually so counted as hand-written? (of course I tweaked the test a bit and wrote my own description)

@rustbot rustbot added A-profiles Area: profiles S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 2, 2026
@rustbot

rustbot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

r? @Muscraft

rustbot has assigned @Muscraft.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Muscraft, @epage, @weihanglo
  • @Muscraft, @epage, @weihanglo expanded to Muscraft, epage, weihanglo
  • Random selection from Muscraft, epage

@weihanglo weihanglo changed the title fix: preserve inherited strip fix(profile): preserve inherited strip Nov 2, 2026
@weihanglo
weihanglo force-pushed the fix-inherited-strip branch from fda6198 to f66be6c Compare November 2, 2026 23:38
@rustbot

rustbot commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@epage

epage commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Am I reading this right that another way to frame this is that we have a default, deferred build override to strip?

Granted, stripping doesn't help with performance but it can help with disk space. Granted, if debug info for build scripts and proc-macros is a major size concern for us then we are doing pretty good.

@weihanglo

weihanglo commented Nov 5, 2026 •

Copy link
Copy Markdown
Member Author

Am I reading this right that another way to frame this is that we have a default, deferred build override to strip?

Yes, though I don't think it was intentional. This bug was discovered during my experiment.

Granted, stripping doesn't help with performance but it can help with disk space. Granted, if debug info for build scripts and proc-macros is a major size concern for us then we are doing pretty good.

I do have a follow-up master...weihanglo:cargo:strip-host-deps that it save around 200MiB for cargo itself (around 7-13% of total target dir disk size, varying across debuginfo levels). My agents found these latent bugs emerging because of my strip-host-deps changes. I am still evaluating those bugs (real user bugs but 🤷🏾‍♂️). I hate adversarial reviews.

#17688

@Muscraft Muscraft left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change makes sense to me. Cargo always defaulting to a deferred strip doesn't seem correct compared to using the inherited value from a profile.

View changes since this review

@Muscraft
Muscraft added this pull request to the merge queue Nov 5, 2026
Merged via the queue into rust-lang:master with commit 5a8f893 Nov 5, 2026
30 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 5, 2026
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 6, 2026
Update cargo submodule

6 commits in 3c747ea3ead23951c1b43a5edfcbdb449135ddeb..111443f3dc4d82a65e2306a93028f122406401c1
2026-11-03 21:25:31 +0000 to 2026-11-05 22:22:33 +0000
- chore: Update libssh2-sys to 0.3.4 (rust-lang/cargo#17692)
- fix(profile): preserve inherited strip  (rust-lang/cargo#17678)
- feat(cargo-platform): implement Serialize/Deserialize for Cfg & CfgExpr (rust-lang/cargo#17598)
- fix: proc-macro typo in &String -> CrateType impl (rust-lang/cargo#17687)
- book faq.md: remove misplaced `)` in offline section (rust-lang/cargo#17682)
- fix(registry): handle HTTP 410/451 for missing crates (rust-lang/cargo#17665)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 6, 2026
Update cargo submodule

6 commits in 3c747ea3ead23951c1b43a5edfcbdb449135ddeb..111443f3dc4d82a65e2306a93028f122406401c1
2026-11-03 21:25:31 +0000 to 2026-11-05 22:22:33 +0000
- chore: Update libssh2-sys to 0.3.4 (rust-lang/cargo#17692)
- fix(profile): preserve inherited strip  (rust-lang/cargo#17678)
- feat(cargo-platform): implement Serialize/Deserialize for Cfg & CfgExpr (rust-lang/cargo#17598)
- fix: proc-macro typo in &String -> CrateType impl (rust-lang/cargo#17687)
- book faq.md: remove misplaced `)` in offline section (rust-lang/cargo#17682)
- fix(registry): handle HTTP 410/451 for missing crates (rust-lang/cargo#17665)
@rustbot rustbot added this to the 1.101.0 milestone Nov 6, 2026
syphar pushed a commit to syphar/cargo that referenced this pull request Nov 10, 2026
…17691)

### What does this PR try to resolve?

Fixes rust-lang#17688

For `cargo build` of cargo itself, which contains 37 build scripts and
12 proc-macros, it save around 7%-12% target directory size:

| `debug` | target dir before -> after | build scripts | proc-macro
`.so` |

|---------|---------------------------|--------------------|-----------------------|
| `true` | 2774.3 -> 2563.7 MiB (-210.6, −7.6%) | 186 -> 35 MiB | 103.9
-> 42.5 MiB |
| `line-tables-only` | 1639.7 -> 1430.1 MiB (−209.6, −12.8%) | 184 -> 35
MiB | 103.9 -> 42.5 MiB |

<sup>(table generated by LLM)</sup>

### Notes to reviewers

The other twos PR are better landing first otherwise those "buggy"
behavior may be more exposed

* rust-lang#17689
* rust-lang#17678

The other idea brought up in rust-lang#17688 that we drop the
weakening logic so this becomes the default behavior, and we no longer
need to fix this by moving code block (which is pretty obsecure).
However, that might need a longer time to land so I feel like this is
probably easier to land.

---

🤖 LLM involvement: Test/snapshot generation
@weihanglo
weihanglo deleted the fix-inherited-strip branch November 10, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-profiles Area: profiles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants