Commit graph

10916 commits

Author SHA1 Message Date
bors
fb0130cdb3 Auto merge of #9365 - jyn514:rustc-bootstrap-crate-name, r=ehuss
Don't give a hard error when the end-user specifies RUSTC_BOOTSTRAP=crate_name

Fixes https://github.com/rust-lang/cargo/issues/9362.
The whole point of https://github.com/rust-lang/rust/pull/77802/ was to allow specifying this granularly, giving a hard error defeats the point.

I didn't know how to check what targets were reverse-dependencies of build.rs, so I just unconditionally use the library name (and give a hard error for anything else, even if it's the name of one of the binaries). End-users can still opt-in with RUSTC_BOOTSTRAP=1, and no public binaries use RUSTC_BOOTSTRAP=1, so I don't think this a big deal in practice.

<details><summary>Script to verify all crates using RUSTC_BOOTSTRAP=1 have a library</summary>

```sh
curl https://pastebin.com/raw/fGQ97xP6 | cut -d / -f1 | grep -v shnatsel | grep -v cargo- | sed 's#-\([0-9]\)#/\1#' | xargs -i curl -s -I -L "https://docs.rs/{}/" -w "%{http_code}\n" -o/dev/null
```

It should output 20 200s in a row.

</details>

r? `@ehuss` cc `@mark-simulacrum`

I don't know what cargo's policy is for backports, but this should be backported to 1.52.
2021-04-20 23:43:12 +00:00
bors
a18936b14c Auto merge of #9369 - PicoJr:fix-9350, r=ehuss
Fix #9350 (cargo build -Z help is missing options)

> Do not merge yet, some options are still undocumented.

Fix #9350 (cargo build -Z help is missing options)

Add a procedural macro to declare `CliUnstable` struct and provide help messages instead of hard-coding help in `src/bin/cargo/cli.rs`

> Flags documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html

Feedback welcome
2021-04-20 21:58:22 +00:00
bors
05d37ae2c0 Fix #9350 (cargo build -Z help is missing options)
> Do not merge yet, some options are still undocumented.

Fix #9350 (cargo build -Z help is missing options)

Add a procedural macro to declare `CliUnstable` struct and provide help messages instead of hard-coding help in `src/bin/cargo/cli.rs`

> Flags documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html

Feedback welcome
2021-04-20 21:58:22 +00:00
Alex Crichton
eb6e1b34a4 Fix disagreement about lockfile ordering on stable/nightly
This commit fixes an issue where the order of packages serialized into a
lock file differs on stable vs nightly. This is due to a bug introduced
in #9133 where a manual `Ord` implementation was replaced with a
`#[derive]`'d one. This was an unintended consequence of #9133 and means
that the same lock file produced by two different versions of Cargo only
differs in what order items are serialized.

With #9133 being reverted soon on the current beta channel this is
intended to be the nightly fix for #9334. This will hopefully mean that
those projects which don't build with beta/nightly will remain
unaffected, and those affected on beta/nightly will need to switch to
the new nightly ordering when it's published (which matches the current
stable). The reverted beta will match this ordering as well.

Closes #9334
2021-04-20 13:27:12 -07:00
bors
eb5476bd13 Auto merge of #9379 - stanislav-tkach:patch-1, r=Eh2406
an struct -> a struct
2021-04-20 13:01:37 +00:00
Stanislav Tkach
ee2a0deece
SemVer Compatibility: an struct -> a struct 2021-04-20 13:07:39 +03:00
bors
905af54996 Auto merge of #9378 - ehuss:help-windows, r=alexcrichton
Handle man pages better on Windows.

If a user has `man` installed on Windows via msys/mingw/etc, then `cargo help <subcommand>` would fail with `No manual entry for C:\Users\User\AppData\Local\Temp\cargo-manlSKwTQ`.  This is because the cygwin universe does not handle windows-style paths and does not auto-translate in this scenario.

The solution here is to run the command from within the temp directory and use a relative path which *should* work on all platforms and environments. I tested on windows (powershell, cmd, and mingw), macos, and linux.

Fixes #9197
2021-04-19 20:48:01 +00:00
Eric Huss
1a3bb390d3 Handle man pages better on Windows. 2021-04-19 12:44:08 -07:00
bors
9ae6d41e33 Auto merge of #9368 - weihanglo:issue-9319, r=ehuss
fix: better error message when dependency/workspace member missing

May fix #9319
2021-04-19 19:15:18 +00:00
bors
2c6e748aeb Auto merge of #9376 - nicolaiunrein:patch-1, r=alexcrichton
Fix typo in book

While reading I found a little typo in the docs and corrected it.
2021-04-19 14:06:38 +00:00
nicolaiunrein
68a1f03e54
Fix typo in book
While reading I found a little typo in the docs and corrected it.
2021-04-19 09:34:03 +02:00
bors
1243c378b9 Auto merge of #9348 - matklad:wrapper-fingerprint, r=ehuss
Don't re-use rustc cache when RUSTC_WRAPPER changes

We cache initial `rustc --version` invocations, to speed up noop builds.

We check the mtime of `rustc` to bust the cache if the complier changed.
However, before this PR, we didn't look at mtimes of `RUSTC_WRAPPER` /
`RUSTC_WORKSPACE_WRAPPER`, so we could've re-use old cache with new
wrapper.
2021-04-18 17:24:23 +00:00
bors
97edf92087 Auto merge of #9372 - weihanglo:missing-split-debuginfo-in-config, r=ehuss
doc: add split-debuginfo doc in config chapter

Follow up for https://github.com/rust-lang/cargo/pull/9224.
2021-04-18 16:56:59 +00:00
Weihang Lo
8b3c9adfc4
doc: add split-debuginfo doc in config chapter 2021-04-18 09:41:22 +08:00
Joshua Nelson
5a7149683f Fix tests 2021-04-17 12:13:30 -04:00
Joshua Nelson
1b36ddc1a4 minor cleanup 2021-04-17 11:36:58 -04:00
Joshua Nelson
236fe8767d Use the library name to decide whether the override should be allowed from the top-level.
If there's no library, give a hard error unless features are
unconditionally allowed with RUSTC_BOOTSTRAP=1.
2021-04-17 11:36:55 -04:00
Joshua Nelson
6d6f466351 Use the crate name instead of the package name
This doesn't work because it uses the name of the build script, which is
always build_script_build. I'm not sure what to change it to - the name
of the library crate could be different than the name of the package,
and there could be multiple different crates being compiled in the same
package.
2021-04-17 10:58:40 -04:00
Joshua Nelson
04fa2f2a3b Don't give a hard error on RUSTC_BOOTSTRAP=crate_name 2021-04-17 10:50:38 -04:00
Weihang Lo
9c0d865389 fix: more error context for missing dep of workspace member 2021-04-17 14:24:29 +08:00
Weihang Lo
832fff8dd1
fix: more context when failed to load workspace member 2021-04-17 13:56:39 +08:00
bors
163097cdd9 Auto merge of #9367 - weihanglo:refactor/remove-CargoResultExt, r=alexcrichton
refactor: remove `CargoResultExt`

All `chain_err` -> `with_context` are done by IDE refactoring.

- Remove `CargoResultExt`.
- Call `format!` instead of `anyhow::format_err!` to reduce unnecessary macro expansions.
e870eac996/src/cargo/util/errors.rs (L12-L18)
2021-04-16 22:05:43 +00:00
bors
57b75970e0 Auto merge of #9363 - ehuss:cargo-env-fingerprint, r=alexcrichton
Track "CARGO" in environment fingerprint.

There is an issue where if a package includes an `env!("CARGO")`, that value is not tracked in the fingerprint. If different cargos are used, it will not rebuild. This changes it so that the path to cargo will be tracked in the fingerprint if the CARGO env var is in the dep-info file.

This came up with rust's build system where it [tracks the env](60158f4a7c/src/bootstrap/config.rs (L574)). If you build rust once, and then change the `cargo` value in `config.toml` and try building again, it would not pick up the change which caused me some confusion.

In theory, cargo could fingerprint this every time, but I figure that could be disruptive and trigger needlessly in some situations.

This diff is a little bigger than I would like for such an obscure case.  As an alternative, I think rustbuild could just print `cargo:rerun-if-env-changed=CARGO`, but I figure this could potentially be useful for other projects.
2021-04-16 21:42:36 +00:00
Weihang Lo
9099b49191
refactor: remove unnecessary anyhow macro calls 2021-04-17 02:57:41 +08:00
Weihang Lo
ebca519069
refactor: remove CargoResultExt 2021-04-17 02:13:55 +08:00
Aleksey Kladov
f6070b3e3f Don't re-use rustc cache when RUSTC_WRAPPER changes
We cache initial `rustc --version` invocations, to speed up noop builds.

We check the mtime of `rustc` to bust the cache if the complier changed.
However, before this PR, we didn't look at mtimes of `RUSTC_WRAPPER` /
`RUSTC_WORKSPACE_WRAPPER`, so we could've re-use old cache with new
wrapper.
2021-04-16 20:08:11 +03:00
Eric Huss
2551535ea9 Track "CARGO" in environment fingerprint. 2021-04-15 13:54:46 -07:00
bors
e870eac996 Auto merge of #9356 - ehuss:clippy-allow, r=Eh2406
Update clippy lint allow set.

This updates the clippy lints to default allow. We would prefer not to take clippy lint PRs at this time as there are a number of false positives and subjective style changes that we would rather not review.

I left a couple lints as `warn` that I have found useful when refactoring.
2021-04-14 20:23:16 +00:00
Eric Huss
376619d176 Update testsuite/main.rs lint comment. 2021-04-13 12:25:13 -07:00
Eric Huss
00f3fc90d1 Update 2018 idioms comment. 2021-04-13 10:02:21 -07:00
Eric Huss
10eb56f2c4 Update clippy lint allow set. 2021-04-13 09:02:07 -07:00
bors
57c512b3df Auto merge of #9338 - tniessen:typo-doc-suport, r=ehuss
Fix 'suport' typo in documentation
2021-04-09 19:19:37 +00:00
Tobias Nießen
4575cbfb36
Fix 'suport' typo in documentation 2021-04-09 20:03:28 +02:00
bors
65d57e6f38 Auto merge of #9328 - ehuss:contrib-typo, r=Eh2406
Fix typo in contrib docs.

😳
2021-04-04 15:07:52 +00:00
Eric Huss
45e5e418f3
Fix typo in contrib docs. 2021-04-03 19:49:16 -07:00
bors
335ad2ba95 Auto merge of #9323 - matthiaskrgr:clippy_v19, r=ehuss
fix clippy warnings

fixes these clippy warnings:

map_collect_result_unit
needless_borrow
needless_return
into_iter_on_ref
manual_flatten
match_like_matches_macro
bool_comparison
2021-04-02 16:47:57 +00:00
bors
10ef854e02 Auto merge of #9283 - jonhoo:z-allowed-features, r=ehuss
Add -Zallow-features to match rustc's -Z

This PR implements the `-Zallow-features` permanently-unstable feature flag that explicitly enumerates which unstable features are allowed (assuming unstable features are permitted in the first place). This mirrors the `-Zallow-features` flag of `rustc` which serves the same purpose for `rustc` features:

5fe790e3c4/compiler/rustc_session/src/options.rs (L856-L857)

This flag makes it easier to beta-test unstable features "safely" by ensuring that only a single unstable feature is used if you only have control over build system, and not the source code that developers may end up using, as discussed in [this internals thread](https://internals.rust-lang.org/t/mechanism-for-beta-testing-unstable-features/14280).
2021-04-02 15:01:27 +00:00
Matthias Krüger
1b7fa21f39 fix clippy warnings
fixes these clippy warnings:

map_collect_result_unit
needless_borrow
needless_return
into_iter_on_ref
manual_flatten
match_like_matches_macro
bool_comparison
2021-04-02 12:30:36 +02:00
Jon Gjengset
8d79a75b31 Don't use RUSTC_BOOTSTRAP for nightly-only tests 2021-04-01 10:39:07 -07:00
Jon Gjengset
4eed7ba18a Merge remote-tracking branch 'upstream/master' into z-allowed-features 2021-03-31 15:00:28 -07:00
bors
3c44c3c4b7 Auto merge of #9316 - ehuss:fix-semver-1.51, r=alexcrichton
Fix semver docs for 1.51.

1.51 slightly changed the text of a few error messages. This should get CI passing again.
2021-03-31 21:21:15 +00:00
Eric Huss
413df36253 Fix semver docs for 1.51. 2021-03-31 13:55:52 -07:00
Jon Gjengset
64771ef8cf Fix after merge 2021-03-31 12:43:59 -07:00
Jon Gjengset
ba584a95ae Merge remote-tracking branch 'upstream/master' into z-allowed-features 2021-03-31 12:41:34 -07:00
Jon Gjengset
3b23a37acc Future-proof tests 2021-03-31 12:39:19 -07:00
Jon Gjengset
be333390a4 Print features without Debug 2021-03-31 12:39:09 -07:00
Jon Gjengset
e7ca075193 Handle allow-features in add() 2021-03-31 12:38:36 -07:00
Jon Gjengset
dc35abf14c Sort feature list 2021-03-31 12:38:07 -07:00
Jon Gjengset
9837239017 Move from match guard to if 2021-03-31 12:37:51 -07:00
Jon Gjengset
6be9eecb22 Include allowed features in fingerprint
If this weren't the case, a user that compiled, and then re-ran cargo
with a particular set of allowed features would not see any breakage
even if other unstable features were used.

The downside of this is that changing allow-features causes a full
re-compile, but that still _seems_ like the right thing to do.
2021-03-31 12:35:25 -07:00