Skip to content

fix: resolve current_rs! paths in nested Cargo workspaces#449

Closed
leno23 wants to merge 1 commit into
assert-rs:mainfrom
leno23:fix/nested-workspace-current-rs-415
Closed

fix: resolve current_rs! paths in nested Cargo workspaces#449
leno23 wants to merge 1 commit into
assert-rs:mainfrom
leno23:fix/nested-workspace-current-rs-415

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

  • Fix current_rs!() / current_dir!() / cargo_rustc_current_dir!() in nested workspace layouts (e.g. a sub-workspace excluded from the root workspace).
  • Prefer CARGO_MANIFEST_DIR when file! resolves relative to the package directory.
  • Keep the previous outermost-workspace heuristic as a fallback when file! is workspace-relative (snapbox’s own workspace build).

Test plan

Fixes #415

Made with Cursor

When CARGO_MANIFEST_DIR points at the package being tested, use it as
the rustc current dir if file! resolves there. Otherwise keep the
workspace-root fallback for workspace-relative file! paths.

Fixes assert-rs#415
@leno23 leno23 force-pushed the fix/nested-workspace-current-rs-415 branch from 898504f to 8e94911 Compare May 17, 2026 14:29
@epage epage closed this May 18, 2026
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.

snapbox::current_rs!(), etc. give wrong path in nested workspaces

2 participants