Commit graph

14763 commits

Author SHA1 Message Date
Arlo Siemsen 3d8e8d32cd credential: make gnome-secret built-in as cargo:libsecret 2023-08-17 13:58:18 -05:00
bors 937b930a77 Auto merge of #12518 - arlosi:cred-dlopen, r=epage
cargo-credential-gnome-secret: dynamically load libsecret

Building `cargo-credential-gnome-secret` currently requires the `libsecret` development libraries to be installed and findable via `pkg-config`. This is often an extra step for users and complicates CI builds.

This loads the required functions from `libsecret` dynamically using `libloading` which uses `dlopen` internally.

Closes #12503

Testing this requires manually installing the credential provider on a system with libsecret set up. I tested it on Arch Linux.
2023-08-17 16:56:21 +00:00
bors 9a35c0bf88 Auto merge of #12507 - arlosi:1password, r=epage
credential-providers: make 1password no longer built-in

Since 1password is just one of many potential CLI-based credential providers, it makes more sense for it to be installable as a plugin rather than built-in to Cargo.

This means that `cargo:1password` will no longer work as a credential provider.

The replacement would be `cargo install cargo-credential-1password` and using `cargo-credential-1password` instead.

r? `@ehuss`
2023-08-17 14:21:13 +00:00
Arlo Siemsen b74e5a0e7e credential: make 1password no longer built-in 2023-08-17 00:47:30 -05:00
bors 7b61184ad1 Auto merge of #12498 - Kobzol:run-verbose-print-env, r=arlosi
Print environment variables for `cargo run` in extra verbose mode
2023-08-17 05:32:16 +00:00
Arlo Siemsen 627936bdf6 cargo-credential-gnome-secret: dynamically load libsecret 2023-08-17 00:18:00 -05:00
bors 3a34fca9ee Auto merge of #12517 - weihanglo:bump-cargo-util-0.2.6, r=epage
chore(cargo-util): bump version to 0.2.6
2023-08-16 19:25:54 +00:00
Weihang Lo 5691da2b79
chore(cargo-util): bump version to 0.2.6 2023-08-16 20:06:40 +01:00
bors b6254cae48 Auto merge of #12512 - arlosi:rename-basic-cred-provider, r=epage
credential: rename cargo:basic to cargo:token-from-stdout

Multiple people have said that the name of the `cargo:basic` credential provider is confusing, since it's not doing HTTP Basic authentication.

Rename `cargo:basic` to `cargo:token-from-stdout`, which more accurately describes what it does.
2023-08-16 16:29:48 +00:00
bors 11870e3a16 Auto merge of #12513 - weihanglo:fix-bump-check, r=epage
fix(xtask-bump-check): query by package name to detect changes
2023-08-16 14:58:44 +00:00
Weihang Lo 1ee9db3123
fix(xtask-bump-check): query by package name to detect changes
versions and paths of a workspace members between the original and
a checked-out workspace are different, and shouldn't be included in
hash keys when querying packages.
2023-08-16 15:46:43 +01:00
Jakub Beránek 4eac5a1fd1
Add test for environment variables in verbose mode for cargo bench 2023-08-16 13:47:39 +02:00
Jakub Beránek 9267277048
Print environment variables for cargo test in extra verbose mode 2023-08-16 13:41:54 +02:00
Arlo Siemsen 1065f213e3 credential: rename cargo:basic to cargo:token-from-stdout 2023-08-15 23:56:11 -05:00
bors 93e1aa2ea1 Auto merge of #12508 - weihanglo:ci-github-sha, r=ehuss
ci: use pull request head commit whenever possible
2023-08-16 02:01:29 +00:00
Weihang Lo 4360d9d2ad
ci: use pull request head commit whenever possible
The `github.sha` is a merge commit with the parents of latest master
and the head of the pr. Trying to diff the changes from that merge
SHA to base will show all changes that have been made in-between.

And that doesn't seem about right.

We switch to `github.event.pull_request.head.sha` if there is a pr.

See: https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/version-bump.20CI.20failing
2023-08-16 00:11:23 +01:00
bors bc1842686f Auto merge of #12504 - ehuss:hermit-abi, r=epage
Update hermit-abi

This updates hermit-abi from 0.3.1 to 0.3.2. 0.3.1 was yanked, and I keep getting warnings about it.

Changes: https://github.com/hermitcore/rusty-hermit/compare/hermit-abi-0.3.1...hermit-abi-0.3.2
2023-08-15 21:50:00 +00:00
bors a11f624c97 Auto merge of #11447 - arlosi:exact, r=weihanglo
Crate checksum lookup query should match on semver build metadata

Since crates.io allows crate versions to differ only by build metadata, a query using `OptVersionReq::exact` + `next()` can return nondeterministic results.

This change fixes the issue by adding an additional `filter` that ensures the version is equal (including build metadata).

It still feels somewhat wrong that a query using `exact` can match multiple crates, so an alternative fix would be to add a new variant of `OptVersionReq` that also matched on build metadata.

Fixes #11412
2023-08-15 20:44:15 +00:00
Eric Huss a008741136 Update hermit-abi 2023-08-15 13:29:54 -07:00
Jakub Beránek 5405cd3a8b
Print environment variables for cargo run in extra verbose mode 2023-08-15 13:45:42 +02:00
bors 7c3904d6c3 Auto merge of #12501 - epage:rustdoc, r=weihanglo
fix(lints): Doctest extraction should respect `[lints]`

Note the first commit shows the bug and the second commit fixes it

Fixes #12497
2023-08-14 20:11:43 +00:00
bors fdd0d273e4 Auto merge of #12500 - weihanglo:relax-panic-msg, r=epage
test: relax assertions of panic message (again)
2023-08-14 19:25:49 +00:00
Ed Page 9984855904 fix(lints): Doctest extraction should respect [lints]
Fixes #12497
2023-08-14 14:23:59 -05:00
Ed Page a80dfae761 test(lints): Demo doctest bug 2023-08-14 14:21:25 -05:00
Weihang Lo 689defd4ba
test: relax assertions of panic message (again) 2023-08-14 19:32:39 +01:00
bors 3b4dd4b255 Auto merge of #12492 - weihanglo:keep-going-doc, r=epage
doc(unstable): `cargo test` does not provide `--keep-going`
2023-08-14 17:45:41 +00:00
bors f13759445f Auto merge of #12488 - weihanglo:ansi-color-log, r=epage
fix(log): enable ansi color only in terminal
2023-08-14 17:03:39 +00:00
Weihang Lo c07043b7cf
fix(log): enable ansi color only in terminal 2023-08-14 15:45:25 +01:00
bors 0067476575 Auto merge of #12490 - amosbird:cargo-yank-doc-fix1, r=weihanglo
Update cargo-yank.md

Fix version typo in cargo-yank.md
2023-08-14 14:42:05 +00:00
Weihang Lo b45ffa9283
doc(unstable): cargo test does not provide --keep-going 2023-08-14 15:26:38 +01:00
bors 18f2b46f28 Auto merge of #12491 - weihanglo:fix-future-incompat, r=ehuss
test: bypass `rustc --test` impl details for `-Zfuture-incompat-test`

Switch to an empty `lib.rs` from `main.rs`.

See https://github.com/rust-lang/rust/issues/114804#issuecomment-1677233355

Closes https://github.com/rust-lang/rust/issues/114804
2023-08-14 13:49:14 +00:00
Weihang Lo b567a67d5c
test: bypass rustc --test impl details for -Zfuture-incompat-test
Switch to an empty `lib.rs` from `main.rs`.

See https://github.com/rust-lang/rust/issues/114804#issuecomment-1677233355
2023-08-14 13:40:47 +01:00
Amos Bird 09215930e6
Update cargo-yank.md
Fix version typo in cargo-yank.md
2023-08-14 16:03:31 +08:00
bors 7e9de3f4ec Auto merge of #12478 - weihanglo:keep-going, r=epage
feat: remove `--keep-going` from `cargo test/bench`
2023-08-13 00:47:32 +00:00
bors 42f17989f7 Auto merge of #12483 - weihanglo:platform-dep, r=ehuss
chore: window-sys should be a platform-specific dependency

r? `@arlosi`
2023-08-12 23:46:34 +00:00
Weihang Lo 862226fc60
chore: window-sys should be a platform-specific dependency 2023-08-12 09:17:18 +01:00
bors 65cee64656 Auto merge of #12482 - rukai:rerun-if-changed-docs, r=weihanglo
docs: make the env var source of rerun-if-env-changed clearer

closes https://github.com/rust-lang/cargo/issues/12403

### What does this PR try to resolve?

The wording of the documentation on [rerun-if-env-changed](https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorerun-if-env-changedname) was misleading which led me to be confused by the behavior of cargo and then raise https://github.com/rust-lang/cargo/issues/12403
These changes should avoid users being confused by this in the future.
2023-08-12 00:42:04 +00:00
Lucas Kent 24ad2bc24c docs: make the env var source of rerun-if-env-changed clearer 2023-08-12 10:27:21 +10:00
Arlo Siemsen fb98f3fcba Add test differ_only_by_metadata 2023-08-11 18:42:40 -05:00
Arlo Siemsen 8d6464000e Crate checksum lookup includes build metadata 2023-08-11 18:32:46 -05:00
bors 3a73377919 Auto merge of #12479 - weihanglo:credential, r=epage
doc: note the backward compatible `.cargo/credential` file exists
2023-08-11 16:35:27 +00:00
Weihang Lo 94a1217789
doc: note the backward compatible .cargo/credential file exists 2023-08-11 17:25:58 +01:00
Weihang Lo de8b9139ba
feat: remove completions of --keep-going for bench/test
To test, simply run:

zsh

```zsh
fpath+=$PWD/src/etc
autoload -Uz compinit
compinit

cargo t <tab>
```

bash:

```bash

. ./src/etc/cargo.bashcomp.sh

cargo t <tab>
```
2023-08-11 15:42:20 +01:00
Weihang Lo 5ae529b24e
feat: remove --keep-going from cargo test/bench
It confuses people that both `--no-fail-fast` and `--keep-going` exist
on `cargo test` and `cargo bench` but with slightly different behavior.
The intended use cases for `--keep-going` involve build commands like
`build`/`check`/`clippy` but never `test`/`bench`.

Hence, this commit removes `--keep-going` from `test`/`bench` and
provides guidance of `--no-fail-fast` instead.

If people really want to build as many tests as possible, they can also
do it in two steps:

    cargo build --tests --keep-going
    cargo test --test --no-fail-fast
2023-08-11 14:29:02 +01:00
bors 3705df02e3 Auto merge of #12475 - compiler-errors:unelided-lifetime, r=epage
Fix elided lifetime in associated const

Fix an unelided lifetime in an associated const.

The old code was equivalent to:

```rust
impl<'a> RegistryConfig {
    /// File name of [`RegistryConfig`].
    const NAME: &'a str = "config.json";
}
```

and not `&'static str`, as it might be in a regular `const` item.

This "regressed" in rust-lang/rust#97313, which started allowing this behavior (inadvertently, as far as I can tell). It's not necessarily clear to me that this is sound (or at least, it's not something we intended to be able to express), but it's also preventing me from doing crater runs to investigate fallout of this issue (rust-lang/rust#114713 and rust-lang/rust#114716).
2023-08-11 02:28:46 +00:00
Michael Goulet b4a26b0f4c Fix elided lifetime in associated const 2023-08-11 01:10:32 +00:00
bors 7da103076e Auto merge of #12463 - stupendoussuperpowers:nocapture_test_msg, r=epage
prompt the use of `--nocapture` flag if `cargo test` process is terminated via a signal.

Fixes #10855

As per the discussion on this issue, we want to prompt the user to use `--nocapture` if a test is terminated abnormally. The motivation for this change is described in the issue.

We check for 3 things before we display this flag. -
- `!is_simple` (if the test ended with a non 101 status code)
- `harness` (if the standard test harness was used), and
- `!nocapture` (whether or not the `--nocapture` flag was already passed to the test)

There's further tests added to `test::nonzero_exit_status` that check that the `stderr` is correct for the various combinations possible when a test ends with a non-101 status code.

The new expected behavior is -
- Display `--nocapture` note for only non-zero exit statuses, when the `--nocapture` flag is not passed.
- Only display the note if we use a standard test harness since custom test harnesses do not implement the `--nocapture` flag.

To implement the check for the `--nocapture` flag, the function definition for `report_test_errors` was changed to add the `test_args: &[&str]` parameter. This parameter is passed from the immediate calling function. This private function is only called twice change and is not causing regression after making the appropriate changes to both the places it's called in.
2023-08-10 21:20:25 +00:00
bors 54550ef7a3 Auto merge of #12469 - arlosi:cred-stdio, r=weihanglo
cargo-credential: reset stdin & stdout to the Console

Credential providers run with stdin and stdout piped to Cargo to communicate. This makes it more difficult for providers to do anything interactive. The current workaround is for a provider to use the `cargo_credential::tty()` function when reading from the console by re-opening stdin using `/dev/tty` or `CONIN$`.

This PR makes the credential provider to re-attach itself to the current console so that reading from stdin and writing to stdout "just works" when inside the `perform` method of the provider. stderr is unaffected since it's not redirected by Cargo.

Only the `cargo-credential` crate is changed. No changes are needed to Cargo.

cc #8933
2023-08-10 20:20:00 +00:00
Arlo Siemsen 5ade1ad1eb cargo-credential: reset stdin & stdout to the Console 2023-08-10 13:33:33 -05:00
bors af431e1bb7 Auto merge of #12454 - alcolmenar:alcolmenar/fix-invalid-rm, r=epage
Fix cargo remove incorrectly removing used patches

### What does this PR try to resolve?

Fixes an issue where patches are being removed when member dependencies don't explicitly contain the patched crate.

Fixes #12419

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

- Created a test for the failing use case
- Verify passing test

<!--
### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.

-->
2023-08-10 18:00:32 +00:00