3825 Commits

Author SHA1 Message Date
Eric Huss
37f4ff9a9a Make "2" the default resolver in the 2021 edition. 2021-02-17 22:06:58 -08:00
Eric Huss
2ae72ff747 Add edition2021 cargo feature.
This is intended to help make it easier to test the 2021 edition.
2021-02-17 22:01:42 -08:00
Eric Huss
3f2f7e30ff Add a migrating message for cargo fix --edition.
This helps indicate which edition you are moving from and to.
2021-02-17 21:36:28 -08:00
Eric Huss
820537c706 Change Fixing to Fixed, and add a verbose "Fixing".
What was previously "Fixing" was a message for after the fixes had
been applied. I think it would be clearer if it said "Fixed",
to indicate that the fixes had actually finished.

The new "Fixing" is posted just before it starts. This is verbose-only
since it is a little noisy.
2021-02-17 20:41:38 -08:00
bors
af564b22ca Auto merge of #9169 - Liberatys:emit-warning-on-env-variable-case-mismatch, r=ehuss
Emit warning on env variable case mismatch

When running a command like `cargo --target TRIPPLE` cargo expects to find the environment variable CARGO_TARGET_[TRIPPLE]_* with uppercase and underscores. This check emits a warning if the checked environment variable has a mismatching case and/or contains dashes rather than underscores. The warning contains the given env variable as well as an explanation for the cause of the warning.

The check is skipped on windows as environment variables are treated as case insensitive on the platform.

Fixes #8285
2021-02-14 19:35:20 +00:00
Eric Huss
0564466f45 Combine target env tests. 2021-02-14 11:32:18 -08:00
Nick Flueckiger
4234077bc2 Re-add backticks 2021-02-14 13:15:35 +01:00
Nick Flueckiger
d3aed3585e Update wording and use if let 2021-02-14 13:00:20 +01:00
Nick Flueckiger
86c6e42741 Fix windows test case 2021-02-14 00:20:21 +01:00
Nick Flueckiger
c86310210c Update windows check 2021-02-13 23:20:43 +01:00
bors
8fa0827d27 Auto merge of #8640 - CPerezz:doc_versioning, r=ehuss
Implement Rustdoc versioning checks

Before compiling, we need to make sure that if there were any previous docs already compiled, they were compiled with the same Rustc version that we're currently using. Otherways we must remove the `doc/` folder and compile again.

This is important because as stated in #8461 the .js/.html&.css files that are generated by Rustc don't have any versioning. Therefore, we can fall in weird bugs and behaviours if we mix different compiler versions of these js/.html&.css files.

Closes #8461
2021-02-13 21:57:02 +00:00
Nick Flueckiger
6af31941f3 Adapt implementation with reviewer suggestions and requested changes 2021-02-13 21:17:18 +01:00
Nick Flueckiger
6ea8abc805 Correct target 2021-02-13 12:19:00 +01:00
Nick Flueckiger
dd4b95fb9f Lint 2021-02-13 12:14:24 +01:00
Nick Flueckiger
a7ae6352a3 Exclude test on windows 2021-02-13 11:59:38 +01:00
Nick Flueckiger
11c82a8af8 Implement uppercase env map for key case mismatch 2021-02-13 11:46:13 +01:00
Eric Huss
9cb8f41ec9 Prevent testsuite from loading config out of sandbox. 2021-02-10 17:39:38 -08:00
bors
ab64d1393b Auto merge of #9153 - calavera:strip_options, r=ehuss
Allow `true` and `false` as options for `strip` option

This follows the convention of `lto` and `debug` that allow `true` for
the highest level, and `false` for disabled.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2021-02-10 00:19:10 +00:00
bors
0608fcd99d Allow true and false as options for strip option
This follows the convention of `lto` and `debug` that allow `true` for
the highest level, and `false` for disabled.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2021-02-10 00:19:10 +00:00
bors
46bac2dc44 Auto merge of #9133 - alexcrichton:git-default-branch, r=ehuss
Change git dependencies to use `HEAD` by default

This commit follows through with work started in #8522 to change the
default behavior of `git` dependencies where if not branch/tag/etc is
listed then `HEAD` is used instead of the `master` branch. This involves
also changing the default lock file format, now including a `version`
marker at the top of the file notably as well as changing the encoding
of `branch=master` directives in `Cargo.toml`.

If we did all our work correctly then this will be a seamless change.
First released on stable in 1.47.0 (2020-10-08) Cargo has been emitting
warnings about situations which may break in the future. This means that
if you don't specify `branch = 'master'` but your HEAD branch isn't
`master`, you've been getting a warning. Similarly if your dependency
graph used both `branch = 'master'` as well as specifying nothing, you
were receiving warnings as well. These two situations are broken by this
commit, but it's hoped that by giving enough times with warnings we
don't actually break anyone in practice.
2021-02-09 23:42:27 +00:00
Alex Crichton
9f2ce1ffef Squash warnings on the nightly channel 2021-02-09 07:30:08 -08:00
Alex Crichton
1fefa5de26 Add back in deleted tests 2021-02-09 07:29:01 -08:00
bjorn3
f5a3d55983 Fix warnings of the new non_fmt_panic lint 2021-02-06 19:10:42 +01:00
Eric Huss
5ebb605c9a Fix panic with doc collision orphan. 2021-02-05 10:02:34 -08:00
Alex Crichton
7dd9872c13 Change git dependencies to use HEAD by default
This commit follows through with work started in #8522 to change the
default behavior of `git` dependencies where if not branch/tag/etc is
listed then `HEAD` is used instead of the `master` branch. This involves
also changing the default lock file format, now including a `version`
marker at the top of the file notably as well as changing the encoding
of `branch=master` directives in `Cargo.toml`.

If we did all our work correctly then this will be a seamless change.
First released on stable in 1.47.0 (2020-10-08) Cargo has been emitting
warnings about situations which may break in the future. This means that
if you don't specify `branch = 'master'` but your HEAD branch isn't
`master`, you've been getting a warning. Similarly if your dependency
graph used both `branch = 'master'` as well as specifying nothing, you
were receiving warnings as well. These two situations are broken by this
commit, but it's hoped that by giving enough times with warnings we
don't actually break anyone in practice.
2021-02-04 08:54:40 -08:00
Eric Huss
33f648ab3b Fix permission issue with cargo vendor. 2021-02-03 17:37:00 -08:00
bors
aaaf296ab7 Auto merge of #9112 - alexcrichton:split-debuginfo, r=ehuss
Add split-debuginfo profile option

This commit adds a new `split-debuginfo` option to Cargo compilation
profiles which gets forwarded to the `-Csplit-debuginfo` codegen option
in rustc. This commit also sets the default, only on macOS, to be
`-Csplit-debuginfo=unpacked`. The purpose of this change is to leverage
rust-lang/rust#79570 to avoid running `dsymutil` on incremental builds
while also preserving a pleasant debugging experience by default. This
should lead to much faster incremental build times on macOS since
`dsymutil` isn't exactly the speediest tool in the world.

This is technically a breaking change in Cargo because we're no longer
by-default producing the `*.dSYM` folders on macOS. If those are still
desired, however, authors can always run `dsymutil` themselves or
otherwise configure `split-debuginfo = 'packed'` in their
manifest/profile configuration.
2021-02-03 22:50:15 +00:00
Alex Crichton
ffa9dbd348 Don't change the macOS default just yet 2021-02-03 14:06:41 -08:00
Carlos Pérez
3c93f6c7ea
Merge branch 'master' into doc_versioning 2021-02-03 18:08:12 +01:00
bors
537dc099d3 Auto merge of #9126 - ehuss:registry-builder, r=alexcrichton
Add RegistryBuilder for tests, and update crates-io error handling.

This adds `RegistryBuilder` to the test suite to make it more flexible to create different registry setups, and to reuse code a little more easily.

This also makes a small adjustment to the registry API to add a `ResponseError` type to make it easier to work with API errors.  As part of this, some tests were added to validate the API behavior for response errors.  There are only a few very small changes here:
* Extra newlines are removed from the headers printed in the error message.
* The UTF-8 error now also includes the text "invalid response from server".
* The "file too large" crates.io publish error now displays the tarball size.  (There is no test for this because it is only issued for talking to `crates.io`.)

Split from #9111.
2021-02-03 15:56:05 +00:00
Eric Huss
06b8d1cac1 Add a ResponseError for registry API interaction.
The intent here is to make it easier to work with API errors.

This also includes some new tests for checking network errors.
2021-02-02 17:44:57 -08:00
Eric Huss
340656e29d Add RegistryBuilder to help initializing test registries.
The intent here is to make it more flexible to create different registry
setups, and to reuse code a little more easily.
2021-02-02 15:48:48 -08:00
Eric Huss
d8673d93d2 Fix env/cfg set for cargo test and cargo run. 2021-02-01 19:20:54 -08:00
Alex Crichton
cc5e9df64a Cache failures in the rustc info cache
This commit updates the rustc info cache to cache failures to execute
rustc as well as successes. This fixes a weird issue where if you're
probing for flags the `rustc_info_cache` test fails on channels which
don't have the flag since previously a failure to execute rustc resulted
in never caching the result.
2021-02-01 11:29:25 -08:00
Alex Crichton
ed4568e108 Add split-debuginfo profile option
This commit adds a new `split-debuginfo` option to Cargo compilation
profiles which gets forwarded to the `-Csplit-debuginfo` codegen option
in rustc. This commit also sets the default, only on macOS, to be
`-Csplit-debuginfo=unpacked`. The purpose of this change is to leverage
rust-lang/rust#79570 to avoid running `dsymutil` on incremental builds
while also preserving a pleasant debugging experience by default. This
should lead to much faster incremental build times on macOS since
`dsymutil` isn't exactly the speediest tool in the world.

This is technically a breaking change in Cargo because we're no longer
by-default producing the `*.dSYM` folders on macOS. If those are still
desired, however, authors can always run `dsymutil` themselves or
otherwise configure `split-debuginfo = 'packed'` in their
manifest/profile configuration.
2021-02-01 09:21:36 -08:00
bors
e099df243b Auto merge of #9108 - CPerezz:locked_warn, r=alexcrichton
Impl warn for locked install without Cargo.lock

If we're installing in --locked mode and there's no `Cargo.lock` published
ie. the bin was published before https://github.com/rust-lang/cargo/pull/7026
the cargo install errors were not stating that it was due to the lack of
the `Cargo.lock` file. Instead, the error seemed completely unrelated.

Therefore, this tries to address this by adding a warn in the stderr
output.

Closes #9106

I will need some help on the testing side (assuming the code I added for the warning is correct).
It looks to me that the publish function implemented for testing purposes does not publish `Cargo.lock` which is the actual convention. Should this be updated too? See  #7026
2021-02-01 16:24:34 +00:00
CPerezz
cb21e6424b
Improve & fix doc dir removal process 2021-02-01 01:54:13 +01:00
CPerezz
7c45021328
Check target-dependant doc folders
When checking the fingerprint for rustdoc and applying
the corresponding logic, we don't only need to consider
the `target/doc` folder (Host target) but also triple targets.

So now the actual compilation targets are checked during the
rustdoc_fingerprint processing and they're treated as the Host/doc
folder.
2021-01-31 23:43:27 +01:00
Dirkjan Ochtman
040d27f39d Don't try to parse MSRV if feature is not enabled 2021-01-30 23:14:30 +01:00
CPerezz
b526fadca4
Impl warn for locked install withoud Cargo.lock
If we're installing in --locked mode and there's no `Cargo.lock` published
ie. the bin was published before https://github.com/rust-lang/cargo/pull/7026
the cargo install errors were not stating that it was due to the lack of
the `Cargo.lock` file. Instead, the error seemed completely unrelated.

Therefore, this tries to address this by adding a warn in the stderr
output.

Closes #9106
2021-01-30 01:09:16 +01:00
CPerezz
d2572a2800
Address latest reivew suggestions
- Instead of `fs` we use the `utils::paths` functions
to interact with the filesystem.
- The doc fingerprint is now stored under `target/` instead
of `target/doc/`.
- The code in `compile` has been reduced to a single function call.
2021-01-27 01:14:31 +01:00
Carlos Pérez
47e19f057e
Merge branch 'master' into doc_versioning 2021-01-26 00:54:30 +01:00
CPerezz
27987b6706
Add rustdoc fingerprint exception for clean 2021-01-26 00:54:41 +01:00
CPerezz
94519f2649
Create dirs if needed before f_p write call
Once `RustDocFingerprint::check_rustdoc_fingerprint()` is
executed it might happen that the `doc/` dir is removed.

This means that when we call `fingerprint.write()` we need
to create the `doc` directory again.
2021-01-26 00:54:41 +01:00
Eric Huss
fdb8ea1e03 Add some extra help to cargo new and invalid package names. 2021-01-24 13:21:25 -08:00
Eric Huss
b04c7fb849 Add suggestion for bad package id. 2021-01-22 13:38:53 -08:00
bors
ba3311e714 Auto merge of #9092 - ehuss:unstable-updates, r=alexcrichton
Unstable updates

This is a collection of updates for unstable/nightly feature support, intended to provide better messages for users and better internal and external documentation.  Separated by commit, in summary:

* Added comments and new docstrings for improved internal documentation.
* Added new documentation to the reference guide on how unstable things work.
  * Also added redirects for stabilized features so any external links won't be broken.
* Add a targeted error message if you put `cargo-features` in the wrong place in `Cargo.toml`.
* Remove `publish-lockfile`.  The feature was stabilized without the key in #7026 about 1.5 years ago.  Also added "removed" support for features, which prints out a more helpful error message.
* Add help messages about stabilized `-Z` flags (instead of spitting out an unhelpful error message).
* Add help messages about stabilized `cargo-features` features.
* Add more context to the error when using `cargo-features` on stable.
* Unhide nightly CLI flags. I changed my mind on how these should work. I think it is useful to "advertise" the existence of these options on stable. The error message if you try to use it should help guide on what to do.

Closes #9074.
2021-01-21 21:04:12 +00:00
Eric Huss
7bbef3defe Rework cargo-features a little.
* Add `removed` support.
* Include the version where it is stabilized.
* Include a links to the documentation in the error/warning messages.
2021-01-21 12:16:35 -08:00
Eric Huss
00615fc51a Add more helpful message with stabilized -Z flags.
Previously, when something was stabilized, Cargo would spit out a very
unhelpful error message about an unknown -Z flag. This changes it so
that it displays a helpful warning (or error).
2021-01-20 19:46:50 -08:00
Eric Huss
ff349f0205 Remove publish-lockfile key from manifest.
The feature was stabilized without the key in #7026 about 1.5 years ago.
(Will follow up with an error message in a subsequent commit.)
2021-01-20 19:31:57 -08:00