This assumes that if any of the machine applicable fixes in
a diagnostic suggestion is a duplicate, we should see the
entire suggestion as a duplicate.
refactor(toml): Split out an explicit step to resolve `Cargo.toml`
### What does this PR try to resolve?
This builds on #13664 and #13666. Currently, once we have deserialized `Cargo.toml`, we pass it to a large machinery (`to_real_manifest`, `to_virtual_manifest`) so that
- `Cargo.toml` is resolved
- `Summary` is created
- `Manifest` is created
This splits out the resolving of `Cargo.toml` which is mostly workspace inheritance today.
While splitting logic conjoined like this can be a bit messy in the short term, the hope is that overall this makes the logic easier to follow (more condensed, focused sections to view; more explicit inputs/outputs).
In particular, I hope that this will make it clearer and easier to shift more logic into the resolving step, specifically the inferring of build targets for #13456.
### How should we test and review this PR?
This is broken up into very small steps in the hope that it makes it easier to analyze a step.
### Additional information
refactor(toml): Expose surce/spans for VirtualManifests
### What does this PR try to resolve?
This is a follow up to #13593, expanding support from `Manifest` to `VirtualManifest` as well.
This also does other clean up along the way in preparation for making a more explicit `resolve_toml` phase.
### How should we test and review this PR?
### Additional information
feat: Add 'open-namespaces' feature
### What does this PR try to resolve?
This is a step towards #13576
### How should we test and review this PR?
### Additional information
We used several strategies
- Relying in `impl Ord for RustVersion`
- Converting to version requirements
- Decrementing a version
This consolidates around one strategy: `RustVersion::is_compatible_with`
- Ensure the comparisons have the same behavior
- Centralize knowledge of how to handle pre-release rustc
- Losslessly allow comparing with either rustc or workspace msrv
This uses a new feature from snapbox that let's us render terminal
styling in SVG files. This let's us see / visualize ANSI escape codes,
including in github's UI (will render images, including side-by-side
images for diffs).
fix(add): Improve error when adding registry packages while vendored
### **What does this PR try to resolve?**
When a vendored directory is established, cargo add no longer adds new packages. Instead, it tries to translate a package name into a package that already exists in the vendored directory.
[More details](https://github.com/rust-lang/cargo/issues/10729#issue-1260548746)
Since `@epage` has done most of the work, here I do the rest of the finishing work.
Improves the error from #10729
### **How should we test and review this PR?**
The implementation procedure is as follows:
https://github.com/rust-lang/cargo/issues/10729#issuecomment-1191633351
Test steps:
1. Try to get an arbitrary crate and execute `cargo vendor` command.
2. Configure the vendor directory in .cargo/config.toml.
3. Add `alter-registry` to the config.toml file.
```
[registries]
alter-registry= { index = "XXX" }
```
4. run the same `cargo add` command.
```
cargo add another-crate --registry alter-registry
```