Add --name suggestion for cargo new
Resolves#8613
Since `check_name` have already got a parameter to show name help, I reuse the logic and sync the behavior between `cargo init` and `cargo new`. The divergence seems to be intentionally made in #7959:
_...Only print the --name suggestion for `cargo init`._
Feel free to discuss.
Sweep unrelated message from unnecessary workspace infromation
Resolves#8619
Only pass workspace information when the source is from a local crate installation.
Allow running build-man.sh from any directory
Before:
```console
$ src/doc/build-man.sh
error: manifest path `../../crates/mdman/Cargo.toml` does not exist
```
After: works.
Fix nightly exported_priv_warning test.
Error messages have slightly changed due to https://github.com/rust-lang/rust/pull/73996 to not include the full path. I used a `[..]` match just in case anyone is still using a slightly older nightly, or if it changes again in the future.
fix mdbook test with ```ignore/text/sh/console
I revitalized the dead PR #7832
sorry about the delay
testing is just running `mdbook test` which now passes! Let me know if you want me to add mdbook test to ci as well!
End CACHEDIR.TAG with newline
Before:
```
/path/to$ cat target/CACHEDIR.TAG
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir//path/to$ ▎
```
After:
```
/path/to$ cat target/CACHEDIR.TAG
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/
/path/to$ ▎
```
Fixed the fossil repo initialization actually run commands
I noticed that when using fossil cargo new would not ignore the target directory and that the commands to do so weren't being executed. I wasn't sure if opening an issue was needed as the fix is extremely simple, if an issue is needed I can create one.
Fix LTO with doctests.
This fixes an issue where `cargo test --release` would fail to run doctests if LTO is set in `profile.release` or `profile.bench`.
The issue is that dependencies were built with `-Clinker-plugin-lto`, but the final rustdoc invocation did not issue `-C lto`. This causes a link failure (or crash!) because the necessary object code was missing. This is because rustdoc historically did not support codegen flags, so Cargo has never passed them in. Rustdoc now supports codegen flags (via https://github.com/rust-lang/rust/pull/63827), so it should be safe to start passing them in. For now, I am only adding LTO, but more should be added in the future.
There are two bugs here. One is that LTO flags aren't passed to rustdoc. The other is that the "doctest" unit was using the wrong profile (it was using dev/release when it should be using test/bench).
There are two distinct scenarios here. One where just `release` has `lto` set. And one where both `release` and `bench` have `lto` set. This is relevant because LTO mostly cares about what the final artifact wants, and in the case where `bench` does not have `lto` set, then LTO will not be used for tests. This will hopefully be a little cleaner in the future when #6988 is stabilized, which causes the test/bench profiles to *inherit* from the dev/bench profiles, which means you won't need to manually synchronize the test/bench profiles with dev/release.
Fixes#8654
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.