Skip to content

Splicing out-of-tree cargo workspaces fails #3450

Open
@Synss

Description

@Synss

Splicing Cargo.toml files always assumes in-tree workspaces and crashes on out-of-tree workspaces.

Reproduction

Copy examples/crate_universe/cargo_workspace to examples/crate_universe/cargo_workspace_oot and modify the second to implement an out-of-tree workspace. See, for example, https://github.com/Synss/rules_rust/tree/pr-oot/

Then run

$ cd examples/crate_universe
$ REPIN=1 bazel mod deps --lockfile=update

Splicing fails with

error: failed to load manifest for workspace member `/tmp/.tmp17zZ7O/../num_printer`
referenced by workspace at `/tmp/.tmp17zZ7O/Cargo.toml`

Caused by:
  failed to read `/tmp/num_printer/Cargo.toml`

Caused by:
  No such file or directory (os error 2)

Error: Failed to generate lockfile

Compare with cargo

$ cd examples/crate_universe/cargo_workspace_oot/workspace
$ cargo run --quiet printer --version
Number Printer 

Analysis

It seems splicing always triggers the discovery, which assumes either flat or in-tree workspaces.

Note

I'm already working on the feature as we need it where I work. I'm already working on a patch and I'll upstream when I'm done.

See also

Out-of-tree workspaces are documented at

where the RFC appears to provide a more precise specification of the feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions