You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running a command like cargo new main never adds the [workspace] section into the Cargo.toml it just created. This is already reported as a feature request in #8365, but there are more issues with that.
In case you cd into that directory and run cargo new baz there is a message that "baz" was added as a member into the workspace of its parent. But actually nothing is added and there is still no [workspace] section in the first Cargo.toml. But if you add an empty [workspace] section into the first Cargo.toml manually, before adding a child package then the child package will be added into the members array of the [workspace] section as well. If Cargo can't add a new workspace member without the [workspace] section existing then an error must be printed. Otherwise it should create the [workspace] section and add the new member into it. Now it just lies and it looks like a bug.
Steps
This is from Bash of Git for Windows:
$ cargo new --vcs none main && cd main
Creatingbinary(application) `main` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
$ cat Cargo.toml[package]
name = "main"
version = "0.1.0"
edition = "2021"[dependencies]
$ cargo new baz
Creating binary (application) `baz` package
Adding `baz` as member of workspace at `D:\develop\2\main`
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
$ cat Cargo.toml[package]
name = "main"
version = "0.1.0"
edition = "2021"[dependencies]
$ rm -rf baz
$ echo "[workspace]" >> Cargo.toml
$ cat Cargo.toml[package]
name = "main"
version = "0.1.0"
edition = "2021"[dependencies][workspace]
$ cargo new baz
Creating binary (application) `baz` package
Adding `baz` as member of workspace at `D:\develop\2\main`
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
$ cat Cargo.toml[package]
name = "main"
version = "0.1.0"
edition = "2021"[dependencies][workspace]
members = ["baz"]
Problem
Running a command like
cargo new main
never adds the[workspace]
section into theCargo.toml
it just created. This is already reported as a feature request in #8365, but there are more issues with that.In case you
cd
into that directory and runcargo new baz
there is a message that "baz" was added as a member into the workspace of its parent. But actually nothing is added and there is still no[workspace]
section in the firstCargo.toml
. But if you add an empty[workspace]
section into the firstCargo.toml
manually, before adding a child package then the child package will be added into themembers
array of the[workspace]
section as well. If Cargo can't add a new workspace member without the[workspace]
section existing then an error must be printed. Otherwise it should create the[workspace]
section and add the new member into it. Now it just lies and it looks like a bug.Steps
This is from Bash of Git for Windows:
Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: