Add spaces after -C and -Z flags for consistency
Most other options have a space after flag name.
This commit makes verbose output of rustc invocations a little bit cleaner.
Fix cache_messages::rustdoc test broken on beta.
The most recent beta `rustc 1.47.0-beta.1` broke this test (https://github.com/rust-lang/rust/issues/75951). Just switch to a different lint to get the test working again.
fix: remove unnecessary allocations
Remove unnecessary `str::to_string` and `str::replace` allocations by using iterators. This PR is almost identical to #8622 except it does not skip the generated header.
Sorry that I did not profile the changes by myself. Seems that valgrind does not support macOS 10.15.6, I have not idea how to profile cargo subcommand. It would be great for an instruction to run a memory profiling for Rust program on macOS.
Add chapters on dependency resolution and SemVer compatibility.
This adds two documentation chapters, one on the resolver and one on SemVer compatibility. These are intended to help guide users on how to version their package and how to use dependencies.
I did not document `[patch]` resolution. Perhaps someday in the future the the "Overriding dependencies" chapter can be expanded to include more details on how patch works, and how to properly use it. I have a bunch of notes on this, but I want to defer it till later.
The SemVer compatibility guidelines were guided by [RFC 1105](https://github.com/rust-lang/rfcs/blob/master/text/1105-api-evolution.md), but are edited and expanded based on my own personal observations. I tried to highlight when some rules do not appear to have consensus on behavior. I would be happy for any additions or modifications to the rule list. I have a list of additional things to add, but I wanted to get the ball rolling, and it might take a while finish them.
Each compatibility entry has an example, and there is a small script which tests all the examples to ensure they work like they are supposed to. This script checks against the compiler output, which can be fragile over time. If that becomes too troublesome, we can probably find some more relaxed checks. I think checking the error is important because I've run into cases in the past where using basic "compile_fail" annotations were misleading because the examples were failing for the wrong reason.
Closes#7301
Renames SourceId::into_url -> SourceId::as_url
While studying the source code, I am surprised to see that `into_url`
does not actually consume its caller when a function with such name
usually does. Additionally, there is a trait in `cargo::util::IntoUrl`
with the same and does exactly what you expect, consumes itself and yields
a `CargoResult<Url>`.
I hope this is not too nitpicky.
Thank you!
Fix bug with PathAndArg config values
This fixes an issue I noticed when trying to specify a target runner via the [`CARGO_TARGET_{triplet}_RUNNER`](https://doc.rust-lang.org/cargo/reference/config.html#targettriplerunner) environment variable, expecting it to override the value in our `.cargo/config.toml` file, which was giving quite strange errors until I figured out that cargo was actually merging the config file's values with the environment's values.
This change adds a small hack to use and `UnmergedStringList` from `PathAndArgs` instead of just plain `StringList`, which uses the type in the deserializer to determine if `Config::get_list_or_string` should merge the values from the config file(s) with the environment as it was doing before, or else only use the environment to the exclusion of the config file(s) if the key was set in the environment.
I also added a test for this to confirm both the bug and the fix.
Show full error context on `cargo run` error.
If there was an error exec-ing a process with `cargo run`, the error message was not displayed. The code was calling `downcast` to a `ProcessError` which erased the surrounding error context. As shown in the modified test, it should now include a `Caused by:` message with the underlying error message.
Fix typo in SIGQUIT description
This PR fixes a small typo in the SIGQUIT description.
(edit: removed my notes about automated tests because the PR bot has a more complete summary.)
In terms of manual testing: I had a test that raised `SIGQUIT` using the "coredump" crate. Previously, it emitted:
```
error: test failed, to rerun pass '--test the_test'
Caused by:
process didn't exit successfully: `/Users/dap/oxide/experiments/rust-coredump/target/debug/deps/the_test-a8a068307be90649 --nocapture` (signal: 3, SIGQUIT: terminal quite signal)
```
Now, it emits:
```
error: test failed, to rerun pass '--test the_test'
Caused by:
process didn't exit successfully: `/Users/dap/oxide/experiments/rust-coredump/target/debug/deps/the_test-20c8e90133861ece --nocapture` (signal: 3, SIGQUIT: terminal quit signal)
```
which looks correct.
While studying the source code, I am surprised to see that `into_url`
does not actually consume the string when a function with such name
usually does. Additionally, there are traits in `cargo::util::IntoUrl`
with the same and does exactly what you expect, consumes T and yields
a `Url`.
I hope this is not too nitpicky.
Thank you!
Keep deterministic builds for Cargo! The changes here are:
* Sort files being added to the archive to ensure they're added in the
same order on all platforms.
* Flag the archive builder as "deterministic mode" which means it won't
pick up fields like mtime.
Closes#8599
doc: Qualify GNU licenses in example license field
Since SPDX License list 3.0, unqualified GNU licenses are deprecated:
https://www.gnu.org/licenses/identify-licenses-clearly.html
We use version 3.6 of the list so we should not use the deprecated licenses.
Default cargo publish to the alt registry if it's the only allowed one
Hi, this PR fixes#8036. Previously if we had only one allowed registry in Cargo.toml file, `cargo publish` was failing. But with this PR, we are defaulting to the only allowed registry with printing a note if there is only one registry in that array. I believe this will make things easier for people who use an alternative registry all the time.