cargo/tests
bors 60e65eefb2 Auto merge of #13046 - linyihai:cargo-add-public, r=epage
Add `--public` for `cargo add`

## What does this PR try to resolve?
Complete https://github.com/rust-lang/cargo/issues/13037

This PR want to add `--public/--no public` flag for `cargo add`

Note: this assumes we'll remove workspace inheritance support for `public` as it sounds like we'll be reverting it https://github.com/rust-lang/rust/issues/44663#issuecomment-1826474620.  If we decide to keep workspace inheritance, we'll need to come back and update this.

## How should we test and review this PR?
Most of Code were reference `cargo add --optional`, So can reviewed the new code based on the part of  `optional` code.

The new testcases were origin from the `cargo add --optional` part.
- `public` testcase:there is no dependencies and will be add `public` dependencies.
- `no_public` testcase:  there is no dependencies  and will be add `no_public` dependencies.
- `overwrite_public` testcase: the dependencies already exists but will be overwrite with `public`.
- `overwrite_no_public` testcase: the dependencies already exists but will be overwrite with `no_public`.
- `overwrite_public_with_no_public` testcase: the dependencies already marked as `no_public` and will be overwrite with `public`.
- `overwrite_no_public_with_public` testcase: the dependencies already marked as `public` and will be overwrite with `no_public`.
2023-12-01 17:33:20 +00:00
..
build-std fix: reorder --remap-path-prefix flags for -Zbuild-std 2023-11-28 15:29:03 -05:00
testsuite Auto merge of #13046 - linyihai:cargo-add-public, r=epage 2023-12-01 17:33:20 +00:00