693 Commits

Author SHA1 Message Date
Ed Page
4ab2797f36 feat(lock): Print lockfile changes on all commands 2024-03-12 13:39:56 -05:00
bors
d438c80c45 Auto merge of #13603 - epage:toml3, r=weihanglo
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
2024-03-19 16:11:22 +00:00
Martin Robinson
8fa25ba41d chore: Fix minor grammar nit in command-line help
A *very* minor grammar correction. "Require" used in this way is
typically followed by the infinitive.
2024-03-18 14:32:28 +01:00
Ed Page
8152bfbb5e refactor(core): Expose all of the variants of VirtualManifests 2024-03-15 21:14:50 -05: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
Ed Page
9ea3f260a8 feat(toml): Add support for open namespaces 2024-03-15 12:54:05 -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
c272cd7e37 refactor(toml): Resolve toml_edit deprecations 2024-03-15 12:00:06 -05:00
Ed Page
b321285501 refactor(schema): Decouple forms of name validation 2024-03-15 11:49:07 -05:00
LuuuX
fb616a0f69 fix: bump check error 2024-03-14 21:28:14 +08:00
Ed Page
134ed93f60 fix: Consistently compare MSRVs
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
2024-03-05 10:59:08 -06:00
Ed Page
46584a4d6b refactor(schema): Pull RustVersion out into a mod 2024-03-04 16:45:58 -06:00
Ed Page
a980eed118 refactor(schema): Make manifest its own directory 2024-03-04 16:44:05 -06:00
Bryan Garza
604d2e40e2 chore: update pulldown-cmark to 0.10.0
Fixes: https://github.com/rust-lang/cargo/issues/13509
2024-03-04 20:14:44 +00:00
Ed Page
67b5aa4205 refactor(context): Rename config mod to context 2024-02-29 16:08:08 -06:00
Ed Page
14646e6af6 test: Make edition explicit on packages 2024-02-22 11:37:03 -06:00
Weihang Lo
d090365234
refactor: rename non-global context _gctx to _ctx 2024-02-23 15:30:44 -05:00
Ed Page
b14a70fe09 test(cli): Verify terminal styling
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).
2024-02-21 20:20:41 -06:00
bors
e08a81333c Auto merge of #13281 - LuuuXXX:issue-10729, r=epage
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
```
2024-02-22 17:28:17 +00:00
LuuuX
640c0774da Rename Fuzzy to Alternatives 2024-02-22 14:08:46 +08:00
LuuuX
a31184b9eb Added QueryKind::Normalized, and used it in cargo-add 2024-02-22 13:36:28 +08:00
bors
cafbc12bd9 Auto merge of #13467 - ehuss:global-tracker-old-cargo, r=weihanglo
Add global_cache_tracker stability tests.

This adds some tests to ensure that the database used in the global cache tracker stays compatible across versions. These tests work by using rustup to run both the current cargo and the stable cargo, and verifying that when switching versions, everything works as expected.

These tests will be ignored on developer environments if they don't have rustup, or don't have the stable toolchain installed. It does assume that "stable" is at least 1.76. It is required for the tests to run in CI, but will be disabled in rust-lang/rust since it does not have rustup.

I'm not expecting too much trouble with these tests, but if they become too fiddly or broken, they can always be changed or removed.

The support code for running "cargo +stable" is very basic right now. If we expand to add similar tests in the future, then I think we could consider adding support functions (such as [`tc_process`](64ccff290f/tests/testsuite/old_cargos.rs (L21-L36))) to make it easier or more reliable.
2024-02-21 21:32:07 +00:00
Eric Huss
a82794ec4a Fix path issues for running rustup wrapper on Windows.
Cargo likes to modify PATH, which circumvents the ability to choose the
correct "cargo" executable to run on Windows (because Windows uses PATH
for both binary and shared library searching).
2024-02-20 16:27:04 -08:00
Eric Huss
ccaa118d27 Add workaround for RUSTUP_WINDOWS_PATH_ADD_BIN.
On Windows, rustup has an issue with recursive cargo invocations. This
commit can be removed once
https://github.com/rust-lang/rustup/issues/3036 is resolved.
2024-02-20 13:24:50 -08:00
Eric Huss
8bb62310e5 cargo_test CI macro: add requires_rustup_stable
This adds the `requires_rustup_stable` option to the cargo_test macro to
require `rustup` to exist, and for the `stable` toolchain to be
installed.

It is required that stable be installed in Cargo's CI. On a developer
machine, the tests will be ignored if rustup is not installed. It will
also be ignored on rust-lang/rust's CI since it does not have rustup.
2024-02-20 12:36:03 -08:00
Eric Huss
f9ba89b0cd Add Execs::args
This adds the `Execs::args` method which forwards to
`ProcessBuilder::args` to specify multiple command arguments at once.
2024-02-20 12:33:32 -08:00
bors
64ccff290f Auto merge of #13465 - epage:delete, r=weihanglo
test: Remove empty snapshots

Inspired by #13461
2024-02-20 20:12:08 +00:00
Ed Page
2e878a4c38 test: Remove empty snapshots for help 2024-02-20 13:05:16 -06:00
Scott Schafer
305efa63cc
chore: Rename Config to GlobalContext 2024-02-20 11:55:15 -07:00
Eric Huss
daa884169c Fix redundant imports. 2024-02-20 09:57:03 -08:00
bors
e7ff7a6618 Auto merge of #12861 - weihanglo:msrv-aware-lockfile, r=ehuss
feat: respect `rust-version` when generating lockfile
2024-02-19 19:05:03 +00:00
Ed Page
9f31f8c675 chore: Update snapbox 2024-02-16 10:27:48 -06:00
Weihang Lo
cd7cca369e
refactor: don't derive Default for ResolveVersion
This prevents a misuse of it.
2024-02-16 10:06:32 -05:00
Weihang Lo
fb95ac4887
feat: respect rust-version when generating lockfile
Respect `package.rust-version` when generating lockfile, so that
a package with an old MSRV will never get an incompatible lockfile,
even when using the latest Cargo.

Users are still able to edit the `version` field in the lockfile
manually, if they intend to switch to a specific lockfile version.
2024-02-16 10:06:00 -05:00
Weihang Lo
7b0919399d
feat(cargo-util-schemas): TryFrom<PartialVersion> for RustVersion 2024-02-16 10:05:59 -05:00
bors
af08da6834 Auto merge of #13424 - weihanglo:fix-13016, r=epage
fix(test-support): remove special case for `$message_type`
2024-02-09 03:21:05 +00:00
Weihang Lo
c426fbe68d
fix(test-support): remove special case for $message_type 2024-02-08 22:05:03 -05:00
bors
99176cad92 Auto merge of #13420 - rust-lang:renovate/msrv, r=epage
chore(deps): update msrv (1 version) to v1.76.0

[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [MSRV:1](https://togithub.com/rust-lang/rust) | minor | `1.75.0` -> `1.76.0` |

---

### Release Notes

<details>
<summary>rust-lang/rust (MSRV:1)</summary>

### [`v1.76.0`](https://togithub.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1760-2024-02-08)

[Compare Source](https://togithub.com/rust-lang/rust/compare/1.75.0...1.76.0)

\==========================

<a id="1.76.0-Language"></a>

## Language

-   [Document Rust ABI compatibility between various types](https://togithub.com/rust-lang/rust/pull/115476/)
-   [Also: guarantee that char and u32 are ABI-compatible](https://togithub.com/rust-lang/rust/pull/118032/)
-   [Warn against ambiguous wide pointer comparisons](https://togithub.com/rust-lang/rust/pull/117758/)

<a id="1.76.0-Compiler"></a>

## Compiler

-   [Lint pinned `#[must_use]` pointers (in particular, `Box<T>` where `T` is `#[must_use]`) in `unused_must_use`.](https://togithub.com/rust-lang/rust/pull/118054/)
-   [Soundness fix: fix computing the offset of an unsized field in a packed struct](https://togithub.com/rust-lang/rust/pull/118540/)
-   [Soundness fix: fix dynamic size/align computation logic for packed types with dyn Trait tail](https://togithub.com/rust-lang/rust/pull/118538/)
-   [Add `$message_type` field to distinguish json diagnostic outputs](https://togithub.com/rust-lang/rust/pull/115691/)
-   [Enable Rust to use the EHCont security feature of Windows](https://togithub.com/rust-lang/rust/pull/118013/)
-   [Add tier 3 {x86\_64,i686}-win7-windows-msvc targets](https://togithub.com/rust-lang/rust/pull/118150/)
-   [Add tier 3 aarch64-apple-watchos target](https://togithub.com/rust-lang/rust/pull/119074/)
-   [Add tier 3 arm64e-apple-ios & arm64e-apple-darwin targets](https://togithub.com/rust-lang/rust/pull/115526/)

Refer to Rust's \[platform support page]\[platform-support-doc]
for more information on Rust's tiered platform support.

<a id="1.76.0-Libraries"></a>

## Libraries

-   [Add a column number to `dbg!()`](https://togithub.com/rust-lang/rust/pull/114962/)
-   [Add `std:#️⃣:{DefaultHasher, RandomState}` exports](https://togithub.com/rust-lang/rust/pull/115694/)
-   [Fix rounding issue with exponents in fmt](https://togithub.com/rust-lang/rust/pull/116301/)
-   [Add T: ?Sized to `RwLockReadGuard` and `RwLockWriteGuard`'s Debug impls.](https://togithub.com/rust-lang/rust/pull/117138/)
-   [Windows: Allow `File::create` to work on hidden files](https://togithub.com/rust-lang/rust/pull/116438/)

<a id="1.76.0-Stabilized-APIs"></a>

## Stabilized APIs

-   [`Arc::unwrap_or_clone`](https://doc.rust-lang.org/stable/std/sync/struct.Arc.html#method.unwrap_or_clone)
-   [`Rc::unwrap_or_clone`](https://doc.rust-lang.org/stable/std/rc/struct.Rc.html#method.unwrap_or_clone)
-   [`Result::inspect`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.inspect)
-   [`Result::inspect_err`](https://doc.rust-lang.org/stable/std/result/enum.Result.html#method.inspect_err)
-   [`Option::inspect`](https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.inspect)
-   [`type_name_of_val`](https://doc.rust-lang.org/stable/std/any/fn.type_name_of_val.html)
-   [`std:#️⃣:{DefaultHasher, RandomState}`](https://doc.rust-lang.org/stable/std/hash/index.html#structs)
    These were previously available only through `std::collections::hash_map`.
-   [`ptr::{from_ref, from_mut}`](https://doc.rust-lang.org/stable/std/ptr/fn.from_ref.html)
-   [`ptr::addr_eq`](https://doc.rust-lang.org/stable/std/ptr/fn.addr_eq.html)

<a id="1.76.0-Cargo"></a>

## Cargo

See [Cargo release notes](https://togithub.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-176-2024-02-08).

<a id="1.76.0-Rustdoc"></a>

## Rustdoc

-   [Don't merge cfg and doc(cfg) attributes for re-exports](https://togithub.com/rust-lang/rust/pull/113091/)
-   [rustdoc: allow resizing the sidebar / hiding the top bar](https://togithub.com/rust-lang/rust/pull/115660/)
-   [rustdoc-search: add support for traits and associated types](https://togithub.com/rust-lang/rust/pull/116085/)
-   [rustdoc: Add highlighting for comments in items declaration](https://togithub.com/rust-lang/rust/pull/117869/)

<a id="1.76.0-Compatibility-Notes"></a>

## Compatibility Notes

-   [Add allow-by-default lint for unit bindings](https://togithub.com/rust-lang/rust/pull/112380/)
    This is expected to be upgraded to a warning by default in a future Rust
    release. Some macros emit bindings with type `()` with user-provided spans,
    which means that this lint will warn for user code.
-   [Remove x86\_64-sun-solaris target.](https://togithub.com/rust-lang/rust/pull/118091/)
-   [Remove asmjs-unknown-emscripten target](https://togithub.com/rust-lang/rust/pull/117338/)
-   [Report errors in jobserver inherited through environment variables](https://togithub.com/rust-lang/rust/pull/113730/)
    This [may warn](https://togithub.com/rust-lang/rust/issues/120515) on benign problems too.
-   [Update the minimum external LLVM to 16.](https://togithub.com/rust-lang/rust/pull/117947/)
-   [Improve `print_tts`](https://togithub.com/rust-lang/rust/pull/114571/)
    This change can break some naive manual parsing of token trees in proc macro
    code which expect a particular structure after `.to_string()`, rather than just arbitrary Rust code.
-   [Make `IMPLIED_BOUNDS_ENTAILMENT` into a hard error from a lint](https://togithub.com/rust-lang/rust/pull/117984/)
-   [Vec's allocation behavior was changed when collecting some iterators](https://togithub.com/rust-lang/rust/pull/110353)
    Allocation behavior is currently not specified, nevertheless changes can be surprising.
    See [`impl FromIterator for Vec`](https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#impl-FromIterator%3CT%3E-for-Vec%3CT%3E)
    for more details.
-   [Properly reject `default` on free const items](https://togithub.com/rust-lang/rust/pull/117818/)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* * * * *" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/rust-lang/cargo).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIn0=-->
2024-02-08 17:02:30 +00:00
Weihang Lo
6072a0897a
chore(bump-check): include rustfix and cargo-util-schemas 2024-02-08 10:45:08 -05:00
renovate[bot]
5ea658df78 chore(deps): update msrv (1 version) to v1.76.0 2024-02-08 14:32:51 +00:00
Ed Page
c89ac1f234 feat(update): Summarize unchanged packages with updates
`--verbose` will show them.

This is prep for telling the user about `--breaking` and other flags.
2024-01-30 20:16:32 -06:00
Ed Page
db54c040ae fix(new): Print a 'Creating', rather than 'Created' status
This has bothered me about `cargo new` and `cargo init` for a while that
the output is read backwards, for example:
```diff
--- i/tests/testsuite/cargo_init/path_contains_separator/stderr.log
+++ w/tests/testsuite/cargo_init/path_contains_separator/stderr.log
@@ -1,3 +1,3 @@
+    Creating binary (application) package
 warning: the path `[ROOT]/case/test:ing/.` contains invalid PATH characters (usually `:`, `;`, or `"`)
 It is recommended to use a different name to avoid problems.
-     Created binary (application) package
```
2024-01-29 15:29:10 -06:00
Lin Yihai
41f7dc2b35 doc: Replace version with latest for jobserver link 2024-01-29 15:22:57 +08:00
Ed Page
675224b3a0 test(config): Shift to config.toml 2024-01-26 13:40:46 -06:00
Eric Huss
3c414b5cf1 Fix static_mut_ref warning. 2024-01-19 15:12:37 -08:00
Ed Page
c6c1df4758 chore: Make N-2 the default MSRV
We likely don't want to release these packages every 6 months just for
an MSRV bump.
By moving the MSRV out of the package, `cargo bump-check` will ignore
the MSRV bump.

Inspired by #13266
2024-01-18 15:30:41 -06:00
Ed Page
b291f42dce chore: Make N-0 MSRVs explicit
This will require a version bump every release but over-releasing these
packages is likely a lot better than over-releasing the N-3 packages,
which we won't have to do anymore after this.

My hope is the `auto` value will be approved and stabilized and then we
won't have to over-release anymore.
2024-01-18 15:28:04 -06:00
Ed Page
9438f80042 chore: Remove rust-version from private packages
I removed it from `cargo-test-support` and `cargo-test-macro`, despite
people depending on those (via git) because my long term plan is resting
on the `auto` value which won't affect git dependencies.
2024-01-18 15:24:25 -06:00
bors
187d4cf35e Auto merge of #13273 - BD103:master, r=weihanglo
Document why `du` function uses mutex

### What does this PR try to resolve?

After closing #13253, it [was suggested](https://github.com/rust-lang/cargo/pull/13253#issuecomment-1883286035) to document why the `du` function uses a `Mutex` instead of an `AtomicU64`. This will prevent others from making the same mistake I did. :)

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

N/A

### Additional information

N/A
2024-01-10 14:19:06 +00:00
BD103
c832cdf068
bump: cargo-util to 0.2.10 2024-01-10 08:01:47 -05:00