Commit Graph

16919 Commits

Author SHA1 Message Date
bors 54d8815d04 Auto merge of #13653 - weihanglo:rust-1.78.0-backport, r=epage
[beta-1.78] Do not strip debuginfo by default for MSVC

Beta backports:

- https://github.com/rust-lang/cargo/pull/13630

In order to make CI pass, the following PRs are also cherry-picked:

-
2024-03-26 18:23:22 +00:00
Weihang Lo fbf8b9f1ec
Do not strip debuginfo by default for MSVC
Co-authored-by: Jakub Beránek <berykubik@gmail.com>
2024-03-26 13:33:44 -04:00
bors fd4fd37f31 Auto merge of #13616 - ehuss:beta-fix-cdn-publish, r=weihanglo
[beta 1.78] Fix publish script due to crates.io CDN change

This is a beta backport of https://github.com/rust-lang/cargo/pull/13614 to fix publishing in the next release.
2024-03-21 17:04:56 +00:00
Eric Huss 54a60d010d Fix publish script due to crates.io CDN change 2024-03-21 09:38:01 -07:00
bors 2fe739fcf1 Auto merge of #13591 - epage:namespace, r=weihanglo
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
2024-03-15 21:39:18 +00:00
bors 36108cbebf Auto merge of #13593 - epage:toml2, r=Muscraft
refactor: Expose source/spans to Manifest for emitting lints

### What does this PR try to resolve?

This is a follow up to #13589.

This does nothing on its own.

This is meant to short-circuit some of my refactorings so Muscraft can
start on their work on adding lints while I work to move out existing
warnings into being able to be converted to lints.

### How should we test and review this PR?

This includes documentation changes suggested in #13589

### Additional information
2024-03-15 21:09:29 +00:00
bors c319962079 Auto merge of #13337 - epage:unicode, r=weihanglo
feat(tree): Control `--charset` via auto-detecting config value

### What does this PR try to resolve?

This tries to generalize `cargo tree --charset` so any part of cargo's output can use it.  For example,
- `cargo search` could use this for fancier tables
- `cargo add` could use this for fancier feature lists
- #12235 could use this for fancy rendering like miette does (CC `@Muscraft` )
- Progress bars could use fancier characters <-- this is what I'm personally working towards

This builds on the idea from #12889 that we can use fancier terminal features so long as we have good auto-detection and provide users an escape hatch until the auto-detection is improved or in case they disagree.

As a side benefit
- `cargo tree` will auto-detect when the prior default of `--charset utf8` is a good choice
- Users can control `cargo tree --charset` via `.cargo/config.toml`

### How should we test and review this PR?

This is gradually introduced through the individual commits.

### Additional information
2024-03-15 20:41:31 +00:00
Ed Page a1fc7fe269 refactor: Expose source/spans to Manifest for emitting lints
This does nothing on its own.

This is meant to short-circuit some of my refactorings so Muscraft can
start on their work on adding lints while I work to move out existing
warnings into being able to be converted to lints.
2024-03-15 15:41:03 -05:00
Ed Page 196e8b44e7 docs: Explain what a resolved toml is 2024-03-15 15:29:56 -05:00
Ed Page 05feb07245 refactor: Group 'Manifest' accessors like we did the fields 2024-03-15 15:29:31 -05:00
bors 48fb957dcc Auto merge of #13589 - epage:toml, r=Muscraft
refactor(toml): Flatten manifest parsing

### What does this PR try to resolve?

This is just a clean up but the goals are
- Support diagnostics that show source by tracking `&str`, `ImDocument`, etc in `Manifest` by making each accessible in the creation of a `Manifest`
- Defer warning analysis until we know what is a local vs non-local workspace by refactoring warnings out into a dedicated step
- Centralize the logic for `cargo publish` stripping of dev-dependencies and their feature activations by allowing a `Summary` to be created from any "resolved" `TomlManifest`
- Enumerate all build targets in the "resolved" `TomlManifest` so they get included in `cargo publish`, reducing the work done on registry dependencies and resolving problems like #13456

Along the way, this fixed a bug where we were not reporting warnings from virtual manifests

### How should we test and review this PR?

### Additional information
2024-03-15 19:50:39 +00:00
Ed Page 9ea3f260a8 feat(toml): Add support for open namespaces 2024-03-15 12:54:05 -05:00
Ed Page 489dde1114 test: Show open-namespaces behavior 2024-03-15 12:53:55 -05:00
Ed Page 4ed67e3a33 refactor(toml): Flatten convert_toml
This is to work towards tracking everything needed for diagnostics in
`Manifest`
2024-03-15 12:00:06 -05:00
Ed Page dd56d79c83 refactor(toml): Only collect nested paths when needed
This simplifies the interface for `toml/mod.rs` and reduces the work we
do.
2024-03-15 12:00:06 -05:00
Ed Page 954142e582 refactor(toml): Move path workspace dep validation out of convert_toml
This is part of an effort to remove `convert_toml`
2024-03-15 12:00:06 -05:00
Ed Page 37c3080bea refactor(toml): Move path processing out of convert_toml
This is in an effort to remove `convert_toml`
2024-03-15 12:00:06 -05:00
Ed Page ff454fd452 refactor(toml): Consolidate how we track unused keys
This makes it act more like everything else, making this easier to
evolve over time.
2024-03-15 12:00:06 -05:00
Ed Page 714359289d fix(toml): Produce warnings for virtual manifests
This is prep for shifting unused keys warnings out of `convert_toml`
2024-03-15 12:00:06 -05:00
Ed Page fcc6981d00 refactor(toml): Centralize error wrapping 2024-03-15 12:00:06 -05:00
Ed Page 65bf96a10b fix(toml): Remove redundant trace 2024-03-15 12:00:06 -05:00
Ed Page 401c502e6a refactor(toml): Consolidate no-target errors
Moving this out for collapsing `convert_toml`
2024-03-15 12:00:06 -05:00
Ed Page a7b70e98f9 refactor(toml): Pull out unused warning code 2024-03-15 12:00:06 -05:00
Ed Page 8cd94e4cc4 refactor(toml): Simplify virtual manifest check 2024-03-15 12:00:06 -05:00
Ed Page 069c67a9aa refactor(toml): Move steps to top-level
Before, we split things up.  This makes it so everything has access to
every step so we can reap the benefits
- use `&str` and `ImDocument` for diagnostics
- access `original`
2024-03-15 12:00:06 -05:00
Ed Page b1743463bc refactor(toml): Pull out toml parsing
So we can track spans for diagnostics
2024-03-15 12:00:06 -05:00
Ed Page c272cd7e37 refactor(toml): Resolve toml_edit deprecations 2024-03-15 12:00:06 -05:00
Ed Page 66b19adaa0 refactor(toml): Pull out deserialize code
- So we can eventually track the `original`
- So we can track spans for diagnostics
2024-03-15 12:00:06 -05:00
Ed Page 490583a573 refactor(toml): Pull out diagnostic emitting 2024-03-15 12:00:06 -05:00
Ed Page 69ee34a274 refactor(toml): Pull fs out as explicit step
So diagnostics can use this for reporting.
2024-03-15 12:00:06 -05:00
Ed Page 89f1cce439 refactor: Clarify what Manifest::original means
I plan to add a true `original`
2024-03-15 12:00:05 -05:00
Ed Page b321285501 refactor(schema): Decouple forms of name validation 2024-03-15 11:49:07 -05:00
Ed Page b8a684674a feat: Add 'open-namespaces' feature
This is a step towards #13576
2024-03-15 11:23:18 -05:00
Ed Page c8fa7096d4 refactor: Group alt Manifest formats
This is prep for adding more
2024-03-15 10:37:30 -05:00
bors 403fbe2b49 Auto merge of #13518 - baby230211:fix/strip-feature-dev-dep, r=epage
fix: strip feature dep when dep is dev dep

### What does this PR try to resolve?
This change aims to strip features dependencies without a version key to be published.
If a dev-dependency is missing the version, it will be stripped from the packaged manifest.

The features table may contains the deps in following places.
- Target
  - normal
  - dev
  - build
  - normal-and-dev
- normal
- dev
- build
- normal-and-dev

### How should we test and review this PR?

See the initial commit, it shows current behavior that will cause error when feature has deps that point to dev_dep and doesn't have a version specified.

Title | orignal toml | published toml |
---- | ---- | ---- |
Before |   feature = ["dev-dep/feature"]  <br/> [dev-dependencies] <br/> dev-dep = { .., features: ["feature"] }   |   feature = ["dev-dep/feature"] <br/> [dev-dependencies] <br/> dev-dep = { .., features: ["feature"] } |
After |  feature = ["dev-dep/feature"]  <br/> [dev-dependencies] <br/> dev-dep = { .., features: ["feature"] }  | feature = [] <br/> [dev-dependencies] ```

Fix: #12225
2024-03-14 20:20:14 +00:00
bors 601670a218 Auto merge of #13581 - LuuuXXX:issue-12692, r=weihanglo
fix(ci): bump check error when PR is behind master

### What does this PR try to resolve?

Fixes: https://github.com/rust-lang/cargo/issues/12692
2024-03-14 14:05:25 +00:00
LuuuX fb616a0f69 fix: bump check error 2024-03-14 21:28:14 +08:00
SeanHsieh 75130eb6e3 fix(add): strip feature dep when dep is dev dep or target dev dep 2024-03-14 14:27:21 +08:00
bors 7065f0ef4a Auto merge of #13575 - pavedroad:master, r=ehuss
chore: remove repetitive word
2024-03-12 13:25:15 +00:00
SeanHsieh 465e36150c test(add): add publish feature contains different kinds dep 2024-03-12 20:42:45 +08:00
pavedroad b540813a90 chore: remove repetitive words
Signed-off-by: pavedroad <qcqs@outlook.com>
2024-03-12 14:40:20 +08:00
bors 685c18d17e Auto merge of #13564 - epage:r, r=weihanglo
refactor(lockfile): Make diffing/printing more reusable

### What does this PR try to resolve?

This is prep for #13561 so we can tailor the printing of lockfile changes to each use without a bunch of flags.

### How should we test and review this PR?

### Additional information
2024-03-12 00:48:46 +00:00
bors fe5de0755d Auto merge of #13567 - LuuuXXX:issue-7876, r=weihanglo
test: Add tests for using worktrees and sparse checkouts

### What does this PR try to resolve?

Based on `@eminence's` [comment](https://github.com/rust-lang/cargo/issues/7876#issuecomment-1325974682), Add tests for using worktrees or spase checkouts.

### How should we test and review this PR?

Checkout and run tests:
```
cargo test --package cargo --test testsuite -- git::git_worktree_with_original_repo_renamed
```
```
cargo test --package cargo --test testsuite -- git::git_worktree_with_bare_original_repo
```
2024-03-11 15:44:10 +00:00
LuuuX 062d8ce66a Add tests for using worktrees and sparse checkouts 2024-03-11 23:00:09 +08:00
bors d79fdf33ee Auto merge of #13548 - Turbo87:user-agent, r=weihanglo
util/network/http: Use `cargo/1.2.3` user-agent header

... instead of `cargo 1.2.3`.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent#syntax declares that the product and product version are usually separated by a slash. This commit changes the cargo `User-Agent` header to follow that syntax instead of using whitespace for the separator.
2024-03-09 16:16:37 +00:00
bors 29cf016014 Auto merge of #13537 - epage:msrv-compat, r=Eh2406
fix: Consistently compare MSRVs

### What does this PR try to resolve?

Currently, we use several strategies to evaluate an MSRV
- Relying in `impl Ord for RustVersion` (`dep_msrv <= pkg_msrv`)
- 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

### How should we test and review this PR?

Refactors are split out

I didn't go through and verify if or how the different approaches varied in behavior, instead consolidating on the one, so only unit tests around the consolidated behavior were added rather than trying to hit all of the corner cases within the various ways `RustVersion` is used.

### Additional information
2024-03-08 17:36:23 +00:00
bors 36cf66a476 Auto merge of #13562 - epage:hyperlink, r=weihanglo
refactor(shell): Use alternate to close links

### What does this PR try to resolve?

Simplifies the code for includign hyperlinks, especially the fact that this allows for including the variable in the format string.

### How should we test and review this PR?

Hand tested each case as we don't have SVG support for hyperlinks and we don't have SVG tests for these cases

### Additional information
2024-03-08 16:38:59 +00:00
Ed Page af9f1346a2 refactor(shell): Use alternate to close links 2024-03-08 08:15:51 -06:00
Ed Page 619238e86b refactor(lockfile): Pull out dep change detection 2024-03-07 19:52:56 -06:00
Ed Page 9e18941ff6 refactor(lockfile): Pull out alternatives logic 2024-03-07 19:52:56 -06:00