diff --git a/CHANGELOG.md b/CHANGELOG.md index 652dd52e5..944cc009e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,95 @@ # Changelog -## Cargo 1.46 (2020-08-27) -[9fcb8c1d...HEAD](https://github.com/rust-lang/cargo/compare/9fcb8c1d...HEAD) +## Cargo 1.47 (2020-10-08) +[4f74d9b2...HEAD](https://github.com/rust-lang/cargo/compare/4f74d9b2...HEAD) ### Added +### Changed +- The comments added to `.gitignore` when it is modified have been tweaked to + add some spacing. + [#8476](https://github.com/rust-lang/cargo/pull/8476) +- `cargo metadata` output should now be sorted to be deterministic. + [#8489](https://github.com/rust-lang/cargo/pull/8489) +- By default, build scripts and proc-macros are now built with `opt-level=0` + and the default codegen units, even in release mode. + [#8500](https://github.com/rust-lang/cargo/pull/8500) + +### Fixed +- Fixed issue where if a project directory was moved, and one of the + build scripts did not use the `rerun-if-changed` directive, then that + build script was being rebuilt when it shouldn't. + [#8497](https://github.com/rust-lang/cargo/pull/8497) + +### Nightly only +- Added support for `-Z terminal-width` which tells `rustc` the width of the + terminal so that it can format diagnostics better. + [docs](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#terminal-width) + [#8427](https://github.com/rust-lang/cargo/pull/8427) +- Added ability to configure `-Z` unstable flags in config files via the + `[unstable]` table. + [docs](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html) + [#8393](https://github.com/rust-lang/cargo/pull/8393) +- Added [`-Z build-std-features`] flag to set features for the standard library. + [#8490](https://github.com/rust-lang/cargo/pull/8490) + +## Cargo 1.46 (2020-08-27) +[9fcb8c1d...rust-1.46.0](https://github.com/rust-lang/cargo/compare/9fcb8c1d...rust-1.46.0) + +### Added +- The `dl` key in `config.json` of a registry index now supports the + replacement markers `{prefix}` and `{lowerprefix}` to allow spreading crates + across directories similar to how the index itself is structured. + [docs](https://doc.rust-lang.org/nightly/cargo/reference/registries.html#index-format) + [#8267](https://github.com/rust-lang/cargo/pull/8267) +- Added new environment variables that are set during compilation: + - `CARGO_CRATE_NAME`: The name of the crate being built. + - `CARGO_BIN_NAME`: The name of the executable binary (if this is a binary crate). + - `CARGO_PKG_LICENSE`: The `license` field from the manifest. + - `CARGO_PKG_LICENSE_FILE`: The `license-file` field from the manifest. + [#8270](https://github.com/rust-lang/cargo/pull/8270) + [#8325](https://github.com/rust-lang/cargo/pull/8325) + [#8387](https://github.com/rust-lang/cargo/pull/8387) +- If the value for `readme` is not specified in `Cargo.toml`, it is now + automatically inferred from the existence of a file named `README`, + `README.md`, or `README.txt`. This can be suppressed by setting + `readme = false`. + [#8277](https://github.com/rust-lang/cargo/pull/8277) +- `cargo install` now supports the `--index` flag to install directly from an index. + [#8344](https://github.com/rust-lang/cargo/pull/8344) +- Added the `metadata` table to the `workspace` definition in `Cargo.toml`. + This can be used for arbitrary data similar to the `package.metadata` table. + [#8323](https://github.com/rust-lang/cargo/pull/8323) +- Added the `--target-dir` flag to `cargo install` to set the target directory. + [#8391](https://github.com/rust-lang/cargo/pull/8391) +- Changes to environment variables used by the + [`env!`](https://doc.rust-lang.org/std/macro.env.html) or + [`option_env!`](https://doc.rust-lang.org/std/macro.option_env.html) macros + are now automatically detected to trigger a rebuild. + [#8421](https://github.com/rust-lang/cargo/pull/8421) +- The `target` directory now includes the `CACHEDIR.TAG` file which is used by + some tools to exclude the directory from backups. + [#8378](https://github.com/rust-lang/cargo/pull/8378) +- Added docs about rustup's `+toolchain` syntax. + [#8455](https://github.com/rust-lang/cargo/pull/8455) + ### Changed - A warning is now displayed if a git dependency includes a `#` fragment in the URL. This was potentially confusing because Cargo itself displays git URLs with this syntax, but it does not have any meaning outside of the `Cargo.lock` file, and would not work properly. [#8297](https://github.com/rust-lang/cargo/pull/8297) +- Various optimizations and fixes for bitcode embedding and LTO. + [#8349](https://github.com/rust-lang/cargo/pull/8349) +- Reduced the amount of data fetched for git dependencies. If Cargo knows the + branch or tag to fetch, it will now only fetch that branch or tag instead of + all branches and tags. + [#8363](https://github.com/rust-lang/cargo/pull/8363) +- Enhanced git fetch error messages. + [#8409](https://github.com/rust-lang/cargo/pull/8409) +- `.crate` files are now generated with GNU tar format instead of UStar, which + supports longer file names. + [#8453](https://github.com/rust-lang/cargo/pull/8453) ### Fixed - Fixed a rare situation where an update to `Cargo.lock` failed once, but then @@ -22,6 +101,27 @@ - Updated libgit2, which brings in a fix for zlib errors for some remote git servers like googlesource.com. [#8320](https://github.com/rust-lang/cargo/pull/8320) +- Fixed the GitHub fast-path check for up-to-date git dependencies on + non-master branches. + [#8363](https://github.com/rust-lang/cargo/pull/8363) +- Fixed issue when enabling a feature with `pkg/feature` syntax, and `pkg` is + an optional dependency, but also a dev-dependency, and the dev-dependency + appears before the optional normal dependency in the registry summary, then + the optional dependency would not get activated. + [#8395](https://github.com/rust-lang/cargo/pull/8395) +- Fixed `clean -p` deleting the build directory if there is a test named + `build`. + [#8398](https://github.com/rust-lang/cargo/pull/8398) +- Fixed indentation of multi-line Cargo error messages. + [#8409](https://github.com/rust-lang/cargo/pull/8409) +- Fixed issue where the automatic inclusion of the `--document-private-items` + flag for rustdoc would override any flags passed to the `cargo rustdoc` + command. + [#8449](https://github.com/rust-lang/cargo/pull/8449) +- Cargo will now include a version in the hash of the fingerprint directories + to support backwards-incompatible changes to the fingerprint structure. + [#8473](https://github.com/rust-lang/cargo/pull/8473) + [#8488](https://github.com/rust-lang/cargo/pull/8488) ### Nightly only - Added `-Zrustdoc-map` feature which provides external mappings for rustdoc @@ -31,7 +131,10 @@ - Fixed feature calculation when a proc-macro is declared in `Cargo.toml` with an underscore (like `proc_macro = true`). [#8319](https://github.com/rust-lang/cargo/pull/8319) - +- Added support for setting `-Clinker` with `-Zdoctest-xcompile`. + [#8359](https://github.com/rust-lang/cargo/pull/8359) +- Fixed setting the `strip` profile field in config files. + [#8454](https://github.com/rust-lang/cargo/pull/8454) ## Cargo 1.45 (2020-07-16) [ebda5065e...rust-1.45.0](https://github.com/rust-lang/cargo/compare/ebda5065...rust-1.45.0) diff --git a/Cargo.toml b/Cargo.toml index 61006215d..f5f73c4c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo" -version = "0.47.0" +version = "0.48.0" edition = "2018" authors = ["Yehuda Katz ", "Carl Lerche ", diff --git a/src/cargo/core/compiler/build_context/target_info.rs b/src/cargo/core/compiler/build_context/target_info.rs index b2d0b0ffe..a36017f3e 100644 --- a/src/cargo/core/compiler/build_context/target_info.rs +++ b/src/cargo/core/compiler/build_context/target_info.rs @@ -40,8 +40,6 @@ pub struct TargetInfo { pub rustflags: Vec, /// Extra flags to pass to `rustdoc`, see `env_args`. pub rustdocflags: Vec, - /// Remove this when it hits stable (1.45) - pub supports_embed_bitcode: Option, } /// Kind of each file generated by a Unit, part of `FileType`. @@ -143,13 +141,6 @@ impl TargetInfo { .args(&rustflags) .env_remove("RUSTC_LOG"); - let mut embed_bitcode_test = process.clone(); - embed_bitcode_test.arg("-Cembed-bitcode"); - let supports_embed_bitcode = match kind { - CompileKind::Host => Some(rustc.cached_output(&embed_bitcode_test).is_ok()), - _ => None, - }; - if let CompileKind::Target(target) = kind { process.arg("--target").arg(target.rustc_target()); } @@ -240,7 +231,6 @@ impl TargetInfo { "RUSTDOCFLAGS", )?, cfg, - supports_embed_bitcode, }) } diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index 91d444cce..5288d61f7 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -817,31 +817,10 @@ fn build_base_args( } lto::Lto::ObjectAndBitcode => {} // this is rustc's default lto::Lto::OnlyBitcode => { - // Note that this compiler flag, like the one below, is just an - // optimization in terms of build time. If we don't pass it then - // both object code and bitcode will show up. This is lagely just - // compat until the feature lands on stable and we can remove the - // conditional branch. - if cx - .bcx - .target_data - .info(CompileKind::Host) - .supports_embed_bitcode - .unwrap() - { - cmd.arg("-Clinker-plugin-lto"); - } + cmd.arg("-Clinker-plugin-lto"); } lto::Lto::OnlyObject => { - if cx - .bcx - .target_data - .info(CompileKind::Host) - .supports_embed_bitcode - .unwrap() - { - cmd.arg("-Cembed-bitcode=no"); - } + cmd.arg("-Cembed-bitcode=no"); } } diff --git a/tests/testsuite/lto.rs b/tests/testsuite/lto.rs index 95d6c0c38..940bedc6d 100644 --- a/tests/testsuite/lto.rs +++ b/tests/testsuite/lto.rs @@ -5,10 +5,6 @@ use std::process::Output; #[cargo_test] fn with_deps() { - if !cargo_test_support::is_nightly() { - return; - } - Package::new("bar", "0.0.1").publish(); let p = project() @@ -36,10 +32,6 @@ fn with_deps() { #[cargo_test] fn shared_deps() { - if !cargo_test_support::is_nightly() { - return; - } - Package::new("bar", "0.0.1").publish(); let p = project() @@ -70,10 +62,6 @@ fn shared_deps() { #[cargo_test] fn build_dep_not_ltod() { - if !cargo_test_support::is_nightly() { - return; - } - Package::new("bar", "0.0.1").publish(); let p = project() @@ -102,10 +90,6 @@ fn build_dep_not_ltod() { #[cargo_test] fn complicated() { - if !cargo_test_support::is_nightly() { - return; - } - Package::new("dep-shared", "0.0.1") .file("src/lib.rs", "pub fn foo() {}") .publish(); @@ -233,10 +217,6 @@ fn complicated() { #[cargo_test] fn off_in_manifest_works() { - if !cargo_test_support::is_nightly() { - return; - } - Package::new("bar", "0.0.1") .file("src/lib.rs", "pub fn foo() {}") .publish(); @@ -284,10 +264,6 @@ fn off_in_manifest_works() { #[cargo_test] fn between_builds() { - if !cargo_test_support::is_nightly() { - return; - } - let p = project() .file( "Cargo.toml", @@ -325,10 +301,6 @@ fn between_builds() { #[cargo_test] fn test_all() { - if !cargo_test_support::is_nightly() { - return; - } - let p = project() .file( "Cargo.toml", @@ -352,10 +324,6 @@ fn test_all() { #[cargo_test] fn test_all_and_bench() { - if !cargo_test_support::is_nightly() { - return; - } - let p = project() .file( "Cargo.toml", @@ -495,9 +463,6 @@ fn verify_lto(output: &Output, krate: &str, krate_info: &str, expected_lto: Lto) #[cargo_test] fn cdylib_and_rlib() { - if !cargo_test_support::is_nightly() { - return; - } let p = project_with_dep("'cdylib', 'rlib'"); let output = p.cargo("build --release -v").exec_with_output().unwrap(); verify_lto( @@ -564,9 +529,6 @@ fn cdylib_and_rlib() { #[cargo_test] fn dylib() { - if !cargo_test_support::is_nightly() { - return; - } let p = project_with_dep("'dylib'"); let output = p.cargo("build --release -v").exec_with_output().unwrap(); verify_lto(&output, "registry", "--crate-type lib", Lto::OnlyObject); @@ -623,9 +585,6 @@ fn dylib() { #[cargo_test] fn test_profile() { - if !cargo_test_support::is_nightly() { - return; - } Package::new("bar", "0.0.1") .file("src/lib.rs", "pub fn foo() -> i32 { 123 } ") .publish(); @@ -677,9 +636,6 @@ fn test_profile() { #[cargo_test] fn dev_profile() { - if !cargo_test_support::is_nightly() { - return; - } // Mixing dev=LTO with test=not-LTO Package::new("bar", "0.0.1") .file("src/lib.rs", "pub fn foo() -> i32 { 123 } ") diff --git a/tests/testsuite/rustc_info_cache.rs b/tests/testsuite/rustc_info_cache.rs index db016e0ae..52d0eccde 100644 --- a/tests/testsuite/rustc_info_cache.rs +++ b/tests/testsuite/rustc_info_cache.rs @@ -6,12 +6,6 @@ use std::env; #[cargo_test] fn rustc_info_cache() { - // Needs `-Cbitcode-in-rlib` to ride to stable before this can be enabled - // everywhere. - if !cargo_test_support::is_nightly() { - return; - } - let p = project() .file("src/main.rs", r#"fn main() { println!("hello"); }"#) .build();