Skip to content

fix: avoid bail macros in expression position - #2843

Open
Lioyae wants to merge 2 commits into
dora-rs:mainfrom
Lioyae:fix/bail-macro-expression
Open

fix: avoid bail macros in expression position#2843
Lioyae wants to merge 2 commits into
dora-rs:mainfrom
Lioyae:fix/bail-macro-expression

Conversation

@Lioyae

@Lioyae Lioyae commented Jul 26, 2026

Copy link
Copy Markdown

Summary

Fixes bail! and eyre::bail! macro invocations that are used in expression position and trigger semicolon_in_expressions_from_macros on recent nightly Rust.

This lint is denied through future_incompatible, so recent nightly toolchains fail when checking or building dora-cli.

Closes #2835

Background

This follows up on the reopened issue comment: #2835 (comment)

There are two separate problems involved:

  1. A rustc nightly ICE can occur while compiling tokio at higher release optimization levels.
  2. Once the build proceeds past tokio, Dora still hits the original bail! macro compilation error.

This PR only addresses the Dora-specific bail! / eyre::bail! error. The tokio ICE appears to be a separate rustc nightly issue and is intentionally left out of scope.

Validation

Tested locally on Windows MSVC:

  • cargo +nightly-2026-07-13 check -p dora-cli on main: passes
  • cargo +nightly check -p dora-cli on main with rustc 1.99.0-nightly (da86f4d07 2026-07-24): fails with semicolon_in_expressions_from_macros
  • cargo +nightly check -p dora-cli on this branch: passes
  • cargo +nightly check -p dora-cli --release on this branch: passes
  • cargo +stable check -p dora-cli: passes
  • cargo fmt --all -- --check: passes
  • git diff --check: passes

Additional note:

  • cargo +nightly build --release -p dora-cli with rustc 1.99.0-nightly (da86f4d07 2026-07-24) still triggers a rustc ICE while compiling tokio v1.53.1.
  • The same full release build passes with nightly-2026-07-13.
  • This supports treating the tokio ICE as unrelated to this PR.

Copilot AI review requested due to automatic review settings July 26, 2026 09:14
@trunk-io

trunk-io Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes bail! / eyre::bail! invocations that were being used in expression position, which triggers the semicolon_in_expressions_from_macros future-incompatible lint on recent nightly Rust toolchains. The changes are mechanical and aim to restore successful builds/checks (notably for dora-cli) without altering runtime behavior, since bail! returns early.

Changes:

  • Wrap bail!/eyre::bail! usages in match arms with blocks and terminate them with semicolons so they are unambiguously statements.
  • Add missing trailing semicolons after multi-line bail! invocations that occur at the end of blocks.
  • Apply the same fix pattern across core, CLI, daemon/coordinator, runtime, and Rust node API crates where the lint was triggered.

Reviewed changes

Copilot reviewed 49 out of 49 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libraries/hub-client/src/index.rs Converts eyre::bail! match arms / block-tail uses into statement form to satisfy the new lint.
libraries/hub-client/src/config.rs Adds a trailing semicolon to a eyre::bail! in a block to avoid expression-position macro expansion.
libraries/core/src/topics.rs Wraps an eyre::bail! match arm in a block and adds ; to avoid expression-position usage.
libraries/core/src/descriptor/validate.rs Fixes several bail! occurrences in match arms / block tails to be statements (; / blocks).
libraries/core/src/descriptor/mod.rs Adds trailing semicolons to bail! / eyre::bail! invocations used as block tails.
libraries/core/src/descriptor/expand.rs Wraps a bail! match arm in a block and adds ; to satisfy the lint.
libraries/core/src/build/mod.rs Adds a trailing semicolon to a multi-line bail! to avoid expression-position behavior.
libraries/core/src/build/git.rs Adds ; after bail! uses in error paths and wraps a multi-line bail! to avoid expression position.
binaries/runtime/src/operator/shared_lib.rs Ensures bail! calls in match arms are statements (blocks + ;).
binaries/runtime/src/lib.rs Makes bail!/eyre::bail! uses statement-position in match arms (adds blocks + ;).
binaries/daemon/src/lib.rs Adds trailing semicolons / blocks for bail!/eyre::bail! in expression contexts.
binaries/coordinator/src/run/mod.rs Wraps bail! in match arms with blocks + ; to avoid expression-position macro expansion.
binaries/coordinator/src/handlers.rs Converts several bail! match arms / else-lets into statement form with ; / blocks.
binaries/cli/src/common.rs Wraps bail! match arm in a block with ; to avoid expression-position invocation.
binaries/cli/src/command/trace/view.rs Converts bail! match arms to blocks with ; for lint compatibility.
binaries/cli/src/command/topic/selector.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/topic/pub_.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/self_.rs Wraps bail! in match arms with blocks + ; to avoid expression position.
binaries/cli/src/command/restart.rs Converts bail! match arms to blocks with ; for lint compatibility.
binaries/cli/src/command/record.rs Converts multiple bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/param/set.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/param/list.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/param/get.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/param/delete.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/node/stop.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/node/restart.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/node/remove.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/node/disconnect.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/node/connect.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/node/add.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/node_binary.rs Converts bail! match arms to statement blocks (;) for lint compatibility.
binaries/cli/src/command/hub/publish.rs Wraps bail! in a match arm with a block + ; to avoid expression position.
binaries/cli/src/command/hub/install.rs Adds a trailing semicolon after a multi-line bail! to avoid expression-position behavior.
binaries/cli/src/command/hub/fetch.rs Converts eyre::bail! match arms to blocks + ; for lint compatibility.
binaries/cli/src/command/coordinator.rs Wraps eyre::bail! in a match arm with a block + ; to avoid expression position.
binaries/cli/src/command/cluster/upgrade.rs Adds trailing semicolon after a multi-line bail! to avoid expression-position behavior.
binaries/cli/src/command/cluster/up.rs Adds trailing semicolon after a multi-line bail! to avoid expression-position behavior.
binaries/cli/src/command/cluster/uninstall.rs Adds trailing semicolon after a multi-line bail! to avoid expression-position behavior.
binaries/cli/src/command/cluster/install.rs Adds trailing semicolon after a multi-line bail! to avoid expression-position behavior.
binaries/cli/src/command/build/mod.rs Wraps eyre::bail! match arm in a block + ; to avoid expression position.
binaries/cli/src/command/build/git.rs Wraps eyre::bail! match arm in a block + ; to avoid expression position.
binaries/cli/src/command/build/distributed.rs Wraps bail! in an Err match arm with a block + ; to avoid expression position.
apis/rust/node/src/node/control_channel.rs Converts bail! match arms to blocks + ; for lint compatibility.
apis/rust/node/src/node/arrow_utils/ipc_encode.rs Adds a trailing semicolon to a tail bail! to avoid expression-position macro expansion.
apis/rust/node/src/event_stream/mod.rs Adds ; / blocks around eyre::bail! in match arms to avoid expression position.
apis/rust/node/src/daemon_connection/node_integration_testing.rs Adds a trailing semicolon after eyre::bail! to avoid expression-position behavior.
apis/rust/node/src/daemon_connection/mod.rs Wraps bail! match arm in a block + ; to avoid expression position.
apis/rust/node/src/daemon_connection/json_to_arrow.rs Wraps eyre::bail! match arm in a block + ; to avoid expression position.
apis/rust/node/src/daemon_connection/interactive.rs Adds a trailing semicolon after eyre::bail! to avoid expression-position behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Lioyae

Lioyae commented Jul 26, 2026

Copy link
Copy Markdown
Author

Hi @phil-opp, could you please review this PR when you have a moment? All CI checks have passed, and the linked issue is #2835.

Copy link
Copy Markdown
Collaborator

I went through all 49 files in this change. Every edit is the same mechanical transformation — adding a trailing ; to a tail-position bail! / eyre::bail!, or rewriting a arm => bail!(...) match arm as arm => { bail!(...); }. Because bail! expands to a diverging return Err(...), wrapping it in a { ...; } block still diverges and coerces correctly in value positions (e.g. the Ok(match ...) in binaries/cli/src/common.rs), so no match-arm type mismatch is introduced and there is no control-flow or behavior change on any path.

No issues found.


🤖 This is a fully automated review by Claude (Claude Code) — no human has vetted these comments.

Generated by Claude Code


Generated by Claude Code

@phil-opp

Copy link
Copy Markdown
Collaborator

Thanks for the PR! Let's try to fix this upstream first, I opened eyre-rs/eyre#294 for that. The rustc lint was downgraded to a warning for now (see rust-lang/rust#79813 (comment)), so we have a bit of time to wait for the eyre fix and release.

(If it isn't fixed there in time, we can proceed with this PR.)

@Lioyae

Lioyae commented Jul 28, 2026

Copy link
Copy Markdown
Author

@phil-opp Thanks for taking a look and for opening the upstream "eyre" PR!

That makes sense to me. I'll leave this PR open as a fallback for now and wait for the "eyre" fix/release. If the upstream fix does not land in time, or if Dora still needs a local workaround afterwards, I'm happy to update this PR accordingly.

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.

Build fails on newer Rust due to semicolon_in_expressions_from_macros

3 participants