]> git.proxmox.com Git - cargo.git/log
cargo.git
4 years agoAuto merge of #8161 - ehuss:changelog-dylib, r=Eh2406
bors [Sun, 26 Apr 2020 13:51:43 +0000 (13:51 +0000)]
Auto merge of #8161 - ehuss:changelog-dylib, r=Eh2406

Add changelog about dylib uplift.

I missed this in the last update, and it is very unlikely I'll remember this in 6 weeks.

4 years agoAdd changelog about dylib uplift.
Eric Huss [Sun, 26 Apr 2020 12:55:56 +0000 (05:55 -0700)]
Add changelog about dylib uplift.

4 years agoAuto merge of #8158 - tofay:doc-cargo-metadata-messages, r=ehuss
bors [Sat, 25 Apr 2020 23:13:31 +0000 (23:13 +0000)]
Auto merge of #8158 - tofay:doc-cargo-metadata-messages, r=ehuss

Mention that cargo_metadata can parse json messages

Prompted by https://github.com/rust-lang/cargo/issues/8142, this updates the documentation to mention that cargo_metadata can parse the external JSON messages emitted when the `--message-format=json` option is set.

4 years agoMention that cargo_metadata can parse json messages
Tom Fay [Sat, 25 Apr 2020 17:19:19 +0000 (18:19 +0100)]
Mention that cargo_metadata can parse json messages

4 years agoAuto merge of #8155 - alexcrichton:reenable-test, r=ehuss
bors [Fri, 24 Apr 2020 21:08:39 +0000 (21:08 +0000)]
Auto merge of #8155 - alexcrichton:reenable-test, r=ehuss

Re-enable rustc-info-cache test again

Support for `-Cbitcode-in-rlib` is now on nightly!

4 years agoRe-enable rustc-info-cache test again
Alex Crichton [Fri, 24 Apr 2020 19:54:24 +0000 (12:54 -0700)]
Re-enable rustc-info-cache test again

Support for `-Cbitcode-in-rlib` is now on nightly!

4 years agoAuto merge of #8095 - ehuss:paths-walking, r=alexcrichton
bors [Fri, 24 Apr 2020 18:35:25 +0000 (18:35 +0000)]
Auto merge of #8095 - ehuss:paths-walking, r=alexcrichton

Updates to path source walking.

This is a collection of loosely related changes to path source walking:

* Add more context to error messages.
* Allow `package.exclude` patterns to match directories. Previously, the walker would recurse into the directory, and skip every file. Instead, just skip the whole directory. This can be helpful if the directory is not readable, or otherwise want to avoid walking.
* Don't require `Cargo.toml` to be in root of a git repo in order to use git to guide the selection. I'm not sure I understand the original reasoning that (any) `Cargo.toml` had to reside next to the `.git` directory.

The last is a moderately risky change, since it's hard to predict how this might affect more complex project layouts or new interactions with `.gitignore` that didn't exist before. Also, I'm wondering if it should just ignore if it fails to open the repo instead of emitting an error?

Closes #1729
Closes #6188
Closes #8092

4 years agoAuto merge of #8153 - ehuss:version-bump, r=Eh2406
bors [Fri, 24 Apr 2020 18:12:22 +0000 (18:12 +0000)]
Auto merge of #8153 - ehuss:version-bump, r=Eh2406

Bump to 0.46.0, update changelog

4 years agoBump git2.
Eric Huss [Thu, 23 Apr 2020 16:31:33 +0000 (09:31 -0700)]
Bump git2.

4 years agoUpdate changelog for 1.44.
Eric Huss [Fri, 24 Apr 2020 16:42:47 +0000 (09:42 -0700)]
Update changelog for 1.44.

4 years agoBump to 0.46.0
Eric Huss [Fri, 24 Apr 2020 15:45:16 +0000 (08:45 -0700)]
Bump to 0.46.0

4 years agoSwap Result/Option for discover_git_and_list_files.
Eric Huss [Mon, 13 Apr 2020 17:49:32 +0000 (10:49 -0700)]
Swap Result/Option for discover_git_and_list_files.

4 years agoDon't require Cargo.toml to be in root of a git repo for path source walking.
Eric Huss [Sat, 11 Apr 2020 17:38:21 +0000 (10:38 -0700)]
Don't require Cargo.toml to be in root of a git repo for path source walking.

4 years agoAllow `package.exclude` patterns to match directories.
Eric Huss [Sat, 11 Apr 2020 17:36:58 +0000 (10:36 -0700)]
Allow `package.exclude` patterns to match directories.

4 years agoAdd some more context to errors walking path sources.
Eric Huss [Sat, 11 Apr 2020 17:30:19 +0000 (10:30 -0700)]
Add some more context to errors walking path sources.

4 years agoAuto merge of #8141 - ehuss:uwp_support, r=ehuss
bors [Tue, 21 Apr 2020 18:04:35 +0000 (18:04 +0000)]
Auto merge of #8141 - ehuss:uwp_support, r=ehuss

Uplift windows gnu DLL import libraries.

This is a repost of #6875, rebased with tests fixed.

4 years agoUpdate tests and comments for testing windows-gnu.
Eric Huss [Tue, 21 Apr 2020 17:52:46 +0000 (10:52 -0700)]
Update tests and comments for testing windows-gnu.

4 years agoAdd implib to the stamp files
Hugo Beauzée-Luyssen [Wed, 17 Apr 2019 13:49:07 +0000 (15:49 +0200)]
Add implib to the stamp files

This was already done when targetting msvc, but it needs to be done for
all targets to allow rustc to link with shared libraries when using llvm
-l<dllname> is only supported by gcc, while llvm needs an import library
to link indirectly with a dll

4 years agoAuto merge of #8139 - mati865:patch-1, r=ehuss
bors [Tue, 21 Apr 2020 17:03:56 +0000 (17:03 +0000)]
Auto merge of #8139 - mati865:patch-1, r=ehuss

Add windows-gnu CI and fix tests

One remaining failure:
```
---- features::feature_off_dylib stdout ----
running `d:\a\1\s\target\debug\cargo.exe build --features f1`
running `d:\a\1\s\target\debug\cargo.exe run -p bar`
thread 'features::feature_off_dylib' panicked at '
Expected: execs
    but: exited with exit code: 101
--- stdout

--- stderr
   Compiling foo v0.0.1 (D:\a\1\s\target\cit\t663\foo)
   Compiling bar v0.0.1 (D:\a\1\s\target\cit\t663\foo\bar)
    Finished dev [unoptimized + debuginfo] target(s) in 0.69s
     Running `target\debug\bar.exe`
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `"f1"`,
 right: `"no f1"`', bar\src\main.rs:5:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\bar.exe` (exit code: 101)
', crates\cargo-test-support\src\lib.rs:833:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    features::feature_off_dylib
```

I disassembled the dylibs and `cargo run -p bar` correctly rebuilt it inside `target/debug/deps/` but did not copy it to `target/debug`. To further confirm, calling `cp target/debug/deps/foo.dll target/debug/` manually solved the issue.
Any idea?

----

I left `FIXME` in places where import lib should be added with https://github.com/rust-lang/cargo/pull/6875.

`TOOLCHAIN: nightly-x86_64-pc-windows-gnu` can be replaced with beta on Thursday.

4 years agoMake sure to lift dylibs
Mateusz Mikuła [Tue, 21 Apr 2020 15:24:36 +0000 (17:24 +0200)]
Make sure to lift dylibs

4 years agoFix rustc-dev component installation on CI
Mateusz Mikuła [Mon, 20 Apr 2020 18:29:03 +0000 (20:29 +0200)]
Fix rustc-dev component installation on CI

4 years agoUpdate tests for windows-gnu
Mateusz Mikuła [Mon, 20 Apr 2020 16:57:56 +0000 (18:57 +0200)]
Update tests for windows-gnu

4 years agoAdd windows-gnu CI
Mateusz Mikuła [Mon, 20 Apr 2020 10:46:00 +0000 (12:46 +0200)]
Add windows-gnu CI

4 years agoAuto merge of #7973 - ehuss:index-updates, r=alexcrichton
bors [Mon, 20 Apr 2020 19:50:40 +0000 (19:50 +0000)]
Auto merge of #7973 - ehuss:index-updates, r=alexcrichton

Several updates to token/index handling.

This attempts to tighten up the usage of token/index handling, to prevent accidental leakage of the crates.io token.

* Make `registry.index` config a hard error. This was deprecated 4 years ago in #2857, and removing it helps simplify things.
* Don't allow both `--index` and `--registry` to be specified at the same time. Otherwise `--index` was being silently ignored.
* `registry.token` is not allowed to be used with the `--index` flag. The intent here is to avoid possibly leaking a crates.io token to another host.
* Added a warning if source replacement is used and the token is loaded from `registry.token`.

Closes #6545

4 years agoAuto merge of #8129 - ehuss:resolver-behavior, r=alexcrichton
bors [Mon, 20 Apr 2020 16:07:30 +0000 (16:07 +0000)]
Auto merge of #8129 - ehuss:resolver-behavior, r=alexcrichton

Add `resolver` opt-in for new feature resolver.

This adds a new `resolver` field to `Cargo.toml` to provide an opt-in mechanism for backwards-incompatible resolver changes. This enables the new feature resolver and `-Zpackage-features`. See `unstable.md` for documentation.

cc #8088

4 years agoAuto merge of #8137 - twe4ked:install-current-directory-error, r=alexcrichton
bors [Mon, 20 Apr 2020 14:24:42 +0000 (14:24 +0000)]
Auto merge of #8137 - twe4ked:install-current-directory-error, r=alexcrichton

Improve error message when running `cargo install .`

Existing error:

```
$ cargo install .
    Updating crates.io index
error: could not find `.` in registry `https://github.com/rust-lang/crates.io-index`
```

New error:

```
$ cargo install .
error: To install the binaries for the package in current working directory use `cargo install --path .`. Use `cargo build` if you want to simply build the package.
```

Existing related errors:

```
$ cargo install
error: Using `cargo install` to install the binaries for the package in current working directory is no longer supported, use `cargo install --path .` instead. Use `cargo build` if you want to simply build the package.
$ cargo uninstall .
error: invalid package ID specification: `.`

Caused by:
  Invalid character `.` in pkgid: `.`
```

4 years agoAuto merge of #8138 - Dylan-DPC:fix/transmute_unused, r=alexcrichton
bors [Mon, 20 Apr 2020 14:06:51 +0000 (14:06 +0000)]
Auto merge of #8138 - Dylan-DPC:fix/transmute_unused, r=alexcrichton

fix mem replace unused

`mem::replace` will be linted as must_use, so modifying this.

This is currently blocking https://github.com/rust-lang/rust/pull/71256

4 years agoremove mem replace instead
dylan_DPC [Mon, 20 Apr 2020 13:40:41 +0000 (15:40 +0200)]
remove mem replace instead

4 years agofix mem replace unused
dylan_DPC [Mon, 20 Apr 2020 13:08:26 +0000 (15:08 +0200)]
fix mem replace unused

4 years agoImprove error message when running `cargo install .`
Odin Dutton [Mon, 20 Apr 2020 03:04:36 +0000 (13:04 +1000)]
Improve error message when running `cargo install .`

4 years agoAuto merge of #8134 - nnethercote:bitcode-in-rlib, r=alexcrichton
bors [Sun, 19 Apr 2020 19:09:12 +0000 (19:09 +0000)]
Auto merge of #8134 - nnethercote:bitcode-in-rlib, r=alexcrichton

Change `-Cembed-bitcode=no` use to `-Cbitcode-in-rlib=no`.

Because the latter will replace the planned use of the former in rustc.

4 years agoAuto merge of #8068 - ehuss:bcx-units, r=alexcrichton,ehuss
bors [Sun, 19 Apr 2020 17:37:59 +0000 (17:37 +0000)]
Auto merge of #8068 - ehuss:bcx-units, r=alexcrichton,ehuss

Refactor BuildContext

This restructures the "front end" of the compile process so that the `UnitGraph` can be accessed by API users. Essentially, the `BuildContext` contains the result of generating the `UnitGraph`, and other bits of information collected along the way. This logically separates the build process into two phases: (1) generate the `UnitGraph` and `BuildContext` and (2) pass the `BuildContext` to `Context` which performs the actual compilation.

The main challenge here is dealing with the references and lifetimes. The old code kept a bunch of things on the stack with various layers of references. Beside reorganizing things, the big change is to wrap `Package` and `Target` in `Rc`. This still requires the `UnitInterner` to be passed in and kept alive. It is possible to avoid that by placing all `Unit`s in `Rc`, but that had a roughly 5% performance hit (on fresh builds) because Units are very optimized to be used as hashable keys, and `Rc` loses those optimizations.

4 years agoA few final minor fixes for bcx reorg.
Eric Huss [Sun, 19 Apr 2020 16:50:29 +0000 (09:50 -0700)]
A few final minor fixes for bcx reorg.

4 years agoRun rustfmt
Alex Crichton [Thu, 9 Apr 2020 16:20:54 +0000 (09:20 -0700)]
Run rustfmt

4 years agoRe-add code removed for debugging
Alex Crichton [Thu, 9 Apr 2020 16:18:43 +0000 (09:18 -0700)]
Re-add code removed for debugging

4 years agoRemove lifetime from `Unit`
Alex Crichton [Thu, 9 Apr 2020 16:17:31 +0000 (09:17 -0700)]
Remove lifetime from `Unit`

4 years agoMake `Unit` an owned value
Alex Crichton [Mon, 6 Apr 2020 15:16:13 +0000 (08:16 -0700)]
Make `Unit` an owned value

4 years agoHide `Rc<Package>` under `Package`
Alex Crichton [Sun, 5 Apr 2020 20:41:44 +0000 (13:41 -0700)]
Hide `Rc<Package>` under `Package`

4 years agobcx reorg
Eric Huss [Tue, 24 Mar 2020 21:20:06 +0000 (14:20 -0700)]
bcx reorg

4 years agoWrap Package/Target in Rc.
Eric Huss [Fri, 20 Mar 2020 22:46:11 +0000 (15:46 -0700)]
Wrap Package/Target in Rc.

This is intended to make it easier to deal with Unit lifetimes.

4 years agoAuto merge of #8135 - ehuss:allows-dashes, r=Eh2406
bors [Sun, 19 Apr 2020 16:47:38 +0000 (16:47 +0000)]
Auto merge of #8135 - ehuss:allows-dashes, r=Eh2406

Rename allows_underscores to allows_dashes.

I think this better reflects what it means.

4 years agoAdd a warning when using `registry.token` with source replacement.
Eric Huss [Sat, 7 Mar 2020 01:29:12 +0000 (17:29 -0800)]
Add a warning when using `registry.token` with source replacement.

4 years agoDo not implicitly load registry.token with --index.
Eric Huss [Fri, 6 Mar 2020 23:05:12 +0000 (15:05 -0800)]
Do not implicitly load registry.token with --index.

The intent is to avoid leaking the crates.io token to other servers.

4 years agoDon't allow both --index and --registry to be specified at the same time.
Eric Huss [Fri, 6 Mar 2020 18:15:14 +0000 (10:15 -0800)]
Don't allow both --index and --registry to be specified at the same time.

Otherwise --index was being silently ignored.

4 years agoMake setting `registry.index` a hard error.
Eric Huss [Fri, 6 Mar 2020 17:56:58 +0000 (09:56 -0800)]
Make setting `registry.index` a hard error.

This has been deprecated for 4 years. This helps simplify this code.

4 years agoAdd some doc-strings to registry functions.
Eric Huss [Fri, 6 Mar 2020 16:53:11 +0000 (08:53 -0800)]
Add some doc-strings to registry functions.

4 years agoRename allows_underscores to allows_dashes.
Eric Huss [Sun, 19 Apr 2020 16:15:04 +0000 (09:15 -0700)]
Rename allows_underscores to allows_dashes.

4 years agoPut default ResolveBehavior in one place.
Eric Huss [Sun, 19 Apr 2020 16:04:12 +0000 (09:04 -0700)]
Put default ResolveBehavior in one place.

4 years agoAdd `resolver` opt-in for new feature resolver.
Eric Huss [Fri, 17 Apr 2020 18:20:38 +0000 (11:20 -0700)]
Add `resolver` opt-in for new feature resolver.

4 years agoAuto merge of #8130 - hbina:needless_borrow, r=ehuss
bors [Sun, 19 Apr 2020 15:43:59 +0000 (15:43 +0000)]
Auto merge of #8130 - hbina:needless_borrow, r=ehuss

Fixed a needless borrow.

Mentioned by rust-clippy.

4 years agoChange `-Cembed-bitcode=no` use to `-Cbitcode-in-rlib=no`.
Nicholas Nethercote [Sun, 19 Apr 2020 10:34:52 +0000 (20:34 +1000)]
Change `-Cembed-bitcode=no` use to `-Cbitcode-in-rlib=no`.

Because the latter will replace the planned use of the former in rustc.

4 years agoFixed a needless borrow.
Hanif Bin Ariffin [Sat, 18 Apr 2020 00:22:49 +0000 (20:22 -0400)]
Fixed a needless borrow.

4 years agoAuto merge of #8126 - ehuss:link-changelog, r=alexcrichton
bors [Fri, 17 Apr 2020 16:45:26 +0000 (16:45 +0000)]
Auto merge of #8126 - ehuss:link-changelog, r=alexcrichton

Add link to changelog in the Cargo book.

4 years agoAuto merge of #8094 - Freax13:fix-target, r=ehuss
bors [Fri, 17 Apr 2020 16:27:48 +0000 (16:27 +0000)]
Auto merge of #8094 - Freax13:fix-target, r=ehuss

Fix target for doc test cross compilation

- for target paths `Compilation::target` only contains the shortened file name, but we need to pass the full path to rustdoc

4 years agoAuto merge of #8125 - ehuss:doc-config-toml, r=alexcrichton
bors [Fri, 17 Apr 2020 16:00:52 +0000 (16:00 +0000)]
Auto merge of #8125 - ehuss:doc-config-toml, r=alexcrichton

Add note about .cargo/config support.

I think it would be good to have some mention that Cargo also supports `.cargo/config` files.  This is still the predominant way Cargo is used, and there is a ton of documentation, projects, and examples that still use the old form.

4 years agoAdd link to changelog in the Cargo book.
Eric Huss [Fri, 17 Apr 2020 15:49:36 +0000 (08:49 -0700)]
Add link to changelog in the Cargo book.

4 years agoAuto merge of #8123 - ehuss:fix-windows-pdb-dash, r=alexcrichton
bors [Fri, 17 Apr 2020 15:39:25 +0000 (15:39 +0000)]
Auto merge of #8123 - ehuss:fix-windows-pdb-dash, r=alexcrichton

Fix pdb uplift when executable has dashes.

Windows `.pdb` files were not being uplifted for executables with dashes in their name. `rustc` calls the linker with the crate name (with underscores), which creates a pdb with underscores. Cargo renames the executable (`foo_bar.exe` to `foo-bar.exe`), and it was expecting the pdb to have the same form, but it doesn't.

Note: There shouldn't be any effect for using a debugger. Because the pdb path is embedded in the executable, the debugger was already looking in the `deps/` folder.  Uplifting is only useful if you want to copy the exe/pdb pair to some other machine.  In that case, it looks in the same directory as the `exe` for the pdb file.

Fixes #8117

4 years agoAdd note about .cargo/config support.
Eric Huss [Fri, 17 Apr 2020 15:37:03 +0000 (08:37 -0700)]
Add note about .cargo/config support.

4 years agoadd test for doctests with custom target paths
Tom Dohrmann [Fri, 17 Apr 2020 15:35:10 +0000 (17:35 +0200)]
add test for doctests with custom target paths

4 years agoAuto merge of #8122 - kornelski:future-edition, r=Eh2406
bors [Fri, 17 Apr 2020 15:20:04 +0000 (15:20 +0000)]
Auto merge of #8122 - kornelski:future-edition, r=Eh2406

Hint upgrading for future edition keys

A more specific error message for potentially-future edition values.

This error is likely to be seen by people who are not regular Rust users and are just trying to build someone's crate. It may be helpful to stronger hint at upgrading Cargo, rather than display a more general message about an unknown value.

I know Cargo plans to fix it better with explicit MSRV eventually, but that's not ready yet, so it's better to land something sooner.

4 years agoAuto merge of #8124 - ehuss:fs-cleanup, r=Eh2406
bors [Fri, 17 Apr 2020 15:02:35 +0000 (15:02 +0000)]
Auto merge of #8124 - ehuss:fs-cleanup, r=Eh2406

Use some fs shorthand functions.

This is just some cleanup, using some fs convenience functions that I think make the code more readable.

Note: While going through these, I found the `out_dir_is_preserved` test was broken and not doing what it was supposed to.

4 years agoUse fs helpers instead of File functions.
Eric Huss [Fri, 17 Apr 2020 04:10:11 +0000 (21:10 -0700)]
Use fs helpers instead of File functions.

4 years agoHint upgrading for future edition keys
Kornel [Wed, 15 Apr 2020 14:03:09 +0000 (15:03 +0100)]
Hint upgrading for future edition keys

4 years agoUse Path methods instead of fs::metadata.
Eric Huss [Fri, 17 Apr 2020 01:41:03 +0000 (18:41 -0700)]
Use Path methods instead of fs::metadata.

4 years agoFix pdb uplift when executable has dashes.
Eric Huss [Fri, 17 Apr 2020 01:02:47 +0000 (18:02 -0700)]
Fix pdb uplift when executable has dashes.

4 years agoAuto merge of #8121 - huangjiahua:update-documentation, r=alexcrichton
bors [Thu, 16 Apr 2020 19:15:44 +0000 (19:15 +0000)]
Auto merge of #8121 - huangjiahua:update-documentation, r=alexcrichton

Update documentation to mention "config.toml" instead of "config"

I searched for the reference of `config` and `credentials` in `src/doc` and changed to `config.toml` and `credentials.toml` accroding to the context.

#7323

4 years agoUpdate documentation to mention "config.toml" and "credentials.toml" instead of ...
huangjiahua [Thu, 16 Apr 2020 15:18:34 +0000 (23:18 +0800)]
Update documentation to mention "config.toml" and "credentials.toml" instead of "config" and "credentials"

Cargo now support loading 'config.toml' and 'credentials.toml' in place of the same files without extension, which used to be the default. Files with extensions are easier for people to edit due to syntax highlighting, etc.

4 years agoAuto merge of #8119 - ehuss:new-err-formatting, r=alexcrichton
bors [Thu, 16 Apr 2020 14:28:43 +0000 (14:28 +0000)]
Auto merge of #8119 - ehuss:new-err-formatting, r=alexcrichton

Don't use debug display for error object.

When `cargo new` displays a workspace validation warning, it was using the debug display which we probably shouldn't rely on.

This also consolidates a similar usage when `cargo doc --open` fails.

Closes #8118

4 years agofix test
Tom Dohrmann [Thu, 16 Apr 2020 11:08:00 +0000 (13:08 +0200)]
fix test

4 years agomake test use nightly
Tom Dohrmann [Thu, 16 Apr 2020 10:07:15 +0000 (12:07 +0200)]
make test use nightly

4 years agoadd tests for doctests with cross compilation
Tom Dohrmann [Thu, 16 Apr 2020 09:48:12 +0000 (11:48 +0200)]
add tests for doctests with cross compilation

4 years agoadd clarifying comment
Tom Dohrmann [Thu, 16 Apr 2020 09:35:38 +0000 (11:35 +0200)]
add clarifying comment

4 years agoDon't use debug display for error object.
Eric Huss [Thu, 16 Apr 2020 00:29:19 +0000 (17:29 -0700)]
Don't use debug display for error object.

4 years agoAuto merge of #8115 - ehuss:tree-backwards-compat, r=alexcrichton
bors [Wed, 15 Apr 2020 20:52:38 +0000 (20:52 +0000)]
Auto merge of #8115 - ehuss:tree-backwards-compat, r=alexcrichton

Add backwards-compatibility for old cargo-tree flags.

Add backwards compatibility for the flags that were removed.

`--invert` is still not backwards compatible because it was fundamentally changed to take an argument.

Requested via https://github.com/rust-lang/cargo/pull/8062#issuecomment-613829752.

4 years agoAdd backwards-compatibility for old cargo-tree flags.
Eric Huss [Wed, 15 Apr 2020 20:48:58 +0000 (13:48 -0700)]
Add backwards-compatibility for old cargo-tree flags.

4 years agoAuto merge of #8114 - alexcrichton:change-condition, r=Eh2406
bors [Wed, 15 Apr 2020 15:39:33 +0000 (15:39 +0000)]
Auto merge of #8114 - alexcrichton:change-condition, r=Eh2406

Try to avoid panics on buggy (?) clocks

Try to avoid panics with `Instant` by only performing infallible
operations. This tweaks a comparison located in #8042 to use `Instant`
comparisons rather than `Duration` comparisons which should hopefully
eliminate a source of panics in the face of buggy (maybe?) clocks.

I'm not sure whether this actually fixes the original issue, but seeing
that we have a pretty low chance of the issue recurring, it's probably
fine to go ahead and say...

Closes #8042

4 years agoTry to avoid panics on buggy (?) clocks
Alex Crichton [Wed, 15 Apr 2020 14:53:36 +0000 (07:53 -0700)]
Try to avoid panics on buggy (?) clocks

Try to avoid panics with `Instant` by only performing infallible
operations. This tweaks a comparison located in #8042 to use `Instant`
comparisons rather than `Duration` comparisons which should hopefully
eliminate a source of panics in the face of buggy (maybe?) clocks.

I'm not sure whether this actually fixes the original issue, but seeing
that we have a pretty low chance of the issue recurring, it's probably
fine to go ahead and say...

Closes #8042

4 years agoRevert "remove host & target attributes"
Tom Dohrmann [Wed, 15 Apr 2020 10:51:37 +0000 (12:51 +0200)]
Revert "remove host & target attributes"

This reverts commit 5a051ebe08d51c0188a4c3bbb41789c0d4cb0f82.

4 years agoRevert "fix running doctest for host target"
Tom Dohrmann [Wed, 15 Apr 2020 10:51:22 +0000 (12:51 +0200)]
Revert "fix running doctest for host target"

This reverts commit 060c5e13e123683bce605c420bff95b2205fd131.

4 years agofix running doctest for host target
Tom Dohrmann [Tue, 14 Apr 2020 14:41:18 +0000 (16:41 +0200)]
fix running doctest for host target

4 years agoAuto merge of #8093 - pfmooney:illumos-deps, r=alexcrichton
bors [Mon, 13 Apr 2020 20:41:52 +0000 (20:41 +0000)]
Auto merge of #8093 - pfmooney:illumos-deps, r=alexcrichton

Update dependencies to support illumos target

Several dependencies of cargo require updates in order to build with illumos as the `target_os` platform (rust-lang/rust#55553).  Most are patch revisions to include `#[cfg()]` updates.  In the case of `fs2`, the maintainer does not appear to be minding activity on the project, so it was forked into `fs3`, maintaining the same interfaces and logic (but featuring the widened platform support).

4 years agoUpdate dependencies to support illumos target
Patrick Mooney [Fri, 3 Apr 2020 21:20:05 +0000 (21:20 +0000)]
Update dependencies to support illumos target

This inlines the flock() logic from danburkert/fs2, which in its current
state does not compile on illumos (or certain other cfg(unix) targets).

4 years agoAuto merge of #8102 - alexcrichton:more-spurious, r=Eh2406
bors [Mon, 13 Apr 2020 16:45:48 +0000 (16:45 +0000)]
Auto merge of #8102 - alexcrichton:more-spurious, r=Eh2406

Whitelist another known spurious curl error

Seen recently in comments on #6788

4 years agoWhitelist another known spurious curl error
Alex Crichton [Mon, 13 Apr 2020 16:42:26 +0000 (09:42 -0700)]
Whitelist another known spurious curl error

Seen recently in comments on #6788

4 years agoAuto merge of #8098 - ehuss:fix-exported_priv_warning, r=alexcrichton
bors [Mon, 13 Apr 2020 14:12:49 +0000 (14:12 +0000)]
Auto merge of #8098 - ehuss:fix-exported_priv_warning, r=alexcrichton

Fix nightly test matching rustc "warning" output.

https://github.com/rust-lang/rust/pull/69926 changed the warning output from rustc.  https://github.com/rust-lang/cargo/pull/8080 attempted to compensate for it, but missed one of the cases.  I don't think this test needs to be quite so exhaustive about checking the output.

4 years agoFix nightly test matching rustc "warning" output.
Eric Huss [Mon, 13 Apr 2020 04:09:39 +0000 (21:09 -0700)]
Fix nightly test matching rustc "warning" output.

4 years agoremove host & target attributes
Tom Dohrmann [Sun, 12 Apr 2020 15:49:05 +0000 (17:49 +0200)]
remove host & target attributes

4 years agoAuto merge of #8096 - ehuss:codegen-units-default, r=Eh2406
bors [Sat, 11 Apr 2020 22:36:02 +0000 (22:36 +0000)]
Auto merge of #8096 - ehuss:codegen-units-default, r=Eh2406

Update default for codegen-units.

The default for codegen-units was changed in https://github.com/rust-lang/rust/pull/70156.

4 years agoUpdate default for codegen-units.
Eric Huss [Sat, 11 Apr 2020 17:55:51 +0000 (10:55 -0700)]
Update default for codegen-units.

4 years agofix target
Tom Dohrmann [Sat, 11 Apr 2020 09:33:58 +0000 (11:33 +0200)]
fix target

4 years agoAuto merge of #8087 - ehuss:freshness-interrupted2, r=alexcrichton
bors [Fri, 10 Apr 2020 16:33:24 +0000 (16:33 +0000)]
Auto merge of #8087 - ehuss:freshness-interrupted2, r=alexcrichton

Fix freshness when linking is interrupted.

Fixes a scenario where hitting Ctrl-C while linking would leave a corrupted executable, but Cargo would think it is "fresh" and fail to rebuild it.

This also includes a separate commit which adds more documentation on fingerprinting.

Fixes #7767

4 years agoMore fingerprint and metadata comments.
Eric Huss [Thu, 9 Apr 2020 22:30:41 +0000 (15:30 -0700)]
More fingerprint and metadata comments.

4 years agoAuto merge of #8062 - ehuss:tree, r=alexcrichton
bors [Thu, 9 Apr 2020 19:53:41 +0000 (19:53 +0000)]
Auto merge of #8062 - ehuss:tree, r=alexcrichton

Add `cargo tree` command.

This migrates [cargo-tree](https://github.com/sfackler/cargo-tree/) into Cargo as a built-in command. This is based on a recent master (https://github.com/sfackler/cargo-tree/tree/4108d216ec072d2e7c9befb4de32175f97a9dbc4), and should be mostly similar in functionality. There are a variety changes:

* `--all-targets` renamed to `--no-filter-targets` to avoid confusion with the `--all-targets` flag used in other Cargo commands with a different meaning.
* `--all`/`-a` renamed to `--no-dedupe` to avoid confusion with the `-all` flag which means "all workspace crates" in other Cargo commands.
* `--duplicate` renamed to `--duplicates` (with alias), just a personal preference.
* Added support for multiple roots (workspace support).
* Added the `--graph-features` flag for including features in the graph (to "explain" why a feature is enabled).
* Added `{f}` to format string to show features.
* Handles new feature resolver.
* Handles cyclical dev dependencies.
* Added a test suite.
* Dropped the dependency on petgraph, in favor of a simpler custom graph.

Closes #7286.

4 years agoAuto merge of #8069 - ehuss:build-finished, r=alexcrichton
bors [Thu, 9 Apr 2020 19:34:39 +0000 (19:34 +0000)]
Auto merge of #8069 - ehuss:build-finished, r=alexcrichton

Add "build-finished" JSON message.

This adds a JSON message when a build is finished.  This is useful for tools to know when to stop parsing JSON, which is particularly useful for commands like `cargo test` or `cargo run` where additional output may follow.

Closes #7978

4 years agoFix freshness when linking is interrupted.
Eric Huss [Wed, 8 Apr 2020 19:45:15 +0000 (12:45 -0700)]
Fix freshness when linking is interrupted.

4 years agoAuto merge of #8074 - ehuss:package-features2, r=alexcrichton
bors [Thu, 9 Apr 2020 15:43:07 +0000 (15:43 +0000)]
Auto merge of #8074 - ehuss:package-features2, r=alexcrichton

Extend -Zpackage-features with more capabilities.

This is a proposal to extend `-Zpackage-features` with new abilities to change how features are selected on the command-line.  See `unstable.md` for documentation on what it does.

I've contemplated a variety of ways we could transition this to stable. I tried a few experiments trying to make a "transition with warnings" mode, but I'm just too concerned about breaking backwards compatibility.  The current way is just fundamentally different from the new way, and I think it would be a bumpy ride to try to push it.

The stabilization story is that the parts of this that add new functionality (feature flags in virtual worskpaces, and `member/feat` syntax) can be stabilized at any time.  The change for `cargo build -p member --features feat` in a different member's directory can maybe be part of `-Zfeatures` stabilization, which will need to be opt-in.  I've been trying to come up with some transition plan, and I can't think of a way without making it opt-in, and making it part of `-Zfeatures` is an opportunity to simplify things.  One concern is that this might be confusing (`--features` flag could behave differently in different workspaces, and documenting the differences), but that seems hard to avoid.

Closes #6195
Closes #4753
Closes #5015
Closes #4106
Closes #5362

4 years agoAdd some more exposition on fingerprints.
Eric Huss [Wed, 8 Apr 2020 16:57:12 +0000 (09:57 -0700)]
Add some more exposition on fingerprints.

4 years agoAuto merge of #8090 - mbStavola:invalid-dep-naming, r=alexcrichton
bors [Thu, 9 Apr 2020 15:26:04 +0000 (15:26 +0000)]
Auto merge of #8090 - mbStavola:invalid-dep-naming, r=alexcrichton

Disallow invalid dependency names through crate renaming

resolves #6656

As suggested in the issue, I simply checked the dep names by calling `validate_package_name` on the dependencies during the TOML deserialization process.

It might be a bit too strict (and sudden) to error out in this case, so it might be best to convert this into a warning instead. However, this _is_ pretty invalid behavior so I'm not too sure really.

4 years agoAuto merge of #8073 - ehuss:hash-channel, r=alexcrichton
bors [Thu, 9 Apr 2020 14:25:08 +0000 (14:25 +0000)]
Auto merge of #8073 - ehuss:hash-channel, r=alexcrichton

Use the same filename hash for pre-release channels.

This changes it so that filenames do not hash the entire verbose version from rustc if they are a pre-release version. The intent is to avoid leaving stale artifacts in the target directory whenever someone updates a nightly or beta release. This should help reduce disk space usage for someone who updates these toolchains frequently.

I tested with the rustc repo, and it seems to be OK. It keeps everything in separate target directories, so I think it should be generally safe. This should only affect someone switching between different nightlies and wanting to avoid recompiling when switching back. I suspect that is a rare use case, though if there are complaints this can be easily reverted (or made a config option). cargo-bisect-rustc should also be safe since it uses a different target directory for each toolchain.

One concern here for me was incremental support. It looks like ([src](https://github.com/rust-lang/rust/blob/6387b09153939b2a104cd63148598a5f458de2c2/src/librustc_incremental/persist/file_format.rs#L88-L100)) the incremental cache includes the detailed rustc version, so I think that is safe. It also looks like it is [smart enough](https://github.com/rust-lang/rust/blob/6387b09153939b2a104cd63148598a5f458de2c2/src/librustc_incremental/persist/load.rs#L40-L49) to delete stale files.

We will need to be more careful in the future when changing the target directory structure or the format of files. We previously relied on the fact that each new nightly will use different filenames. If we change the structure in a backwards-incompatible way, we will need to be careful to update the version (`1.hash` in `compute_metadata`).

4 years agoAdd test for bad renaming
Matt Stavola [Thu, 9 Apr 2020 06:46:30 +0000 (23:46 -0700)]
Add test for bad renaming