11397 Commits

Author SHA1 Message Date
Eric Huss
c4e92ac69a Improve "wrong output" error. 2021-09-11 16:34:09 -07:00
bors
2274489833 Auto merge of #9900 - ehuss:version-bump, r=alexcrichton
Bump to 0.58.0, update changelog
2021-09-10 18:24:27 +00:00
bors
d58c646e95 Auto merge of #9898 - ehuss:rustc-profile-dev, r=alexcrichton
Fix rustc --profile=dev unstable check.

This fixes an oversight from #9685 where `cargo rustc --profile=dev` was accidentally changed to require `-Zunstable-options`.  1.54 and earlier supported that [here](https://github.com/rust-lang/cargo/blob/rust-1.54.0/src/bin/cargo/commands/rustc.rs#L490.

Fixes #9897
2021-09-10 17:54:06 +00:00
Eric Huss
8fe9eca8a5 Update changelog for 1.56 2021-09-10 10:29:28 -07:00
Eric Huss
0603dc0f20 Bump to 0.58.0 2021-09-10 09:47:06 -07:00
Eric Huss
49cf3de927 Fix rustc --profile=dev unstable check. 2021-09-10 09:40:37 -07:00
bors
c7a1c09709 Auto merge of #9896 - frogtile:master, r=ehuss
config.md: fix typo

match  value with comment
2021-09-10 03:37:39 +00:00
frogtile
0fe36b6e2a
config.md: fix typo
match  value with comment
2021-09-10 09:21:34 +06:00
bors
d7f413d682 Auto merge of #9893 - ehuss:windows-echo, r=alexcrichton
Enable some tests on windows.

This enables some more tests on windows that were disabled because `echo` is not always available. It's pretty easy to make a custom `echo`, so that's what this does.  I'm generally not comfortable with disabling tests just because there is an inconvenience like this.
2021-09-09 15:33:04 +00:00
bors
41687275e9 Auto merge of #9889 - ehuss:macos-strip, r=alexcrichton
Enable strip test on macos.

This enables the `strip_works` test for macos, which was fixed a while ago in https://github.com/rust-lang/rust/pull/82037.
2021-09-09 15:03:39 +00:00
bors
b9c27227b0 Auto merge of #9890 - ehuss:remove-z-force-warn, r=alexcrichton
Fix `cargo fix --edition` on stable.

I accidentally missed the removal of a `-Zunstable-options` flag in #9800.  This prevented `cargo fix --edition` from working on stable/beta.
2021-09-09 14:36:06 +00:00
Eric Huss
422d5b030c Enable some tests on windows. 2021-09-08 23:34:37 -07:00
Eric Huss
1ae99dad6e Fix cargo fix --edition on stable. 2021-09-08 21:31:45 -07:00
Eric Huss
9b82a780f3 Enable strip test on macos. 2021-09-08 20:12:35 -07:00
bors
e515c3277b Auto merge of #9873 - hi-rustin:rustin-patch-mask, r=alexcrichton
Remove log output that may leak tokens

close https://github.com/rust-lang/cargo/issues/9822
2021-09-08 14:32:15 +00:00
二手掉包工程师
e3879397e9
Remove log 2021-09-08 20:51:24 +08:00
bors
7d7c37089d Auto merge of #9859 - dtolnay-contrib:pullrequest, r=ehuss
rev = "refs/pull/𑑛/head"

GitHub exposes a named reference associated with the head of every pull request. For example, you can fetch *this* pull request:

```console
$ git fetch origin refs/pull/9859/head
$ git show FETCH_HEAD
```

Usually when I care about pulling in a patch of one of my dependencies using `[patch.crates-io]`, this is the ref that I want to depend on. None of the alternatives are good:

- `{ git = "the fork", branch = "the-pr-branch" }` — this is second closest to what I want, except that when the PR merges and the PR author deletes their fork, it'll breaks.

- `{ git = "the fork", rev = "commithash" }` — same failure mode as the previous. Also doesn't stay up to date with PR, which is sometimes what I want.

- `{ git = "the upstream", rev = "commithash" }` — doesn't work until the PR is merged or the repo owner creates a named branch or tag containing the PR commit among its ancestors, because otherwise the commit doesn't participate in Cargo's fetch.

- `{ git = "my own fork of PR author's repo", branch = "the-pr-branch" }` — doesn't stay up to date with PR.

This PR adds support for specifying a git dependency on the head of a pull request via the existing `rev` setting of git dependencies: `{ git = "the upstream", rev = "refs/pull/9859/head" }`.

Previously this would fail because the `cargo::sources::git::fetch` function touched in this pull request did not fetch the refspec that we care about. The failures look like:

```console
error: failed to get `mockall` as a dependency of package `testing v0.0.0`

Caused by:
  failed to load source for dependency `mockall`

Caused by:
  Unable to update https://github.com/asomers/mockall?rev=refs/pull/330/head

Caused by:
  revspec 'refs/pull/330/head' not found; class=Reference (4); code=NotFound (-3)
```

If dual purposing `rev` for this is not appealing, I would alternatively propose `{ git = "the upstream", pull-request = "9859" }` which Cargo will interpret using GitHub's ref naming convention as `refs/pull/9859/head`.
2021-09-07 17:51:57 +00:00
bors
941b123689 Auto merge of #9877 - dswij:fix-init-bin-help, r=ehuss
Update suggestion message on bad project name error

closes #9876

Error message suggest adding `[bin]` to `Cargo.toml` which should be `[[bin]]` instead.
2021-09-06 14:45:41 +00:00
dswij
cb2932e47b Update help message on bad project name creation [bin] -> [[bin]] 2021-09-06 15:51:52 +08:00
dswij
bd005850d8 Update test output for hint on project creation [bin] -> [[bin]] 2021-09-06 15:51:33 +08:00
bors
a007f97c88 Auto merge of #9871 - davepacheco:issue-9868, r=ehuss
clarify what goes into "*-sys" crates

Fixes #9868
2021-09-04 18:13:44 +00:00
hi-rustin
edad75df5b Mask token with "*"
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-09-04 12:45:45 +08:00
David Pacheco
914949e687 clarify what goes into "*-sys" crates 2021-09-03 10:56:09 -07:00
bors
d405d73f0e Auto merge of #9869 - nipunn1313:errmsg, r=alexcrichton
Improve error message when unable to initialize git index repo

With this - it'll be more obvious which git repo
couldn't be initialized.

Looks like this
```
➜  cargo RUST_BACKTRACE=1 target/debug/cargo build
error: failed to get `anyhow` as a dependency of package `cargo v0.57.0 (/Users/nipunn/src/cargo)`

Caused by:
  failed to initialize index git repository (in "/Users/nipunn/.cargo/registry/index/github.com-1ecc6299db9ec823")

Caused by:
  failed to parse config file: invalid configuration key (in /Users/nipunn/.config/git/config:1); class=Config (7)
```

Does the best we can with #9854 - since I don't think it can actually be fixed.
Fixes #9854
2021-09-03 15:22:58 +00:00
Nipunn Koorapati
168fac4fa3 Improve error message when unable to initialize git index repo
With this - it'll be more obvious which git repo
couldn't be initialized.
2021-09-02 21:09:59 -04:00
bors
8da3cf70cd Auto merge of #9865 - nipunn1313:pkg_in_repo, r=alexcrichton
Use serde_json to generate cargo_vcs_info.json

Should make it easier to add fields in the future
2021-09-02 14:17:23 +00:00
Nipunn Koorapati
08abcc78d1 Use serde_json to generate cargo_vcs_info.json
Should make it easier to add fields in the future
2021-09-02 01:47:25 -04:00
bors
18751dd3f2 Auto merge of #9850 - hi-rustin:rustin-patch-no-track, r=alexcrichton
print the full destination path when no track duplicates

close https://github.com/rust-lang/cargo/issues/9797
2021-09-01 14:26:00 +00:00
bors
ac58670849 Auto merge of #9800 - ehuss:stabilize-2021, r=alexcrichton
Stabilize 2021 edition

This stabilizes the 2021 edition.

Closes #9781
2021-09-01 13:53:35 +00:00
David Tolnay
86276d4ffe
Document the use of rev to depend on pull requests 2021-09-01 00:42:07 -07:00
David Tolnay
19bb1df226
Allow rev = "refs/..." to use the GitHub fast path 2021-09-01 00:42:07 -07:00
David Tolnay
361b11000a
Add test of git dependency on pull request 2021-09-01 00:42:06 -07:00
David Tolnay
256213a655
Allow dependency's rev to refer to a ref by name 2021-09-01 00:42:06 -07:00
Eric Huss
68753e2874 Temporarily move test lockfile_constant_during_new to nightly. 2021-08-31 22:44:34 -07:00
Eric Huss
7a6377092c Make --force-warn support auto-detect. 2021-08-31 22:24:02 -07:00
Eric Huss
e6a783acd4 Stabilize 2021 edition 2021-08-31 22:24:00 -07:00
bors
72aee9e815 Auto merge of #9839 - jonhoo:prefer-cargo-toml-patch, r=ehuss
Stabilize patch-in-config (and prefer config over manifest)

Tracking issue: https://github.com/rust-lang/cargo/issues/9269

---

This stabilizes the `patch-in-config` feature ([unstable entry](https://doc.rust-lang.org/cargo/reference/unstable.html#patch-in-config)) following the discussion in https://github.com/rust-lang/cargo/issues/9269#issuecomment-904913263.

As requested, this PR _also_ changes the precedence behavior such that a `[patch]` for the same dependency in both `.cargo/config.toml` and `Cargo.toml` prefers the patch from the configuration file over the one from the manifest, which matches the behavior of other overlapping configuration options. The corresponding test has also been updated to reflect this change in behavior.
2021-09-01 04:55:13 +00:00
bors
54c341d3d0 Auto merge of #9808 - QiangHeisenberg:examples, r=ehuss
Adding the cargo doc --examples subcommand

Adding the cargo doc --examples subcommand

#4508
2021-09-01 04:28:18 +00:00
bors
dd474f8d58 Auto merge of #9796 - hi-rustin:rustin-patch-clippy, r=ehuss
Make library created with `cargo new` clippy happy

close https://github.com/rust-lang/cargo/issues/9759
2021-09-01 04:04:11 +00:00
bors
74d7f07adb Auto merge of #9862 - dtolnay-contrib:repos, r=ehuss
Swap out some outdated repo urls in documentation

I noticed that `rand` and `rustfmt` are no longer located in rust-lang-nursery.

Rather than updating `rand` to github.com/rust-random/rand, I've swapped it out for `regex` in this PR. Some considerations:

- Preference for github.com/rust-lang over github.com/rust-random to reduce the perception of unnecessarily endorsing a project that isn't already endorsed by being in Cargo's org.
- Ruled out `libc` because make-your-own-libcpocalypse is not a fun detour for anyone following along and experimenting with git dependencies.
- Ruled out everything with a -rs suffix (`git2-rs`, `flate2-rs`, `backtrace-rs`, `futures-rs`) out of personal distaste.
- Went for something that has comparable name recognition to rand, i.e. ruled out `hashbrown`.

We could alternatively use dummy URLs like github.com/user/example everywhere but I feel that maintaining this every several years is not a big deal and is worth it for the character of the documentation.
2021-09-01 03:35:21 +00:00
David Tolnay
05f6604660
Swap out some outdated repo urls in documentation 2021-08-31 13:33:02 -07:00
hi-rustin
774ccc39a5 Make windows CI happy
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-08-31 16:54:16 +08:00
hi-rustin
5da9bed1e5 print the full destination path when no track duplicates
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-08-31 15:30:48 +08:00
Jon Gjengset
e2777ee6aa Document stabilization version 2021-08-30 09:27:14 -07:00
bors
c22756541a Auto merge of #9846 - ehuss:fix-only-edition-lints, r=alexcrichton
Change `cargo fix --edition` to only fix edition lints.

This changes it so that `cargo fix --edition` will only fix edition lints.  The reason for this is that sometimes non-edition lints get in the way, and make suggestions that can cause failures.  An example is a user that only ever runs `cargo test` or `cargo check --profile=test` locally, and doesn't realize there are problems with running without `cfg(test)` such as unused warnings.

This works by using `--cap-lints=allow` along with `--force-warn` which takes precedence over `cap-lints`.

This only works on nightly since `--force-warn` is still unstable.  I will update this as part of #9800.

Closes #5738
2021-08-30 14:17:26 +00:00
bors
46fa867ff7 Auto merge of #9848 - nipunn1313:desc, r=alexcrichton
Show desc of well known subcommands (fmt, clippy) in cargo --list

Fixes #8680

An approach to #8680 that shows these in `cargo --list` without showing them directly in the `cargo --help`.

```
➜  cargo git:(desc) target/debug/cargo --list | grep clippy
    clippy               Checks a package to catch common mistakes and improve your Rust code.
```

Here's what mine looks like visually now:
![image](https://user-images.githubusercontent.com/1300387/131178775-2255ef0d-1993-47dd-bc73-9015394b967c.png)
2021-08-27 19:40:28 +00:00
Nipunn Koorapati
1edd8630c9 Show desc of well known subcommands (fmt, clippy) in cargo --list 2021-08-27 12:28:30 -07:00
Eric Huss
46450d6e3a Change cargo fix --edition to only fix edition lints. 2021-08-27 11:28:03 -07:00
bors
f559c109cc Auto merge of #9843 - ehuss:fix-test-cargo-env, r=alexcrichton
Fix test not to rely on `cargo` in PATH.

This fixes a test that was trying to execute `cargo` from PATH.  This test doesn't work on rust-lang/rust where the rustup installation is removed, and thus there is no `cargo` in PATH.
2021-08-26 22:54:55 +00:00
Eric Huss
e0bd1877d0 Fix test not to rely on cargo in PATH. 2021-08-26 14:06:32 -07:00