Commit e512c7b
committed
fix(add): Report a missing source error for workspace dependencies
When you have
```toml
[workspace.dependencies]
apply.workspace = true
```
You have a source-less workspace dependency with an unused `workspace`
field.
In #13775, we removed support for source-less dependencies but missed
this case.
This mirrors the error message from `toml/mod.rs` that #13775 added.
Other options I considered:
- Making the presence of `workspace` an error in `cargo-util-schemas`
- Validating `workspace.dependencies` in `toml/mod.rs`, even when its not inherited
In both cases, they are behavior changes that and I wanted to keep the
focus of this change small rather than get tied up in what behavior
changes are safe or should be done with an Edition.
The second option could still lead to this panic if we move some of that
error reporting into later stages of Cargo.
Fixes #13981 parent ac120d9 commit e512c7b
File tree
2 files changed
+10
-10
lines changed- src/cargo/ops/cargo_add
- tests/testsuite/cargo_add/invalid_inherited_dependency
2 files changed
+10
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | | - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
520 | 524 | | |
521 | 525 | | |
522 | 526 | | |
| |||
Lines changed: 5 additions & 9 deletions
Loading
0 commit comments