9492 Commits

Author SHA1 Message Date
Eric Huss
e2d1d2456c Fix several issues with close_output test. 2020-05-26 11:35:48 -07:00
bors
9fcb8c1d20 Auto merge of #8279 - illicitonion:bump-semver, r=ehuss
Bump to semver 0.10 for `VersionReq::is_exact`

This stops using `to_string` as a proxy for this now-provided precise API.

This reverts commit b71927224fd9306b2b5bd2b4f8c22268eadfeb6a and bumps the
dependency version in Cargo.toml.
2020-05-25 16:25:36 +00:00
Daniel Wagner-Hall
556c236f9a Bump to semver 0.10 for VersionReq::is_exact
This stops using `to_string` as a proxy for this now-provided precise API.

This reverts commit b71927224fd9306b2b5bd2b4f8c22268eadfeb6a and bupms the
dependency version in Cargo.toml.
2020-05-25 11:11:45 +01:00
bors
40d566d0ae Auto merge of #8269 - ehuss:tree-all-targets, r=alexcrichton
Fix panic with `cargo tree --target=all -Zfeatures=all`

When `cargo tree --target=all` was used with the new feature resolver, this would cause a panic because the feature resolver doesn't know about the "all" behavior, and would filter out packages that don't match.

I don't feel like this is a particularly elegant solution, but I'm uncertain of how to make it better.

Closes #8109
2020-05-23 19:19:52 +00:00
bors
daf7f2f0fd Auto merge of #8272 - ehuss:fix-llvm-tools, r=alexcrichton
Fix nightly tests with llvm-tools.

https://github.com/rust-lang/rust/pull/72000 removed `libLLVM-10-rust-1.45.0-nightly.so` from the default install. Several of the plugins tests fail without this, so make sure it gets installed.
2020-05-23 18:38:03 +00:00
Eric Huss
e4863cf23a Fix nightly tests with llvm-tools. 2020-05-23 11:33:32 -07:00
Eric Huss
d267fac227 Fix panic with cargo tree --target=all -Zfeatures=all 2020-05-22 14:35:07 -07:00
bors
d662f2559b Auto merge of #8248 - ehuss:patch-err-help, r=alexcrichton
Provide better error messages for a bad `patch`.

This attempts to provide more user-friendly error messages for some situations with a bad `patch`.  This is a follow-up to #8243.

I think this more or less covers all the issues from #4678.  I imagine there are other corner cases, but those will need to wait for another day. The main one I can think of is when the patch location is missing required features.  Today you get a "blah was not used in the crate graph." warning, with some suggestions added in #6470, but it doesn't actually check if there is a feature mismatch.

Closes #4678
2020-05-21 14:29:50 +00:00
bors
9b9451325b Auto merge of #8022 - illicitonion:trywithout, r=ehuss
Try installing exact versions before updating

When an exact version is being installed, if we already have that
version from the index, we don't need to update the index before
installing it. Don't do this if it's not an exact version, because the
update may find us a newer version.

This is particularly useful for scripts which unconditionally run
`cargo install some-crate --version=1.2.3`. Before install-update, I
wrote a crate to do this
(https://crates.io/crates/cargo-ensure-installed) which I'm trying to
replace with just `cargo install`, but the extra latency of updating the
index for a no-op is noticeable.
2020-05-20 20:48:44 +00:00
Daniel Wagner-Hall
b71927224f Switch to using existing is_locked implementation
semver hasn't merged the upstream PR (yet)
2020-05-20 20:38:23 +01:00
Eric Huss
4f2bae9377 Revert change to automatically select the greatest patch match. 2020-05-20 10:18:45 -07:00
bors
cf00ee117b Auto merge of #8262 - alexcrichton:unstable-docs, r=ehuss
Document unstable `strip` profile feature
2020-05-20 16:26:54 +00:00
Eric Huss
5dde9cc911 Show patch location in error message. 2020-05-20 09:25:53 -07:00
Eric Huss
6fd11a7768 Don't include a special-case error for a locked patch matching 0 entries. 2020-05-20 08:44:26 -07:00
Eric Huss
2c0cd9741d Simplify error handling. 2020-05-20 08:36:30 -07:00
Alex Crichton
3bb63af320 Document unstable strip profile feature 2020-05-20 07:19:03 -07:00
Eric Huss
afa3acedf0 Make patches automatically update if updated. 2020-05-19 18:01:23 -07:00
bors
d18e4b36e7 Auto merge of #8246 - GabrielMajeri:add-strip-option, r=alexcrichton
Add option to strip binaries

This PR adds a Cargo option for stripping symbols from generated binaries.

This is based on the `-Z strip` flag for `rustc`, which has been [recently implemented](https://github.com/rust-lang/rust/issues/71757).

Notes for reviewers: I'm not entirely sure how we test this, I've created a crate locally and it seems to be working.

Supersedes my previous work in #8191.
Fixes #3483.
2020-05-19 20:18:54 +00:00
Gabriel Majeri
2cd41e1d7b Add more tests 2020-05-19 21:04:51 +03:00
Gabriel Majeri
5353f81ef2 Use serde for deserializing strip option 2020-05-19 21:04:47 +03:00
Gabriel Majeri
e768b17a87 Remove unstable CLI option 2020-05-19 21:02:23 +03:00
Gabriel Majeri
a10eb86281 Add test 2020-05-18 22:06:42 +03:00
Gabriel Majeri
9551ed34c1 Add nightly feature 2020-05-18 21:57:09 +03:00
Gabriel Majeri
348043a25c Fix typo 2020-05-18 21:56:59 +03:00
bors
500b2bd01c Auto merge of #8254 - alexcrichton:fix-lto-more, r=ehuss
Handle LTO with an rlib/cdylib crate type

In the case that LTO is happening but we're also generating a
cdylib/rlib simultatneously that means that the final artifact will use
the rlib but the cdylib still needs to be produced. To get this to work
the cdylib's dependency tree needs to be compiled with embedded bitcode.
The cdylib itself will be linked with the linker because we can't LTO an
rlib+cdylib compilation, but the final executable will need to load
bitcode from all its deps.

This is meant to address rust-lang/rust#72268
2020-05-18 17:12:54 +00:00
Alex Crichton
b45fd8ff0a Handle LTO with an rlib/cdylib crate type
In the case that LTO is happening but we're also generating a
cdylib/rlib simultatneously that means that the final artifact will use
the rlib but the cdylib still needs to be produced. To get this to work
the cdylib's dependency tree needs to be compiled with embedded bitcode.
The cdylib itself will be linked with the linker because we can't LTO an
rlib+cdylib compilation, but the final executable will need to load
bitcode from all its deps.

This is meant to address rust-lang/rust#72268
2020-05-18 08:48:52 -07:00
bors
b781ec4007 Auto merge of #8247 - ehuss:output-hang, r=alexcrichton
Gracefully handle errors during a build.

If there are certain errors like EPIPE during a build, Cargo runs the risk of hanging if the compiler emits too many messages. This happens because Cargo now uses a bounded queue for compiler messages. However, if the main loop exits while the threads are running, there is nothing to drain the queue, and thus the threads will block indefinitely.

The solution here is to be extra careful of how errors are handled in the main loop. All errors are now treated roughly the same (report the error, allow the queue to continue to drain).

I've also tweaked things so the *first* error is reported, not the last.

Closes #8245
2020-05-18 15:21:08 +00:00
Eric Huss
5e561ae335 Ensure drain_the_queue does not attempt to return a Result. 2020-05-18 08:07:05 -07:00
bors
fcf2236c55 Auto merge of #8255 - alexcrichton:update-im-rc, r=Eh2406
Update `im-rc` to 15.0.0

Hopefully just a routine update triggered by dependabot!
2020-05-18 13:26:06 +00:00
Alex Crichton
b5c191911c Update im-rc to 15.0.0
Hopefully just a routine update triggered by dependabot!
2020-05-18 05:57:42 -07:00
Eric Huss
b78cb373b8 Provide better error messages for a bad patch. 2020-05-16 13:39:51 -07:00
Gabriel Majeri
d36e793753 Fix tests 2020-05-16 22:28:06 +03:00
Gabriel Majeri
c6529dd66b Fix formatting 2020-05-16 20:47:55 +03:00
Gabriel Majeri
e7475cab62 Add option to strip binaries 2020-05-16 20:42:13 +03:00
Eric Huss
0a5960bcfb Gracefully handle errors during a build. 2020-05-16 09:43:03 -07:00
bors
13bded9a33 Auto merge of #8243 - ehuss:patch-unused-can-update, r=alexcrichton
Fix `cargo update` with unused patch.

If you end up with an unused patch in `Cargo.lock`, then you try to update the patch to a version that does not match the original unused patch, and run `cargo update`, Cargo refuses to update it with the error "patch for `bar` in `https://github.com/rust-lang/crates.io-index` did not resolve to any crates".  At this point, Cargo seems to be permanently stuck with no way to update it (unless you manually edit `Cargo.lock`).

The solution here is to add the unused patches to the "to_avoid" list, so that `cargo update` is allowed to update them.

I am uncertain if this is the best way to fix it, but seems to match my intuition of how `cargo update` is implemented.
2020-05-15 14:50:18 +00:00
Eric Huss
501e580452 Fix cargo update with unused patch. 2020-05-14 15:56:01 -07:00
Daniel Wagner-Hall
806490947d Merge branch 'master' into trywithout 2020-05-14 21:50:22 +01:00
bors
2fef2e5c5a Auto merge of #8200 - Julian-Wollersberger:master, r=alexcrichton
Rephrased error message for disallowed sections in virtual workspace

I changed the error message from `virtual manifests do not specify [target]` to `This virtual manifest specifies a [target] section, which is not allowed` because the old one confused me.

I encountered it while hacking on Rustc in CLion. I made a change to the `Cargo.toml` I had copied from StackOverflow and after the next restart code analysis and go-to-definition stopped working. After some fiddling, I tracked that down to my change in `Cargo.toml`. It took me a while because, like I said, the error message from CLion didn't make sense to me.
```
19:13	Cargo project update failed:
	Execution failed (exit code 101).
	        /home/julian/.cargo/bin/cargo metadata --verbose --format-version 1 --all-features
	        stdout : error: failed to parse manifest at `/home/julian/Dokumente/Rust/Compiler/rust/Cargo.toml`

	Caused by:
	  virtual manifests do not specify [target]

	        stderr :
```

I hope this change avoids future confusion :)
2020-05-14 14:30:20 +00:00
bors
cb7cff15c8 Auto merge of #8236 - ehuss:no-panic-output, r=alexcrichton
Ignore broken console output in some situations.

If stdout or stderr is closed while Cargo is running, Cargo would panic in some situations (usually with EPIPE). For example, `cargo install --list | grep -q cargo-fuzz`, where `grep` will close stdout once it gets a match. This changes it so that Cargo will ignore output errors in most situations. Failure to output a regular build message still results in an error, which follows the behavior of some tools like `make`.

All output, including stdout, now goes through `Shell`.

Closes #5234
2020-05-14 14:03:31 +00:00
Julian Wollersberger
d6a1428609 Rephrased error message for disallowed sections in virtual workspace 2020-05-14 10:26:20 +02:00
Eric Huss
5a096da9d7 Fix windows. 2020-05-13 16:24:20 -07:00
Eric Huss
62711bd385 Forbid certain macros in the codebase. 2020-05-13 16:22:51 -07:00
Eric Huss
7274307af4 Ignore broken console output in some situations. 2020-05-13 16:22:24 -07:00
bors
55869de80a Auto merge of #8235 - badboy:8234-numbers-in-strings-are-numbers, r=alexcrichton
Expand error message to explain that a string was found

With `opt-level = "3"` this previously said:

    must be an integer, `z`, or `s`, but found: 3 for ...

The error message doesn't make that super clear.
This should now be a bit more clear.

Fixes #8234

---

We could even include a bit more saying that `"3"` should become 3 (either unconditionally or after trying to parse `"3"` into an integer?

cc @steveklabnik
2020-05-12 22:23:08 +00:00
Jan-Erik Rediger
09084a365f Expand error message to explain that a string was found
With `opt-level = "3"` this previously said:

    must be an integer, `z`, or `s`, but found: 3 for ...

The error message doesn't make that super clear.
This should now be a bit more clear.

Fixes #8234
2020-05-12 21:41:03 +02:00
bors
058baec9d9 Auto merge of #8232 - ehuss:fs-error-context, r=alexcrichton
Add context to some fs errors.

This adds some extra context to most fs operations that indicates some more detail (particularly the path).  It can be frustrating when cargo says something generic like "Access is denied." without printing a path or information about what it is doing.

Addresses #8211, where it adds extra context to the message.
2020-05-12 14:27:16 +00:00
Eric Huss
ce86e866e9 Add context to some fs errors. 2020-05-11 14:10:10 -07:00
bors
22c091c7b4 Auto merge of #8233 - ehuss:siphasher, r=alexcrichton
Move SipHasher to an isolated module.

This allows removing the blanket `#![allow(deprecated)]` sprinkled whenever it is used.

We could alternatively use the [siphasher](https://crates.io/crates/siphasher) crate, but I don't think it is necessary at this time.
2020-05-11 20:54:49 +00:00
Eric Huss
67b10f745d Move SipHasher to an isolated module. 2020-05-11 13:45:18 -07:00