Skip to content

fix: avoid bail macros in expression position - #2843

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

Lioyae wants to merge 4 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

🚫 This pull request was removed from the merge queue because it was canceled by Philipp Oppermann (a GitHub user). See more details here.

  • 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.

@Lioyae

Lioyae commented Aug 9, 2026

Copy link
Copy Markdown
Author

Hi @phil-opp, thanks for the smaller-scoped #3086 — it makes sense as the minimal fix to unblock the build.

I did a nightly build on the latest main and counted the remaining semicolon_in_expressions_from_non_local_macros diagnostics: 129 sites across dora's crates (cli 57, core 20, coordinator 17, node-api 17, daemon 10, hub-client 4, runtime 4). One thing I noticed: #3086 covers 18 of the 20 dora-core sites, but two remain outside its 4 files — libraries/core/src/build/mod.rs:277 and libraries/core/src/topics.rs:510. These are warnings today — the lint was recently downgraded from deny — but rust-lang/rust#159218 proposes making it a hard error, so these sites would fail the nightly build once it lands.

If it's useful, I can scope this PR down to exactly the sites #3086 doesn't cover, so the two would be fully complementary and mergeable in any order — happy to push that anytime.

@Lioyae
Lioyae force-pushed the fix/bail-macro-expression branch from 9516ea6 to ff00071 Compare August 9, 2026 19:23

Copy link
Copy Markdown
Collaborator

🤖 Automated review by Claude Code — fully automated review, not vetted by a human.

I re-reviewed the latest commits, which rescope the change to the sites not covered by #3086 and add the remaining bail! sites. Every edit is still the same mechanical transformation — appending a trailing ; to a tail-position bail!/eyre::bail! or wrapping a arm => bail!(...) in { bail!(...); }. Since bail! expands to a diverging return Err(...), the block form still diverges and coerces in value positions, so there is no control-flow or behavior change. The latest commits look safe to merge — no new issues.


Generated by Claude Code

@Lioyae

Lioyae commented Aug 10, 2026

Copy link
Copy Markdown
Author

Thanks for the re-review! Happy to adjust the scope further if you'd prefer a smaller change — otherwise I'll keep it as-is and wait for your call.

@phil-opp

Copy link
Copy Markdown
Collaborator

Update: eyre-rs/eyre#294 was merged and a PR to do a new release is up: eyre-rs/eyre#296

Copy link
Copy Markdown
Collaborator

Heads up — this may no longer be needed. eyre 0.6.14 has been released, and it removes the trailing semicolon from every arm of the bail! macro:

 macro_rules! bail {
     ($msg:literal $(,)?) => {
-        return $crate::private::Err($crate::eyre!($msg));
+        return $crate::private::Err($crate::eyre!($msg))
     };
     …
 }

That semicolon was the entire cause of semicolon_in_expressions_from_macros / semicolon_in_expressions_from_non_local_macros, so with 0.6.14 the lint has nothing left to fire on and the call sites can stay in expression position.

I opened #3126, which is a one-package Cargo.lock bump with no source changes. Measured on rustc 1.99.0-nightly (12c36e253 2026-08-10), cargo +nightly check --all (excluding the PyO3 crates) goes from 154 trailing semicolon in macro used in expression position diagnostics across 17 crates to 0 — that covers all 48 files here plus the ones this PR doesn't reach.

Thank you for the original diagnosis in #2835 and for the careful validation work — separating the tokio nightly ICE from the actual dora problem is what made the root cause clear, and it's what made it easy to confirm the upstream release fixes it. Sorry the fix landed upstream after you'd already done the legwork here.

Deferring to the maintainers on whether to close this in favour of #3126, or land it anyway for the benefit of anyone pinned to an older eyre.


Generated by Claude Code

@phil-opp phil-opp closed this Aug 11, 2026
trunk-io Bot pushed a commit that referenced this pull request Aug 11, 2026
…supersedes #2843, #3086) (#3126)

chore(deps): bump eyre to 0.6.14 to fix expression-position `bail!`

eyre 0.6.14 removes the trailing semicolon from every arm of the `bail!`
macro. That semicolon was the sole cause of the
`semicolon_in_expressions_from_macros` /
`semicolon_in_expressions_from_non_local_macros` diagnostics reported in
 #2835, which fire whenever `bail!` is used as a block-tail expression or
as a bare `match` arm.

Bumping the lockfile clears all 154 affected call sites across 17 crates
without touching a single line of dora source, superseding the manual
semicolon insertion in #2843 and #3086.

Verified with rustc 1.99.0-nightly (12c36e253 2026-08-10):

  cargo +nightly check --all (excluding the PyO3 crates)
    eyre 0.6.12: 154 "trailing semicolon in macro used in expression
                 position" diagnostics
    eyre 0.6.14: 0

The only remaining future-incompat report comes from the third-party
`static_init_macro v1.0.4` and is unrelated.


Claude-Session: https://claude.ai/code/session_01BRDAyUb1r1nLd3i4Sc2UXy

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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