Cannot publish crate within workspace

Hi, I have a workspace with a bunch of crates, and two specific crates which I want to publish to crates.io. So the directory structure looks a bit like this:

baz-rs/
  Cargo.toml
  foo/
    Cargo.toml
  bar/
    Cargo.toml
  baz/
    Cargo.toml
  baz-cli/
    Cargo.toml

I want to publish baz and baz-cli. Inside the Cargo.toml of baz/ for instance You'll find:

[dependencies]
parser = { path = "../foo", version = "0.1.0" }

Unfortunately, when I try to cargo publish from within baz/ I get an error:

error: failed to verify package tarball

Caused by:
  no matching package named `parser` found
location searched: registry `https://github.com/rust-lang/crates.io-index`
required by package `baz v0.1.0

What can I do to get my crates published? They work fine locally. Please help!

You need to publish each crate in the workspace separately, and the published version should refer to the dependency on crates.io. You may want to read the releasing instructions on Tokio, which also has several crates here, as the same principles apply in your case.

I didn't really design the workspace with publishing each crate in mind. The names of the crates are generic and some of them do very simple things. Looks like I messed up.
Any suggestion on how I could correct this mess?

Combine them into one crate or give them better names I guess.

You can rename them to yourproject-genericname and publish a bunch of them, starting from the leaf crates.