Commit graph

16671 commits

Author SHA1 Message Date
bors
63581b3fde Auto merge of #13448 - epage:test, r=weihanglo
fix(test): Suggest `--` for libtest arguments

We already do this so long as the argument doesn't look like a `cargo test` argument (e.g. `--show-output`)
but `--ignored` looks like `--ignore-rust-version` do the the suggestion algorithms prefix checks.

Before
```
error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.
```
After
```
error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'
  tip: to pass '--ignored' as a value, use '-- --ignored'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.
```

This was fixed in clap-rs/clap#5356 and we just need to update to take advantage of it.

Fixes #12494
2024-02-16 13:53:15 +00:00
Ed Page
6f93fa701e fix(test): Suggest -- for libtest arguments
We already do this so long as the argument doesn't look like a
`cargo test` argument (e.g. `--show-output`)
but `--ignored` looks like `--ignore-rust-version` do the the suggestion
algorithms prefix checks.

Before
```
error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.
```
After
```
error: unexpected argument '--ignored' found

  tip: a similar argument exists: '--ignore-rust-version'
  tip: to pass '--ignored' as a value, use '-- --ignored'

Usage: cargo test --ignore-rust-version [TESTNAME] [-- [ARGS]...]

For more information, try '--help'.
```

Fixes #12494
2024-02-16 07:11:12 -06:00
bors
57d14e4784 Auto merge of #13442 - epage:msrv, r=weihanglo
chore(ci): Drop MSRV:1 patch field

This was missed when I did MSRV:3

This make it less annoying for people to keep up on every patch with their own MSRVs.
2024-02-15 19:50:53 +00:00
bors
4506d41f14 Auto merge of #13446 - epage:add-period, r=arlosi
fix(add): Remove inconsistent period

Don't see this in other status messages, so removing it
2024-02-15 19:18:10 +00:00
bors
30addeaa90 Auto merge of #13434 - epage:add-features, r=weihanglo
fix(add): Ensure users know a feature is being created

Inspired by #13430 and #13411
2024-02-15 18:29:11 +00:00
bors
acc054c91d Auto merge of #13444 - ehuss:fix-custom-target, r=epage
Update tests for changes in latest nightly

There were two changes that has caused nightly tests to start failing:
* LLVM was updated, and that caused a change in the expected data layout for the target. (https://github.com/rust-lang/rust/pull/120055 update to LLVM 18)
* https://github.com/rust-lang/rust/pull/121049 Do not point at `#[allow(_)]` as the reason for compat lint triggering. The test was looking for the `unused_variables` note, which is no longer printed.
2024-02-15 17:46:50 +00:00
Eric Huss
52d2303dd0 Update future-incompat output test for latest nightly. 2024-02-15 09:36:40 -08:00
Eric Huss
d3c2a7723f Update target data layout for LLVM update. 2024-02-15 08:47:26 -08:00
Ed Page
22e1f9f124 chore(ci): Drop MSRV:1 patch field
This was missed when I did MSRV:3

This make it less annoying for people to keep up on every patch with
their own MSRVs.
2024-02-15 10:03:56 -06:00
bors
9d23d30943 Auto merge of #13436 - ehuss:clarify-build-script-metadata, r=epage
docs: Minor clarification of build script metadata.

This adds a minor clarification to the build script docs around links metadata. "As mentioned above in the output format" didn't really clue me in to what section it was talking about, or clearly tell me how to set the metadata.
2024-02-12 23:43:32 +00:00
Eric Huss
2630813d15 docs: Minor clarification of build script metadata. 2024-02-12 15:31:03 -08:00
bors
10a7f20ba0 Auto merge of #13435 - ehuss:fix-old-cargos, r=epage
Fix old_cargos tests

Some of these tests have bitrotted a bit since they aren't enabled by default. The issues are:

* Change to `config` to `config.toml` shouldn't have been made to this test since old cargos can't read config.toml.
* Cargo's own `Carog.toml` now using dotted keys breaks parsing on some old versions, ignore them.
* `cargo pkgid` is now emitting a different format.
* #13085 changed how packages are published in the testsuite to correctly include the `[features]` table in the generated `Cargo.toml`. This exposed an oversight in the `old_cargos::new_features` test wasn't actually testing things correctly. It now correctly illustrates the errors received in older versions. I have a vague memory of this, but I don't remember why it was done this way.
* #10907 changed the default config to use `[registries]` instead of `[source]` to implement source replacement of crates.io. Older versions can't handle that.

Some of these tests probably should just be deleted, since I don't think they are really bringing much value. Or at least they should have some floor that they won't test under. However, I'm not quite ready to do that.
2024-02-12 19:11:12 +00:00
Eric Huss
01d8a2d815 Fix old_cargos tests 2024-02-12 10:41:34 -08:00
bors
e4d67863fa Auto merge of #13433 - arlosi:builtin-replacement-messages, r=epage
Fix confusing error messages for sparse index replaced source

The built-in sparse crates.io index `index.crates.io` is implemented in Cargo using source replacement.

When an error occurs downloading from the sparse index, the message includes text that looks like the user configured source replacement, even when they did not.

This change extends the special case for the built-in replacement of crates.io to include all the error messages for source replacement in addition the the description special case.
2024-02-12 17:11:04 +00:00
Ed Page
bdc4e8ded0 fix(add): Remove inconsistent period
Don't see this in other status messages, so removing it
2024-02-12 11:06:04 -06:00
Ed Page
dbdebc378a fix(add): Ensure users know a feature is being created
Inspired by #13430 and #13411
2024-02-12 11:05:32 -06:00
Arlo Siemsen
dbd7c989a7 Fix confusing error messages for sparse index replaced source 2024-02-12 10:59:05 -06:00
bors
06a19e6725 Auto merge of #13429 - ehuss:edition-2024-lint, r=epage
Enable edition migration for 2024

This enables `cargo fix --edition` to migrate to the 2024 edition. The lint group is now available in rustc.
2024-02-10 21:45:15 +00:00
Eric Huss
fa7ec127ff Enable edition migration for 2024 2024-02-10 13:38:54 -08:00
bors
fc1d58fd05 Auto merge of #13425 - epage:changelog, r=weihanglo
docs(changelog): Clarify lints in virtual workspace error

Inspired by a conversation at #13155
2024-02-09 15:54:29 +00:00
Ed Page
499ee80627 docs(changelog): Clarify lints in virtual workspace error 2024-02-09 09:10:39 -06:00
bors
6283793853 Auto merge of #13422 - epage:profile, r=weihanglo
fix(compiler): Clarify Finished message

### What does this PR try to resolve?

As highlighted on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/cargo.20build.20default.20profile/near/418316528), many users think "Rust is slow" because of the `dev` profile.

While a perfect solution is still being worked out, this attempts what will hopefully be smaller, incremental step that hopefully maintains balance of the different needs.

We are changing the message from:
```
Finished dev [unoptimized + debuginfo] target(s) in [..]s
```
to
```
Finished `dev` profile [unoptimized + debuginfo] target(s) in [..]s
```
where `dev profile` is a link to [the Cargo book](https://doc.rust-lang.org/cargo/reference/profiles.html#profiles).

The intent is
- Clarify what `dev` even means
  - Add `profile` to give it context
  - Quote it to highlight this is something mutable
- Make the profile content stand out on hover by being a link
- Help people learn more by following the link

For now, this leaves the profile description alone.

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

### Additional information
2024-02-09 04:01:52 +00: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
Ed Page
69f38a08d1 fix(compiler): Link people to more info about profiles 2024-02-08 14:01:40 -06:00
Ed Page
e7e8d8748a fix(compiler): Clarify we're showing a profile name 2024-02-08 14:01:39 -06:00
Ed Page
1906d27cff refactor(compiler): Use inline string interpolation 2024-02-08 14:00:54 -06: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
bors
875850f2c8 Auto merge of #13421 - weihanglo:1.76-miscs, r=epage
chore(bump-check): include rustfix and cargo-util-schemas

The workspace now has these two crates in stable, beta, and nightly channels.
Checking semver compatibility against them should work now.
2024-02-08 16:18:34 +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
bors
0ec197b202 Auto merge of #13419 - weihanglo:jobserver, r=epage
chore: update to `jobserver` 0.1.28
2024-02-08 13:54:22 +00:00
Weihang Lo
3dcb66b791
chore: update to jobserver 0.1.28 2024-02-08 08:32:07 -05:00
bors
571edcb733 Auto merge of #13411 - linyihai:hint-for-cargo-new, r=epage
feat: Add hint for adding members to workspace

### What does this PR try to resolve?

Fixes https://github.com/rust-lang/cargo/issues/13403

### How should we test and review this PR?
Reviewd commit by commit

### Additional information
2024-02-08 11:35:56 +00:00
bors
d7d48e4598 Auto merge of #13402 - epage:add, r=weihanglo
fix: Don't duplicate comments when editing TOML

### What does this PR try to resolve?

`toml_edit` <0.22 has a bug that will cause
```toml
[lints]
rust.unsafe_op_in_unsafe_fn = "deny"

rust.explicit_outlives_requirements = "warn"
# rust.unused_crate_dependencies = "warn"

clippy.cast_lossless = "warn"
clippy.doc_markdown = "warn"
clippy.exhaustive_enums = "warn"
```
to be written out as
```toml
[lints]
rust.unsafe_op_in_unsafe_fn = "deny"
rust.explicit_outlives_requirements = "warn"
# rust.unused_crate_dependencies = "warn"

clippy.cast_lossless = "warn"
# rust.unused_crate_dependencies = "warn"

clippy.doc_markdown = "warn"
# rust.unused_crate_dependencies = "warn"

clippy.exhaustive_enums = "warn"
```
when it is parsed and then saved.

See toml-rs/toml#673

This affects any format-preserving edits we do, including:
- `cargo add`
- `cargo remove`
- `cargo init` / `cargo new` editing the workspace

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

I didn't add any tests as this is covered by `toml_edit`s tests (we already don't cover a fraction of the edit preserving tests it has)

### Additional information
2024-02-07 16:23:04 +00:00
bors
ccc84ccec4 Auto merge of #13415 - oli-obk:relax_test_for_rustc_changes, r=weihanglo
Relax a test to permit warnings to be emitted, too.

This change is necessary to allow rustc to actually start emitting the warning about the unused `mut`

See the test failure in https://github.com/rust-lang/rust/pull/120550#issuecomment-1931802095 for where this happens.
2024-02-07 15:37:49 +00:00
Oli Scherer
e60678fae0 Relax a test to permit warnings to be emitted, too.
This change is necessary to allow rustc to actually start emitting the warning about the unused `mut`
2024-02-07 15:16:40 +00:00
bors
9a6bafd956 Auto merge of #13416 - weihanglo:disable-lldb, r=epage
test: disable lldb test as it requires privileges to run on macOS

Resolves #13413
2024-02-07 14:53:24 +00:00
Weihang Lo
cd1f08899e
test: disable lldb test as it requires privileges to run on macOS 2024-02-07 09:45:25 -05:00
bors
fbebea2ebb Auto merge of #13412 - ehuss:update-git2, r=weihanglo
Update git2

This updates git2 primarily to pull in the update for libgit2 1.7.2 which fixes three security issues. `@weihanglo` did some investigation, and it looks like cargo may be susceptible to one of them with rev parsing. I am uncertain of the severity, but the CVE seems to imply that it is mainly a denial-of-service with an infinite loop from a well-crafted spec.

See https://github.com/libgit2/libgit2/releases/tag/v1.7.2 for more information.
2024-02-07 04:44:22 +00:00
Eric Huss
c30c13b3f1 Update git2 2024-02-06 20:11:27 -08:00
bors
993418efd7 Auto merge of #13410 - epage:note, r=weihanglo
fix: Switch more notes/warnings to lowercase

See https://doc.crates.io/contrib/implementation/console.html#style

By fixing existing cases, we make it more likely people will copy a case they should.

I left out multi-sentence cases because I was unsure how to handle those
2024-02-07 03:07:12 +00:00
Ed Page
69eb49194b fix: Switch more notes/warnings to lowercase
See https://doc.crates.io/contrib/implementation/console.html#style

By fixing existing cases, we make it more likely people will copy a case
they should.

I left out multi-sentance cases because I was unsure how to handle those

r? @weighanglo
2024-02-06 19:52:12 -06:00
bors
bb9b25f213 Auto merge of #13391 - linyihai:non_workspace_add_lib, r=weihanglo
Don't add the new package to workspace.members if there is no existing workspace in Cargo.toml.

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

If the current package has no workspace table in Cargo.toml,  then if you run `cargo add  foo`, don't create the workspace inline item and don't add `foo` into the workspace.members.

### How should we test and review this PR?
Reviewed by commit by commit.

### Additional information
2024-02-06 13:02:36 +00:00
Lin Yihai
9be95dfb1c feat: Add hint for adding members to workspace 2024-02-06 13:30:56 +08:00
Ed Page
12cf56abf1 fix: Don't duplicate comments when editing TOML
`toml_edit` <0.22 has a bug that will cause
```toml
[lints]
rust.unsafe_op_in_unsafe_fn = "deny"

rust.explicit_outlives_requirements = "warn"

clippy.cast_lossless = "warn"
clippy.doc_markdown = "warn"
clippy.exhaustive_enums = "warn"
```
to be written out as
[lints]
rust.unsafe_op_in_unsafe_fn = "deny"
rust.explicit_outlives_requirements = "warn"

clippy.cast_lossless = "warn"

clippy.doc_markdown = "warn"

clippy.exhaustive_enums = "warn"
```
when it is parsed and then saved.

See toml-rs/toml#675

This affects any format-preserving edits we do, including:
- `cargo add`
- `cargo remove`
- `cargo init` / `cargo new` editing the workspace
2024-02-05 16:50:59 -06:00
bors
e3de3bfea1 Auto merge of #13401 - ehuss:fix-curl-version, r=epage
Remove build metadata from curl-sys version.

#13379 added the build metadata to the curl-sys version, but cargo spits a warning that you shouldn't do that. It also didn't add the metadata correctly, as the version is `+curl-8.6.0`. This removes that, since it isn't needed.
2024-02-05 22:10:19 +00:00
bors
a03a7f6ecf Auto merge of #13400 - ehuss:cargo-add-md, r=weihanglo
Fix markdown line break in cargo-add

This fixes a backslash line break in the cargo-add documentation. A future version of mdbook will adhere to the commonmark spec more closely, and this will end up showing as a literal backslash.
2024-02-05 21:35:18 +00:00
Eric Huss
29ee35a9b3 Remove build metadata from curl-sys version. 2024-02-05 13:17:42 -08:00
Eric Huss
4abbe3b052 Fix markdown line break in cargo-add 2024-02-05 13:15:40 -08:00