Skip to content

Commit 2fef2e5

Browse files
committed
Auto merge of #8200 - Julian-Wollersberger:master, r=alexcrichton
Rephrased error message for disallowed sections in virtual workspace I changed the error message from `virtual manifests do not specify [target]` to `This virtual manifest specifies a [target] section, which is not allowed` because the old one confused me. I encountered it while hacking on Rustc in CLion. I made a change to the `Cargo.toml` I had copied from StackOverflow and after the next restart code analysis and go-to-definition stopped working. After some fiddling, I tracked that down to my change in `Cargo.toml`. It took me a while because, like I said, the error message from CLion didn't make sense to me. ``` 19:13 Cargo project update failed: Execution failed (exit code 101). /home/julian/.cargo/bin/cargo metadata --verbose --format-version 1 --all-features stdout : error: failed to parse manifest at `/home/julian/Dokumente/Rust/Compiler/rust/Cargo.toml` Caused by: virtual manifests do not specify [target] stderr : ``` I hope this change avoids future confusion :)
2 parents cb7cff1 + d6a1428 commit 2fef2e5

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/cargo/util/toml/mod.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -1320,43 +1320,43 @@ impl TomlManifest {
13201320
config: &Config,
13211321
) -> CargoResult<(VirtualManifest, Vec<PathBuf>)> {
13221322
if me.project.is_some() {
1323-
bail!("virtual manifests do not define [project]");
1323+
bail!("this virtual manifest specifies a [project] section, which is not allowed");
13241324
}
13251325
if me.package.is_some() {
1326-
bail!("virtual manifests do not define [package]");
1326+
bail!("this virtual manifest specifies a [package] section, which is not allowed");
13271327
}
13281328
if me.lib.is_some() {
1329-
bail!("virtual manifests do not specify [lib]");
1329+
bail!("this virtual manifest specifies a [lib] section, which is not allowed");
13301330
}
13311331
if me.bin.is_some() {
1332-
bail!("virtual manifests do not specify [[bin]]");
1332+
bail!("this virtual manifest specifies a [[bin]] section, which is not allowed");
13331333
}
13341334
if me.example.is_some() {
1335-
bail!("virtual manifests do not specify [[example]]");
1335+
bail!("this virtual manifest specifies a [[example]] section, which is not allowed");
13361336
}
13371337
if me.test.is_some() {
1338-
bail!("virtual manifests do not specify [[test]]");
1338+
bail!("this virtual manifest specifies a [[test]] section, which is not allowed");
13391339
}
13401340
if me.bench.is_some() {
1341-
bail!("virtual manifests do not specify [[bench]]");
1341+
bail!("this virtual manifest specifies a [[bench]] section, which is not allowed");
13421342
}
13431343
if me.dependencies.is_some() {
1344-
bail!("virtual manifests do not specify [dependencies]");
1344+
bail!("this virtual manifest specifies a [dependencies] section, which is not allowed");
13451345
}
13461346
if me.dev_dependencies.is_some() || me.dev_dependencies2.is_some() {
1347-
bail!("virtual manifests do not specify [dev-dependencies]");
1347+
bail!("this virtual manifest specifies a [dev-dependencies] section, which is not allowed");
13481348
}
13491349
if me.build_dependencies.is_some() || me.build_dependencies2.is_some() {
1350-
bail!("virtual manifests do not specify [build-dependencies]");
1350+
bail!("this virtual manifest specifies a [build-dependencies] section, which is not allowed");
13511351
}
13521352
if me.features.is_some() {
1353-
bail!("virtual manifests do not specify [features]");
1353+
bail!("this virtual manifest specifies a [features] section, which is not allowed");
13541354
}
13551355
if me.target.is_some() {
1356-
bail!("virtual manifests do not specify [target]");
1356+
bail!("this virtual manifest specifies a [target] section, which is not allowed");
13571357
}
13581358
if me.badges.is_some() {
1359-
bail!("virtual manifests do not specify [badges]");
1359+
bail!("this virtual manifest specifies a [badges] section, which is not allowed");
13601360
}
13611361

13621362
let mut nested_paths = Vec::new();

tests/testsuite/workspaces.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ fn ws_err_unused() {
21172117
[ERROR] failed to parse manifest at `[..]/foo/Cargo.toml`
21182118
21192119
Caused by:
2120-
virtual manifests do not specify {}
2120+
this virtual manifest specifies a {} section, which is not allowed
21212121
",
21222122
key
21232123
))

0 commit comments

Comments
 (0)