Skip to content

Check for nightly toolchain when enabling split debug info. - #4186

Merged
slackito merged 5 commits into
bazelbuild:mainfrom
slackito:split-debuginfo-nightly
Aug 4, 2026
Merged

Check for nightly toolchain when enabling split debug info.#4186
slackito merged 5 commits into
bazelbuild:mainfrom
slackito:split-debuginfo-nightly

Conversation

@slackito

@slackito slackito commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

This fixes a problem pointed out by
#4092 (comment).

-Zsplit-dwarf-out-dir is only available on nightly, so we have to gate split debug info on it. Now, if the user requests --fission while using a non-nightly Rust toolchain, the build will fail. To avoid breaking users relying on the previous behavior, a skip_fission_for_rust flag has been added. Users can add it to their bazelrc file to explicitly signal that they're okay with Rust compiles not producing split debug info, even if requested in the command line.

Assisted-by: Gemini

This fixes a problem pointed out by
bazelbuild#4092 (comment).

`-Zsplit-dwarf-out-dir` is only available on nightly, so we have to gate
split debug info on it. Also added some tests that check that we don't
add the flag when using other channels.

@UebelAndre UebelAndre left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me!

Also provide an opt-in flag to keep the current behavior, in which
`--fission=yes` enables fission for C++ targets but is silently ignored
by Rust with a stable toolchain.
@slackito

slackito commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator Author

I chatted with @krasimirgg and @UebelAndre and there were some concerns that silently failing to enable fission on Rust when using a stable toolchain would cause a bad experience for people trying to debug their Rust+fission builds.

So I've changed it so that --fission=true with a stable Rust toolchain will fail, and added a flag to preserve the existing behavior (that is, C++ compiles will output split debug info but Rust compiles won't) . This way, users that rely on the current behavior can add the flag to their bazelrc and explicitly opt-out from Fission on rust even if it's requested in the command line.

Comment thread rust/private/rustc.bzl Outdated
# `-Zsplit-dwarf-out-dir` is only available on nightly.
if toolchain.channel == "nightly":
use_split_debuginfo = True
elif toolchain._skip_fission_for_rust:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As a user, I'd expect that if _skip_fission_for_rust is true and toolchain.channel == "nightly", fission-for-rust is disabled... In other words, the setting takes precedence. What do you think?

@krasimirgg krasimirgg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me!

@slackito
slackito added this pull request to the merge queue Aug 4, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 4, 2026
@slackito
slackito added this pull request to the merge queue Aug 4, 2026
@slackito
slackito removed this pull request from the merge queue due to a manual request Aug 4, 2026
@slackito slackito changed the title Enable debug info only on nightly. Check for nightly toolchain when enabling split debug info. Aug 4, 2026
@slackito
slackito added this pull request to the merge queue Aug 4, 2026
Merged via the queue into bazelbuild:main with commit b0076d5 Aug 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants