-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add build profile. #6577
Add build profile. #6577
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 |
---|---|---|
|
@@ -148,6 +148,36 @@ cargo +nightly build -Z config-profile | |
``` | ||
|
||
|
||
### Build Profile | ||
* Tracking Issue: [rust-lang/rust#48683](https://github.com/rust-lang/rust/issues/48683) | ||
|
||
The `build` profile controls the build settings for build scripts, | ||
proc-macros, compiler plugins, and all of their dependencies. It requires the | ||
`build-profile` feature to be enabled. | ||
|
||
```toml | ||
cargo-features = ["build-profile"] | ||
|
||
[profile.build] | ||
# The following illustrates the defaults. | ||
opt-level = 0 | ||
debug = false | ||
rpath = false | ||
lto = false | ||
debug-assertions = false | ||
codegen-units = 16 | ||
panic = 'unwind' | ||
incremental = false | ||
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. Shouldn't this be 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. Right now it is I don't have a strong opinion about any of the defaults. I think the theory on this one is that build scripts are rarely modified. But I can see how it would be annoying when you are actively working on it. Maybe you are thinking of #6564 which hasn't merged, yet? That would change the default. 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. Oh nah I just wanted to confirm. I think that we should have incremental turned on by default as the overhead only applies for I could see this going either way though. Build scripts are typically quite small and fast to compile, which means that incremental isn't a hit for them nor does it really matter too much. I'd personally err on the side of enabling incremental though |
||
overflow-checks = false | ||
``` | ||
|
||
It is compatible with [Profile Overrides](#profile-overrides) and [Config | ||
Profiles](#config-profiles). If `build-override` is specified in a dev or | ||
release profile, that takes precedence over the `build` profile. Enabling | ||
`build-profile` will cause `build-override` to also affect proc-macros and | ||
plugins (normally it only affects build scripts). | ||
|
||
|
||
### Namespaced features | ||
* Original issue: [#1286](https://github.com/rust-lang/cargo/issues/1286) | ||
* Tracking Issue: [#5565](https://github.com/rust-lang/cargo/issues/5565) | ||
|
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'm a little wary about this being
false
, it seems like this may want to betrue
by default to help weed out mistakes more quicklyThere 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.
Yea, I wouldn't mind making it
true
. Maybe the same foroverflow-checks
? I don't have a sense of how much slower that typically makes things, but I suspect it would not be perceivable by most scripts/macros. I thinkdebug
is the bigger question of how it should be defaulted.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.
Yeah I think this and overflow-checks should probably default to on, build scripts are typically rarely a bottleneck and if they both of these options can be disabled pretty easily (both from crates.io via changing apis or locally by changing profiles).
For
debug
I wonder if we could perhaps try setting a default of 1? That means we only generate line tables for backtraces, but no local variable info as no one's really using gdb on these