-
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
Fix split-debuginfo support detection #11347
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon. Please see the contribution instructions for more information. |
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.
Good call on this! Thank you for the pull request.
Add split-debuginfo print option This option prints all supported values for `-Csplit-debuginfo=..`, i.e. only stable ones on stable/beta and all of them on nightly/dev. Motivated by 1.65.0 regression causing builds with the following entry in `Cargo.toml` to fail on Windows: ```toml [profile.dev] split-debuginfo = "unpacked" ``` See rust-lang/cargo#11347 for details. This will lead to closing rust-lang#103976.
cargo assumed that if -Csplit-debuginfo=packed worked, all values would be correct. This however is not the case -- as of Rust 1.65.0, rustc supports packed, but not unpacked or off on Windows. Because of this, having split-debuginfo="unpacked" on Windows has caused builds to fail, as cargo assumed that the option is fine (split-debuginfo=packed worked), but rustc then failed when being passed -Csplit-debuginfo=unpacked. This patch invokes rustc with the --print=split-debuginfo to query supported values and ignores the Cargo.toml entry if not supported.
329c9d9
to
856ed94
Compare
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.
Glad to see your patch for rustc going to be landed!
Two possible enhancements could be done in this pull request:
- I found there is no test around this feature. How about writing some basics test validating we're passing correct
-Csplit-debuginfo
to rustc? Maybe we could exclude Windows from these tests at this time. Should we add a warning if given split-debuginfo option is not supported? We can spin off this to a separate issue though.Might be too noisy. Leave it.
macOS tests fail due to missing
While I can write such tests, they won't pass now anyway due to reasons outlined above. What do you think about it? |
Add split-debuginfo print option This option prints all supported values for `-Csplit-debuginfo=..`, i.e. only stable ones on stable/beta and all of them on nightly/dev. Motivated by 1.65.0 regression causing builds with the following entry in `Cargo.toml` to fail on Windows: ```toml [profile.dev] split-debuginfo = "unpacked" ``` See rust-lang/cargo#11347 for details. This will lead to closing rust-lang#103976.
Add split-debuginfo print option This option prints all supported values for `-Csplit-debuginfo=..`, i.e. only stable ones on stable/beta and all of them on nightly/dev. Motivated by 1.65.0 regression causing builds with the following entry in `Cargo.toml` to fail on Windows: ```toml [profile.dev] split-debuginfo = "unpacked" ``` See rust-lang/cargo#11347 for details. This will lead to closing rust-lang#103976.
No. Not really. I guess we are required to wait for your rustc patch hitting stable (presumably 1.67). Only after that this pull request can be merged. |
Add split-debuginfo print option This option prints all supported values for `-Csplit-debuginfo=..`, i.e. only stable ones on stable/beta and all of them on nightly/dev. Motivated by 1.65.0 regression causing builds with the following entry in `Cargo.toml` to fail on Windows: ```toml [profile.dev] split-debuginfo = "unpacked" ``` See rust-lang/cargo#11347 for details. This will lead to closing rust-lang#103976.
Add split-debuginfo print option This option prints all supported values for `-Csplit-debuginfo=..`, i.e. only stable ones on stable/beta and all of them on nightly/dev. Motivated by 1.65.0 regression causing builds with the following entry in `Cargo.toml` to fail on Windows: ```toml [profile.dev] split-debuginfo = "unpacked" ``` See rust-lang/cargo#11347 for details. This will lead to closing rust-lang#103976.
The patch was merged, so it's indeed on track to 1.67. One question about cargo release cycle -- if we get this PR merged after 1.67 is released, will that mean that the patched |
Cargo, and several other official components, follow Rust's train release model. The release schedule is found here. That is, if we get this merged after 1.67 is released, it should hit stable channel on 1.69. |
Just to be clear, will this be blocked until after Jan 26? It's a bit unfortunate to still incur a second |
I feel like it can be merged into the other with some tricks. But yeah, it is blocked until the change of rustc get stabilized. |
@weihanglo this patch should now work with stable Rust, can you re-run CI? |
@bors try |
Fix split-debuginfo support detection ### What does this PR try to resolve? cargo assumed that if `-Csplit-debuginfo=packed` worked, all values would be correct. This however is not the case -- as of Rust 1.65.0, rustc supports `packed`, but not `unpacked` or `off` on Windows. Because of this, having `split-debuginfo="unpacked`" on Windows has caused builds to fail, as cargo assumed that the option is fine (`split-debuginfo=packed` worked), but rustc then failed when being passed `-Csplit-debuginfo=unpacked`. ### How should we test and review this PR? Consider an empty project with the following change to `Cargo.toml`: ```toml [profile.dev] split-debuginfo="unpacked" ``` `cargo +1.64.0 build` will work, but `cargo +1.65.0 build` will fail with the following error message: ``` PS C:\REDACTED> cargo build Compiling tmp v0.1.0 (C:\REDACTED) error: `-Csplit-debuginfo=unpacked` is unstable on this platform error: could not compile `tmp` due to previous error ``` With this patch and 1.65.0 rustc, cargo will ignore all `split-debuginfo` settings, but with rust-lang/rust#104104 rustc (approved, awaiting merge), it will properly detect supported values for `split-debuginfo` and only ignore those that are unsupported.
💥 Test timed out |
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.
This try looks good https://github.com/rust-lang/cargo/actions/runs/4016766934. Thank you for the contribution and long waiting!
@bors r+ BTW, to optimize it a bit, we could explore a way merging multiple rustc calls into one. |
☀️ Test successful - checks-actions |
…=weihanglo Fix split-debuginfo support detection ### What does this PR try to resolve? cargo assumed that if `-Csplit-debuginfo=packed` worked, all values would be correct. This however is not the case -- as of Rust 1.65.0, rustc supports `packed`, but not `unpacked` or `off` on Windows. Because of this, having `split-debuginfo="unpacked`" on Windows has caused builds to fail, as cargo assumed that the option is fine (`split-debuginfo=packed` worked), but rustc then failed when being passed `-Csplit-debuginfo=unpacked`. ### How should we test and review this PR? Consider an empty project with the following change to `Cargo.toml`: ```toml [profile.dev] split-debuginfo="unpacked" ``` `cargo +1.64.0 build` will work, but `cargo +1.65.0 build` will fail with the following error message: ``` PS C:\REDACTED> cargo build Compiling tmp v0.1.0 (C:\REDACTED) error: `-Csplit-debuginfo=unpacked` is unstable on this platform error: could not compile `tmp` due to previous error ``` With this patch and 1.65.0 rustc, cargo will ignore all `split-debuginfo` settings, but with rust-lang/rust#104104 rustc (approved, awaiting merge), it will properly detect supported values for `split-debuginfo` and only ignore those that are unsupported.
18 commits in 3c5af6bed9a1a243a693e8e22ee2486bd5b82a6c..e84a7928d93a31f284b497c214a2ece69b4d7719 2023-01-24 15:48:15 +0000 to 2023-01-31 22:18:09 +0000 - chore: Add autolabel for `Command-*` labels (rust-lang/cargo#11664) - Update cross test instructions for aarch64-apple-darwin (rust-lang/cargo#11663) - Make cargo install report needed features (rust-lang/cargo#11647) - docs(contrib): Remove out-of-date process step (rust-lang/cargo#11662) - Do not error for `auth-required: true` without `-Z sparse-registry` (rust-lang/cargo#11661) - Warn on commits to non-default branches. (rust-lang/cargo#11655) - Avoid saving the same future_incompat warning multiple times (rust-lang/cargo#11648) - Mention current default value in `publish.timeout` docs (rust-lang/cargo#11652) - Make cargo aware of dwp files. (rust-lang/cargo#11572) - Reduce target info rustc query calls (rust-lang/cargo#11633) - Bump to 0.70.0; update changelog (rust-lang/cargo#11640) - Enable sparse protocol in CI (rust-lang/cargo#11632) - Fix split-debuginfo support detection (rust-lang/cargo#11347) - refactor(toml): Move `TomlWorkspaceDependency` out of `TomlDependency` (rust-lang/cargo#11565) - book: describe how the current resolver sometimes duplicates deps (rust-lang/cargo#11604) - `cargo add` check `[dependencies]` order without considering the dotted item (rust-lang/cargo#11612) - Link CoC to www.rust-lang.org/conduct.html (rust-lang/cargo#11622) - Add more labels to triagebot (rust-lang/cargo#11621)
Update cargo 18 commits in 3c5af6bed9a1a243a693e8e22ee2486bd5b82a6c..e84a7928d93a31f284b497c214a2ece69b4d7719 2023-01-24 15:48:15 +0000 to 2023-01-31 22:18:09 +0000 - chore: Add autolabel for `Command-*` labels (rust-lang/cargo#11664) - Update cross test instructions for aarch64-apple-darwin (rust-lang/cargo#11663) - Make cargo install report needed features (rust-lang/cargo#11647) - docs(contrib): Remove out-of-date process step (rust-lang/cargo#11662) - Do not error for `auth-required: true` without `-Z sparse-registry` (rust-lang/cargo#11661) - Warn on commits to non-default branches. (rust-lang/cargo#11655) - Avoid saving the same future_incompat warning multiple times (rust-lang/cargo#11648) - Mention current default value in `publish.timeout` docs (rust-lang/cargo#11652) - Make cargo aware of dwp files. (rust-lang/cargo#11572) - Reduce target info rustc query calls (rust-lang/cargo#11633) - Bump to 0.70.0; update changelog (rust-lang/cargo#11640) - Enable sparse protocol in CI (rust-lang/cargo#11632) - Fix split-debuginfo support detection (rust-lang/cargo#11347) - refactor(toml): Move `TomlWorkspaceDependency` out of `TomlDependency` (rust-lang/cargo#11565) - book: describe how the current resolver sometimes duplicates deps (rust-lang/cargo#11604) - `cargo add` check `[dependencies]` order without considering the dotted item (rust-lang/cargo#11612) - Link CoC to www.rust-lang.org/conduct.html (rust-lang/cargo#11622) - Add more labels to triagebot (rust-lang/cargo#11621) r? `@ghost`
Update cargo 18 commits in 3c5af6bed9a1a243a693e8e22ee2486bd5b82a6c..e84a7928d93a31f284b497c214a2ece69b4d7719 2023-01-24 15:48:15 +0000 to 2023-01-31 22:18:09 +0000 - chore: Add autolabel for `Command-*` labels (rust-lang/cargo#11664) - Update cross test instructions for aarch64-apple-darwin (rust-lang/cargo#11663) - Make cargo install report needed features (rust-lang/cargo#11647) - docs(contrib): Remove out-of-date process step (rust-lang/cargo#11662) - Do not error for `auth-required: true` without `-Z sparse-registry` (rust-lang/cargo#11661) - Warn on commits to non-default branches. (rust-lang/cargo#11655) - Avoid saving the same future_incompat warning multiple times (rust-lang/cargo#11648) - Mention current default value in `publish.timeout` docs (rust-lang/cargo#11652) - Make cargo aware of dwp files. (rust-lang/cargo#11572) - Reduce target info rustc query calls (rust-lang/cargo#11633) - Bump to 0.70.0; update changelog (rust-lang/cargo#11640) - Enable sparse protocol in CI (rust-lang/cargo#11632) - Fix split-debuginfo support detection (rust-lang/cargo#11347) - refactor(toml): Move `TomlWorkspaceDependency` out of `TomlDependency` (rust-lang/cargo#11565) - book: describe how the current resolver sometimes duplicates deps (rust-lang/cargo#11604) - `cargo add` check `[dependencies]` order without considering the dotted item (rust-lang/cargo#11612) - Link CoC to www.rust-lang.org/conduct.html (rust-lang/cargo#11622) - Add more labels to triagebot (rust-lang/cargo#11621) r? `@ghost`
What does this PR try to resolve?
cargo assumed that if
-Csplit-debuginfo=packed
worked, all values would be correct. This however is not the case -- as of Rust 1.65.0, rustc supportspacked
, but notunpacked
oroff
on Windows. Because of this, havingsplit-debuginfo="unpacked
" on Windows has caused builds to fail, as cargo assumed that the option is fine (split-debuginfo=packed
worked), but rustc then failed when being passed-Csplit-debuginfo=unpacked
.How should we test and review this PR?
Consider an empty project with the following change to
Cargo.toml
:cargo +1.64.0 build
will work, butcargo +1.65.0 build
will fail with the following error message:With this patch and 1.65.0 rustc, cargo will ignore all
split-debuginfo
settings, but with rust-lang/rust#104104 rustc (approved, awaiting merge), it will properly detect supported values forsplit-debuginfo
and only ignore those that are unsupported.