-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Update book: Rust 1.77 changed the default behaviour on debug symbol stripping #13638
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -113,11 +113,12 @@ strip either symbols or debuginfo from a binary. This can be enabled like so: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[profile.release] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
strip = "debuginfo" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
strip = "symbols" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Possible string values of `strip` are `"none"`, `"debuginfo"`, and `"symbols"`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The default is `"none"`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
For debug profiles the default is `"none"`, and for profiles with `debug = false` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
the default is `"debuginfo"`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You can also configure this option with the boolean values `true` or `false`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
`strip = true` is equivalent to `strip = "symbols"`. `strip = false` is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -293,7 +294,7 @@ The default settings for the `release` profile are: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
opt-level = 3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
debug = false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
split-debuginfo = '...' # Platform-specific. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
strip = "none" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
strip = "debuginfo" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems incorrect to me. The default value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The behavior of auto-stripping debuginfo is kinda dynamic. The default release profile settings is still static and Share these pieces of code for clarity. cargo/src/cargo/core/profiles.rs Lines 719 to 728 in 94aa7fb
cargo/src/cargo/core/profiles.rs Lines 630 to 651 in 94aa7fb
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hmm.
And according to Cargo Book:
I made a small test on 1.78.0 and release profile seems indeed have set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See also #13638 (comment) and #13677 (comment). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The settings are static. The actual flags passed to rustc are deferred later when Cargo see if it can safely strip std or not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
But |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
debug-assertions = false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
overflow-checks = false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lto = false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we need to update the documentation. The idea behind this is to emulate
std
respectingdebug
.