From dc0db358abe19481e475e10c32149b53370f1a1c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:31 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- src/tools/cargo/.github/workflows/main.yml | 9 +- src/tools/cargo/CHANGELOG.md | 228 +++- src/tools/cargo/Cargo.lock | 677 ++++++----- src/tools/cargo/Cargo.toml | 21 +- src/tools/cargo/README.md | 2 +- src/tools/cargo/clippy.toml | 2 + .../crates/cargo-test-support/src/containers.rs | 4 +- .../cargo/crates/cargo-test-support/src/lib.rs | 6 +- .../cargo/crates/cargo-test-support/src/paths.rs | 21 +- .../crates/cargo-test-support/src/registry.rs | 2 +- .../cargo/crates/cargo-test-support/src/tools.rs | 15 +- src/tools/cargo/crates/cargo-util/Cargo.toml | 2 +- src/tools/cargo/crates/cargo-util/src/paths.rs | 17 +- src/tools/cargo/crates/resolver-tests/Cargo.toml | 1 - src/tools/cargo/crates/resolver-tests/src/lib.rs | 4 - .../cargo/crates/resolver-tests/tests/resolve.rs | 4 +- .../cargo-credential-1password/README.md | 7 + .../cargo-credential-gnome-secret/README.md | 7 + .../cargo-credential-gnome-secret/build.rs | 7 +- .../cargo-credential-gnome-secret/src/libsecret.rs | 190 +++ .../cargo-credential-gnome-secret/src/main.rs | 194 +--- .../cargo-credential-macos-keychain/README.md | 7 + .../credential/cargo-credential-wincred/README.md | 7 + src/tools/cargo/src/bin/cargo/cli.rs | 162 ++- src/tools/cargo/src/bin/cargo/commands/add.rs | 13 + src/tools/cargo/src/bin/cargo/commands/install.rs | 11 + src/tools/cargo/src/bin/cargo/commands/mod.rs | 4 +- src/tools/cargo/src/bin/cargo/commands/run.rs | 90 +- src/tools/cargo/src/bin/cargo/main.rs | 6 +- .../cargo/src/cargo/core/compiler/build_config.rs | 22 +- .../cargo/src/cargo/core/compiler/custom_build.rs | 59 +- .../src/cargo/core/compiler/fingerprint/mod.rs | 5 +- src/tools/cargo/src/cargo/core/compiler/mod.rs | 208 ++-- .../src/cargo/core/compiler/unit_dependencies.rs | 2 +- src/tools/cargo/src/cargo/core/features.rs | 166 +-- src/tools/cargo/src/cargo/core/manifest.rs | 6 + src/tools/cargo/src/cargo/core/package.rs | 41 +- src/tools/cargo/src/cargo/core/package_id.rs | 16 +- src/tools/cargo/src/cargo/core/profiles.rs | 56 +- src/tools/cargo/src/cargo/core/resolver/encode.rs | 9 + .../cargo/src/cargo/core/resolver/features.rs | 3 +- src/tools/cargo/src/cargo/core/resolver/resolve.rs | 4 + .../cargo/src/cargo/core/resolver/version_prefs.rs | 3 - src/tools/cargo/src/cargo/core/shell.rs | 2 +- src/tools/cargo/src/cargo/core/source/mod.rs | 27 +- src/tools/cargo/src/cargo/core/source/source_id.rs | 10 +- src/tools/cargo/src/cargo/core/summary.rs | 68 +- src/tools/cargo/src/cargo/core/workspace.rs | 48 +- src/tools/cargo/src/cargo/lib.rs | 3 + src/tools/cargo/src/cargo/ops/cargo_clean.rs | 7 +- src/tools/cargo/src/cargo/ops/cargo_compile/mod.rs | 6 +- src/tools/cargo/src/cargo/ops/cargo_fetch.rs | 3 +- src/tools/cargo/src/cargo/ops/cargo_install.rs | 4 +- src/tools/cargo/src/cargo/ops/cargo_new.rs | 13 + src/tools/cargo/src/cargo/ops/cargo_package.rs | 11 +- src/tools/cargo/src/cargo/ops/cargo_test.rs | 13 +- src/tools/cargo/src/cargo/ops/lockfile.rs | 43 +- src/tools/cargo/src/cargo/ops/mod.rs | 14 +- src/tools/cargo/src/cargo/ops/registry.rs | 1227 -------------------- src/tools/cargo/src/cargo/ops/registry/login.rs | 160 +++ src/tools/cargo/src/cargo/ops/registry/logout.rs | 42 + src/tools/cargo/src/cargo/ops/registry/mod.rs | 213 ++++ src/tools/cargo/src/cargo/ops/registry/owner.rs | 93 ++ src/tools/cargo/src/cargo/ops/registry/publish.rs | 461 ++++++++ src/tools/cargo/src/cargo/ops/registry/search.rs | 95 ++ src/tools/cargo/src/cargo/ops/registry/yank.rs | 76 ++ src/tools/cargo/src/cargo/sources/config.rs | 4 +- .../cargo/src/cargo/sources/git/known_hosts.rs | 5 +- src/tools/cargo/src/cargo/sources/git/mod.rs | 10 + src/tools/cargo/src/cargo/sources/git/oxide.rs | 4 +- src/tools/cargo/src/cargo/sources/git/source.rs | 73 +- src/tools/cargo/src/cargo/sources/git/utils.rs | 445 +++++-- src/tools/cargo/src/cargo/sources/path.rs | 2 +- .../cargo/src/cargo/sources/registry/download.rs | 42 +- .../src/cargo/sources/registry/http_remote.rs | 84 +- .../cargo/src/cargo/sources/registry/index.rs | 533 ++++++--- .../cargo/src/cargo/sources/registry/local.rs | 60 +- src/tools/cargo/src/cargo/sources/registry/mod.rs | 415 +++---- .../cargo/src/cargo/sources/registry/remote.rs | 126 +- src/tools/cargo/src/cargo/util/auth.rs | 839 ------------- src/tools/cargo/src/cargo/util/auth/asymmetric.rs | 155 +++ src/tools/cargo/src/cargo/util/auth/mod.rs | 724 ++++++++++++ src/tools/cargo/src/cargo/util/command_prelude.rs | 61 +- src/tools/cargo/src/cargo/util/config/mod.rs | 41 +- src/tools/cargo/src/cargo/util/config/target.rs | 18 +- src/tools/cargo/src/cargo/util/interning.rs | 10 +- src/tools/cargo/src/cargo/util/network/http.rs | 216 ++++ src/tools/cargo/src/cargo/util/network/mod.rs | 40 +- src/tools/cargo/src/cargo/util/network/retry.rs | 28 +- src/tools/cargo/src/cargo/util/profile.rs | 2 +- src/tools/cargo/src/cargo/util/restricted_names.rs | 24 + src/tools/cargo/src/cargo/util/toml/embedded.rs | 895 ++++++++++++++ src/tools/cargo/src/cargo/util/toml/mod.rs | 263 ++--- .../cargo/src/cargo/util/toml_mut/manifest.rs | 11 +- .../cargo/src/doc/contrib/src/process/index.md | 10 +- .../doc/contrib/src/process/working-on-cargo.md | 2 +- src/tools/cargo/src/doc/man/cargo-install.md | 4 +- src/tools/cargo/src/doc/man/cargo-test.md | 13 +- .../src/doc/man/generated_txt/cargo-bench.txt | 1 + .../src/doc/man/generated_txt/cargo-build.txt | 1 + .../src/doc/man/generated_txt/cargo-check.txt | 1 + .../cargo/src/doc/man/generated_txt/cargo-doc.txt | 1 + .../cargo/src/doc/man/generated_txt/cargo-fix.txt | 1 + .../src/doc/man/generated_txt/cargo-install.txt | 6 +- .../src/doc/man/generated_txt/cargo-package.txt | 1 + .../src/doc/man/generated_txt/cargo-publish.txt | 1 + .../cargo/src/doc/man/generated_txt/cargo-run.txt | 1 + .../src/doc/man/generated_txt/cargo-rustc.txt | 1 + .../src/doc/man/generated_txt/cargo-rustdoc.txt | 1 + .../cargo/src/doc/man/generated_txt/cargo-test.txt | 18 +- .../cargo/src/doc/man/includes/options-jobs.md | 3 +- .../cargo/src/doc/src/commands/cargo-bench.md | 3 +- .../cargo/src/doc/src/commands/cargo-build.md | 3 +- .../cargo/src/doc/src/commands/cargo-check.md | 3 +- src/tools/cargo/src/doc/src/commands/cargo-doc.md | 3 +- src/tools/cargo/src/doc/src/commands/cargo-fix.md | 3 +- .../cargo/src/doc/src/commands/cargo-install.md | 7 +- .../cargo/src/doc/src/commands/cargo-package.md | 3 +- .../cargo/src/doc/src/commands/cargo-publish.md | 3 +- src/tools/cargo/src/doc/src/commands/cargo-run.md | 3 +- .../cargo/src/doc/src/commands/cargo-rustc.md | 3 +- .../cargo/src/doc/src/commands/cargo-rustdoc.md | 3 +- src/tools/cargo/src/doc/src/commands/cargo-test.md | 16 +- src/tools/cargo/src/doc/src/faq.md | 46 + src/tools/cargo/src/doc/src/reference/config.md | 5 +- .../src/doc/src/reference/environment-variables.md | 1 + .../cargo/src/doc/src/reference/registry-index.md | 10 + src/tools/cargo/src/doc/src/reference/resolver.md | 2 +- .../doc/src/reference/specifying-dependencies.md | 40 +- src/tools/cargo/src/doc/src/reference/unstable.md | 170 ++- src/tools/cargo/src/etc/man/cargo-bench.1 | 3 +- src/tools/cargo/src/etc/man/cargo-build.1 | 3 +- src/tools/cargo/src/etc/man/cargo-check.1 | 3 +- src/tools/cargo/src/etc/man/cargo-doc.1 | 3 +- src/tools/cargo/src/etc/man/cargo-fix.1 | 3 +- src/tools/cargo/src/etc/man/cargo-install.1 | 7 +- src/tools/cargo/src/etc/man/cargo-package.1 | 3 +- src/tools/cargo/src/etc/man/cargo-publish.1 | 3 +- src/tools/cargo/src/etc/man/cargo-run.1 | 3 +- src/tools/cargo/src/etc/man/cargo-rustc.1 | 3 +- src/tools/cargo/src/etc/man/cargo-rustdoc.1 | 3 +- src/tools/cargo/src/etc/man/cargo-test.1 | 16 +- src/tools/cargo/tests/internal.rs | 107 -- src/tools/cargo/tests/testsuite/bench.rs | 5 +- src/tools/cargo/tests/testsuite/build.rs | 24 +- src/tools/cargo/tests/testsuite/build_script.rs | 7 +- .../tests/testsuite/cargo_add/add_basic/mod.rs | 15 +- .../tests/testsuite/cargo_add/add_multiple/mod.rs | 17 +- .../cargo_add/add_normalized_name_external/mod.rs | 20 +- .../tests/testsuite/cargo_add/add_toolchain/in | 1 + .../tests/testsuite/cargo_add/add_toolchain/mod.rs | 23 + .../cargo_add/add_toolchain/out/Cargo.toml | 5 + .../testsuite/cargo_add/add_toolchain/stderr.log | 2 + .../testsuite/cargo_add/add_toolchain/stdout.log | 0 .../cargo/tests/testsuite/cargo_add/build/mod.rs | 17 +- .../cargo_add/build_prefer_existing_version/mod.rs | 18 +- .../cargo_add/change_rename_target/mod.rs | 17 +- .../testsuite/cargo_add/cyclic_features/mod.rs | 9 +- .../testsuite/cargo_add/default_features/mod.rs | 17 +- .../cargo_add/deprecated_default_features/mod.rs | 15 +- .../testsuite/cargo_add/deprecated_section/mod.rs | 15 +- .../cargo_add/detect_workspace_inherit/mod.rs | 4 +- .../detect_workspace_inherit_features/mod.rs | 4 +- .../detect_workspace_inherit_optional/mod.rs | 4 +- .../cargo/tests/testsuite/cargo_add/dev/mod.rs | 17 +- .../testsuite/cargo_add/dev_build_conflict/mod.rs | 15 +- .../cargo_add/dev_prefer_existing_version/mod.rs | 17 +- .../cargo/tests/testsuite/cargo_add/dry_run/mod.rs | 15 +- .../testsuite/cargo_add/empty_dep_table/mod.rs | 10 +- .../tests/testsuite/cargo_add/features/mod.rs | 10 +- .../testsuite/cargo_add/features_empty/mod.rs | 10 +- .../cargo_add/features_multiple_occurrences/mod.rs | 10 +- .../testsuite/cargo_add/features_preserve/mod.rs | 10 +- .../cargo_add/features_spaced_values/mod.rs | 10 +- .../testsuite/cargo_add/features_unknown/mod.rs | 10 +- .../cargo_add/features_unknown_no_features/mod.rs | 15 +- .../cargo/tests/testsuite/cargo_add/git/mod.rs | 4 +- .../tests/testsuite/cargo_add/git_branch/mod.rs | 4 +- .../cargo_add/git_conflicts_namever/mod.rs | 15 +- .../cargo/tests/testsuite/cargo_add/git_dev/mod.rs | 4 +- .../testsuite/cargo_add/git_inferred_name/mod.rs | 4 +- .../cargo_add/git_inferred_name_multiple/mod.rs | 4 +- .../testsuite/cargo_add/git_multiple_names/mod.rs | 17 +- .../testsuite/cargo_add/git_normalized_name/mod.rs | 4 +- .../tests/testsuite/cargo_add/git_registry/mod.rs | 17 +- .../cargo/tests/testsuite/cargo_add/git_rev/mod.rs | 4 +- .../cargo/tests/testsuite/cargo_add/git_tag/mod.rs | 4 +- .../testsuite/cargo_add/infer_prerelease/mod.rs | 5 +- .../tests/testsuite/cargo_add/invalid_arg/mod.rs | 15 +- .../testsuite/cargo_add/invalid_git_external/in | 1 - .../cargo_add/invalid_git_external/mod.rs | 28 - .../cargo_add/invalid_git_external/out/Cargo.toml | 5 - .../cargo_add/invalid_git_external/stderr.log | 12 - .../cargo_add/invalid_git_external/stdout.log | 0 .../testsuite/cargo_add/invalid_git_name/mod.rs | 4 +- .../testsuite/cargo_add/invalid_manifest/mod.rs | 15 +- .../cargo_add/invalid_name_external/mod.rs | 4 +- .../tests/testsuite/cargo_add/invalid_path/mod.rs | 4 +- .../testsuite/cargo_add/invalid_path_name/mod.rs | 16 +- .../testsuite/cargo_add/invalid_path_self/mod.rs | 4 +- .../cargo_add/invalid_target_empty/mod.rs | 15 +- .../tests/testsuite/cargo_add/invalid_vers/mod.rs | 15 +- .../tests/testsuite/cargo_add/list_features/mod.rs | 10 +- .../testsuite/cargo_add/list_features_path/mod.rs | 21 +- .../cargo_add/list_features_path_no_default/mod.rs | 21 +- .../testsuite/cargo_add/locked_changed/mod.rs | 15 +- .../testsuite/cargo_add/locked_unchanged/mod.rs | 15 +- .../testsuite/cargo_add/lockfile_updated/mod.rs | 17 +- .../cargo_add/manifest_path_package/mod.rs | 16 +- src/tools/cargo/tests/testsuite/cargo_add/mod.rs | 95 +- .../multiple_conflicts_with_features/mod.rs | 21 +- .../multiple_conflicts_with_rename/mod.rs | 17 +- .../cargo/tests/testsuite/cargo_add/namever/mod.rs | 17 +- .../cargo/tests/testsuite/cargo_add/no_args/mod.rs | 4 +- .../testsuite/cargo_add/no_default_features/mod.rs | 17 +- .../tests/testsuite/cargo_add/no_optional/mod.rs | 17 +- .../testsuite/cargo_add/offline_empty_cache/mod.rs | 15 +- .../tests/testsuite/cargo_add/optional/mod.rs | 17 +- .../cargo_add/overwrite_default_features/mod.rs | 17 +- .../mod.rs | 17 +- .../testsuite/cargo_add/overwrite_features/mod.rs | 10 +- .../cargo_add/overwrite_git_with_path/mod.rs | 16 +- .../overwrite_inherit_features_noop/mod.rs | 2 + .../cargo_add/overwrite_inherit_noop/mod.rs | 4 +- .../overwrite_inherit_optional_noop/mod.rs | 4 +- .../cargo_add/overwrite_inline_features/mod.rs | 21 +- .../cargo_add/overwrite_name_dev_noop/mod.rs | 11 +- .../testsuite/cargo_add/overwrite_name_noop/mod.rs | 11 +- .../cargo_add/overwrite_no_default_features/mod.rs | 17 +- .../mod.rs | 17 +- .../cargo_add/overwrite_no_optional/mod.rs | 17 +- .../overwrite_no_optional_with_optional/mod.rs | 17 +- .../testsuite/cargo_add/overwrite_optional/mod.rs | 17 +- .../overwrite_optional_with_no_optional/mod.rs | 21 +- .../testsuite/cargo_add/overwrite_path_noop/mod.rs | 11 +- .../cargo_add/overwrite_path_with_version/mod.rs | 16 +- .../overwrite_preserves_inline_table/mod.rs | 10 +- .../overwrite_rename_with_no_rename/mod.rs | 15 +- .../cargo_add/overwrite_rename_with_rename/mod.rs | 15 +- .../overwrite_rename_with_rename_noop/mod.rs | 15 +- .../cargo_add/overwrite_version_with_git/mod.rs | 15 +- .../cargo_add/overwrite_version_with_path/mod.rs | 16 +- .../cargo_add/overwrite_with_rename/mod.rs | 15 +- .../cargo_add/overwrite_workspace_dep/mod.rs | 4 +- .../overwrite_workspace_dep_features/mod.rs | 4 +- .../cargo/tests/testsuite/cargo_add/path/mod.rs | 16 +- .../tests/testsuite/cargo_add/path_dev/mod.rs | 16 +- .../testsuite/cargo_add/path_inferred_name/mod.rs | 16 +- .../mod.rs | 4 +- .../cargo_add/path_normalized_name/mod.rs | 16 +- .../preserve_features_table/in/Cargo.toml | 21 + .../preserve_features_table/in/src/lib.rs | 0 .../cargo_add/preserve_features_table/mod.rs | 31 + .../preserve_features_table/out/Cargo.toml | 21 + .../cargo_add/preserve_features_table/stderr.log | 7 + .../cargo_add/preserve_features_table/stdout.log | 0 .../testsuite/cargo_add/preserve_sorted/mod.rs | 17 +- .../testsuite/cargo_add/preserve_unsorted/mod.rs | 17 +- .../cargo/tests/testsuite/cargo_add/quiet/mod.rs | 10 +- .../tests/testsuite/cargo_add/registry/mod.rs | 19 +- .../cargo/tests/testsuite/cargo_add/rename/mod.rs | 15 +- .../tests/testsuite/cargo_add/require_weak/mod.rs | 10 +- .../testsuite/cargo_add/rust_version_ignore/mod.rs | 4 +- .../cargo_add/rust_version_incompatible/mod.rs | 4 +- .../testsuite/cargo_add/rust_version_latest/mod.rs | 4 +- .../testsuite/cargo_add/rust_version_older/mod.rs | 4 +- .../cargo_add/sorted_table_with_dotted_item/mod.rs | 22 +- .../cargo/tests/testsuite/cargo_add/target/mod.rs | 17 +- .../tests/testsuite/cargo_add/target_cfg/mod.rs | 17 +- .../cargo/tests/testsuite/cargo_add/vers/mod.rs | 15 +- .../testsuite/cargo_add/workspace_name/mod.rs | 16 +- .../testsuite/cargo_add/workspace_path/mod.rs | 16 +- .../testsuite/cargo_add/workspace_path_dev/mod.rs | 16 +- src/tools/cargo/tests/testsuite/cargo_features.rs | 1 + .../inherit_workspace_lints/in/Cargo.toml | 6 + .../inherit_workspace_lints/in/src/lib.rs | 14 + .../cargo_new/inherit_workspace_lints/mod.rs | 24 + .../inherit_workspace_lints/out/Cargo.toml | 6 + .../out/crates/foo/Cargo.toml | 11 + .../out/crates/foo/src/main.rs | 3 + .../inherit_workspace_lints/out/src/lib.rs | 14 + .../cargo_new/inherit_workspace_lints/stderr.log | 1 + .../cargo_new/inherit_workspace_lints/stdout.log | 0 .../inherit_workspace_package_table.in/Cargo.toml | 1 + .../inherit_workspace_package_table/out/Cargo.toml | 1 + .../out/Cargo.toml | 1 + .../out/Cargo.toml | 1 + src/tools/cargo/tests/testsuite/cargo_new/mod.rs | 1 + .../cargo_remove/avoid_empty_tables/mod.rs | 16 +- .../tests/testsuite/cargo_remove/build/mod.rs | 16 +- .../cargo/tests/testsuite/cargo_remove/dev/mod.rs | 16 +- .../tests/testsuite/cargo_remove/dry_run/mod.rs | 16 +- .../tests/testsuite/cargo_remove/gc_patch/mod.rs | 4 +- .../tests/testsuite/cargo_remove/gc_profile/mod.rs | 17 +- .../tests/testsuite/cargo_remove/gc_replace/mod.rs | 17 +- .../testsuite/cargo_remove/invalid_arg/mod.rs | 16 +- .../testsuite/cargo_remove/invalid_dep/mod.rs | 16 +- .../testsuite/cargo_remove/invalid_package/mod.rs | 18 +- .../cargo_remove/invalid_package_multiple/mod.rs | 18 +- .../testsuite/cargo_remove/invalid_section/mod.rs | 16 +- .../cargo_remove/invalid_section_dep/mod.rs | 16 +- .../testsuite/cargo_remove/invalid_target/mod.rs | 18 +- .../cargo_remove/invalid_target_dep/mod.rs | 18 +- .../cargo/tests/testsuite/cargo_remove/mod.rs | 58 - .../testsuite/cargo_remove/multiple_deps/mod.rs | 16 +- .../testsuite/cargo_remove/multiple_dev/mod.rs | 16 +- .../tests/testsuite/cargo_remove/no_arg/mod.rs | 16 +- .../tests/testsuite/cargo_remove/offline/mod.rs | 16 +- .../cargo_remove/optional_dep_feature/mod.rs | 16 +- .../testsuite/cargo_remove/optional_feature/mod.rs | 16 +- .../tests/testsuite/cargo_remove/package/mod.rs | 18 +- .../testsuite/cargo_remove/remove_basic/mod.rs | 16 +- .../tests/testsuite/cargo_remove/target/mod.rs | 18 +- .../testsuite/cargo_remove/target_build/mod.rs | 18 +- .../tests/testsuite/cargo_remove/target_dev/mod.rs | 18 +- .../testsuite/cargo_remove/update_lock_file/mod.rs | 16 +- .../tests/testsuite/cargo_remove/workspace/mod.rs | 16 +- .../cargo_remove/workspace_non_virtual/mod.rs | 16 +- .../cargo_remove/workspace_preserved/mod.rs | 16 +- src/tools/cargo/tests/testsuite/config.rs | 62 +- src/tools/cargo/tests/testsuite/config_include.rs | 112 +- src/tools/cargo/tests/testsuite/cross_compile.rs | 2 +- src/tools/cargo/tests/testsuite/custom_target.rs | 2 + src/tools/cargo/tests/testsuite/directory.rs | 8 +- src/tools/cargo/tests/testsuite/doc.rs | 98 +- src/tools/cargo/tests/testsuite/features.rs | 99 +- src/tools/cargo/tests/testsuite/features2.rs | 35 + .../tests/testsuite/future_incompat_report.rs | 2 +- src/tools/cargo/tests/testsuite/git.rs | 68 ++ src/tools/cargo/tests/testsuite/install.rs | 26 +- src/tools/cargo/tests/testsuite/lockfile_compat.rs | 78 ++ src/tools/cargo/tests/testsuite/main.rs | 1 + src/tools/cargo/tests/testsuite/profile_config.rs | 13 +- src/tools/cargo/tests/testsuite/profile_targets.rs | 51 +- src/tools/cargo/tests/testsuite/profiles.rs | 52 +- .../cargo/tests/testsuite/required_features.rs | 7 +- src/tools/cargo/tests/testsuite/run.rs | 4 +- src/tools/cargo/tests/testsuite/rustc.rs | 22 +- src/tools/cargo/tests/testsuite/script.rs | 1184 +++++++++++++++++++ src/tools/cargo/tests/testsuite/test.rs | 11 +- src/tools/cargo/triagebot.toml | 16 +- 341 files changed, 10121 insertions(+), 4776 deletions(-) create mode 100644 src/tools/cargo/credential/cargo-credential-1password/README.md create mode 100644 src/tools/cargo/credential/cargo-credential-gnome-secret/README.md create mode 100644 src/tools/cargo/credential/cargo-credential-gnome-secret/src/libsecret.rs create mode 100644 src/tools/cargo/credential/cargo-credential-macos-keychain/README.md create mode 100644 src/tools/cargo/credential/cargo-credential-wincred/README.md delete mode 100644 src/tools/cargo/src/cargo/ops/registry.rs create mode 100644 src/tools/cargo/src/cargo/ops/registry/login.rs create mode 100644 src/tools/cargo/src/cargo/ops/registry/logout.rs create mode 100644 src/tools/cargo/src/cargo/ops/registry/mod.rs create mode 100644 src/tools/cargo/src/cargo/ops/registry/owner.rs create mode 100644 src/tools/cargo/src/cargo/ops/registry/publish.rs create mode 100644 src/tools/cargo/src/cargo/ops/registry/search.rs create mode 100644 src/tools/cargo/src/cargo/ops/registry/yank.rs delete mode 100644 src/tools/cargo/src/cargo/util/auth.rs create mode 100644 src/tools/cargo/src/cargo/util/auth/asymmetric.rs create mode 100644 src/tools/cargo/src/cargo/util/auth/mod.rs create mode 100644 src/tools/cargo/src/cargo/util/network/http.rs create mode 100644 src/tools/cargo/src/cargo/util/toml/embedded.rs delete mode 100644 src/tools/cargo/tests/internal.rs create mode 120000 src/tools/cargo/tests/testsuite/cargo_add/add_toolchain/in create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/add_toolchain/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/add_toolchain/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/add_toolchain/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/add_toolchain/stdout.log delete mode 120000 src/tools/cargo/tests/testsuite/cargo_add/invalid_git_external/in delete mode 100644 src/tools/cargo/tests/testsuite/cargo_add/invalid_git_external/mod.rs delete mode 100644 src/tools/cargo/tests/testsuite/cargo_add/invalid_git_external/out/Cargo.toml delete mode 100644 src/tools/cargo/tests/testsuite/cargo_add/invalid_git_external/stderr.log delete mode 100644 src/tools/cargo/tests/testsuite/cargo_add/invalid_git_external/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/preserve_features_table/in/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/preserve_features_table/in/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/preserve_features_table/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/preserve_features_table/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/preserve_features_table/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_add/preserve_features_table/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/inherit_workspace_lints/in/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/inherit_workspace_lints/in/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/inherit_workspace_lints/mod.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/inherit_workspace_lints/out/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/inherit_workspace_lints/out/crates/foo/Cargo.toml create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/inherit_workspace_lints/out/crates/foo/src/main.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/inherit_workspace_lints/out/src/lib.rs create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/inherit_workspace_lints/stderr.log create mode 100644 src/tools/cargo/tests/testsuite/cargo_new/inherit_workspace_lints/stdout.log create mode 100644 src/tools/cargo/tests/testsuite/script.rs (limited to 'src/tools/cargo') diff --git a/src/tools/cargo/.github/workflows/main.yml b/src/tools/cargo/.github/workflows/main.yml index c522a19a1..3deae6355 100644 --- a/src/tools/cargo/.github/workflows/main.yml +++ b/src/tools/cargo/.github/workflows/main.yml @@ -12,9 +12,6 @@ defaults: permissions: contents: read -env: - CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse - jobs: # Check Code style quickly by running `rustfmt` over all code rustfmt: @@ -108,10 +105,6 @@ jobs: - uses: actions/checkout@v3 - name: Dump Environment run: ci/dump-environment.sh - - name: Update Rustup (temporary workaround) - run: rustup self update - shell: bash - if: startsWith(matrix.os, 'windows') - run: rustup update --no-self-update ${{ matrix.rust }} && rustup default ${{ matrix.rust }} - run: rustup target add ${{ matrix.other }} - run: rustup component add rustc-dev llvm-tools-preview rust-docs @@ -225,6 +218,7 @@ jobs: name: bors build finished needs: - build_std + - clippy - docs - lockfile - resolver @@ -241,6 +235,7 @@ jobs: name: bors build finished needs: - build_std + - clippy - docs - lockfile - resolver diff --git a/src/tools/cargo/CHANGELOG.md b/src/tools/cargo/CHANGELOG.md index 5cb4d11c5..0784b2638 100644 --- a/src/tools/cargo/CHANGELOG.md +++ b/src/tools/cargo/CHANGELOG.md @@ -1,10 +1,104 @@ # Changelog +## Cargo 1.72 (2023-08-24) +[64fb38c9...HEAD](https://github.com/rust-lang/cargo/compare/64fb38c9...HEAD) + +### Added + +- Add support of the "default" keyword to reset previously set `build.jobs` + parallelism back to the default. + [#12222](https://github.com/rust-lang/cargo/pull/12222) + +### Changed + +- Cargo now warns when an edition 2021 package is in a virtual workspace and + `workspace.resolver` is not set. It is recommended to set the resolver + version for workspaces explicitly. + [#10910](https://github.com/rust-lang/cargo/pull/10910) +- Set IBM AIX shared libraries search path to `LIBPATH`. + [#11968](https://github.com/rust-lang/cargo/pull/11968) +- Don't pass `-C debuginfo=0` to rustc as it is the default value. + [#12022](https://github.com/rust-lang/cargo/pull/12022) + [#12205](https://github.com/rust-lang/cargo/pull/12205) +- Added a message on reusing previous temporary path on `cargo install` failures. + [#12231](https://github.com/rust-lang/cargo/pull/12231) +- Added a message when `rustup` override shorthand is put in a wrong position. + [#12226](https://github.com/rust-lang/cargo/pull/12226) + +### Fixed + +- `cargo clean` uses `remove_dir_all` as a fallback to resolve race conditions. + [#11442](https://github.com/rust-lang/cargo/pull/11442) +- Reduced the chance Cargo re-formats the user's `[features]` table. + [#12191](https://github.com/rust-lang/cargo/pull/12191) +- Fixed nested Git submodules not able to fetch. + [#12244](https://github.com/rust-lang/cargo/pull/12244) + +### Nightly only + +- 🔥 The `-Zscript` is an experimental feature to add unstable support for + single-file packages in Cargo, so we can explore the design and resolve + questions with an implementation to collect feedback on. + ([eRFC 3424](https://github.com/rust-lang/rfcs/blob/master/text/3424-cargo-script.md)) + [docs](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#script) + [#12245](https://github.com/rust-lang/cargo/pull/12245) +- Automatically inherit workspace lints when running `cargo new`/`cargo init`. + [#12174](https://github.com/rust-lang/cargo/pull/12174) + +### Documentation + +- Added a description of `Cargo.lock` conflicts in the Cargo FAQ. + [#12185](https://github.com/rust-lang/cargo/pull/12185) +- Added a small note about indexes ignoring SemVer build metadata. + [#12206](https://github.com/rust-lang/cargo/pull/12206) +- Added doc comments for types and friends in `cargo::sources` module. + [#12192](https://github.com/rust-lang/cargo/pull/12192) + [#12239](https://github.com/rust-lang/cargo/pull/12239) + [#12247](https://github.com/rust-lang/cargo/pull/12247) + +### Internal + +- Updated to `gix` 0.45 for multi-round pack negotiations. + [#12236](https://github.com/rust-lang/cargo/pull/12236) +- Updated to `curl-sys` 0.4.63, which corresponds to curl 8.1.2. + [#12218](https://github.com/rust-lang/cargo/pull/12218) +- Removed unused features from `windows-sys` dependency. + [#12176](https://github.com/rust-lang/cargo/pull/12176) +- Refactored compiler invocations + [#12211](https://github.com/rust-lang/cargo/pull/12211) +- Refactored git and registry sources, and registry data. + [#12203](https://github.com/rust-lang/cargo/pull/12203) + [#12197](https://github.com/rust-lang/cargo/pull/12197) + [#12240](https://github.com/rust-lang/cargo/pull/12240) + [#12248](https://github.com/rust-lang/cargo/pull/12248) +- Lexicographically order `-Z` flags. + [#12182](https://github.com/rust-lang/cargo/pull/12182) + [#12223](https://github.com/rust-lang/cargo/pull/12223) + [#12224](https://github.com/rust-lang/cargo/pull/12224) +- Several Cargo's own test infra improvements and speed-ups. + [#12184](https://github.com/rust-lang/cargo/pull/12184) + [#12188](https://github.com/rust-lang/cargo/pull/12188) + [#12189](https://github.com/rust-lang/cargo/pull/12189) + [#12194](https://github.com/rust-lang/cargo/pull/12194) + [#12199](https://github.com/rust-lang/cargo/pull/12199) +- Migrated print-ban from test to clippy + [#12246](https://github.com/rust-lang/cargo/pull/12246) + ## Cargo 1.71 (2023-07-13) -[84b7041f...HEAD](https://github.com/rust-lang/cargo/compare/84b7041f...HEAD) +[84b7041f...rust-1.71.0](https://github.com/rust-lang/cargo/compare/84b7041f...rust-1.71.0) ### Added +- Allowed named debuginfo options in Cargo.toml. + [docs](https://doc.rust-lang.org/nightly/cargo/reference/profiles.html#debug) + [#11958](https://github.com/rust-lang/cargo/pull/11958) +- Added `workspace_default_members` to the output of `cargo metadata`. + [#11978](https://github.com/rust-lang/cargo/pull/11978) +- `cargo add` now considers `rust-version` when selecting packages. + [#12078](https://github.com/rust-lang/cargo/pull/12078) +- Automatically inherit workspace fields when running `cargo new`/`cargo init`. + [#12069](https://github.com/rust-lang/cargo/pull/12069) + ### Changed - ❗ Optimized the usage under `rustup`. When Cargo detects it will run `rustc` @@ -23,39 +117,151 @@ [#12107](https://github.com/rust-lang/cargo/pull/12107) - Better error message when getting an empty dependency table in Cargo.toml. [#11997](https://github.com/rust-lang/cargo/pull/11997) -- Use restricted Damerau-Levenshtein algorithm to provide typo suggestions. - [#11963](https://github.com/rust-lang/cargo/pull/11963) +- Better error message when empty dependency was specified in Cargo.toml. + [#12001](https://github.com/rust-lang/cargo/pull/12001) +- `--help` text is now wrapping for readability on narrow screens. + [#12013](https://github.com/rust-lang/cargo/pull/12013) +- Tweaked the order of arguments in `--help` text to clarify role of `--bin`. + [#12157](https://github.com/rust-lang/cargo/pull/12157) +- `rust-version` is included in `cargo publish` requests to registries. + [#12041](https://github.com/rust-lang/cargo/pull/12041) ### Fixed - Corrected the bug report URL for `cargo clippy --fix`. [#11882](https://github.com/rust-lang/cargo/pull/11882) +- Cargo now applies `[env]` to rust invocations for target info discovery. + [#12029](https://github.com/rust-lang/cargo/pull/12029) +- Fixed tokens not redacted in http debug when using HTTP/2. + [#12095](https://github.com/rust-lang/cargo/pull/12095) +- Fixed `-C debuginfo` not passed in some situation, leading to build cache miss. + [#12165](https://github.com/rust-lang/cargo/pull/12165) +- Fixed the ambiguity when `cargo install` found packages with the same name. + The ambiguity happened in a situation like a package depending on old versions + of itself. + [#12015](https://github.com/rust-lang/cargo/pull/12015) +- Fixed a false positive that `cargo package` checks for conflict files. + [#12135](https://github.com/rust-lang/cargo/pull/12135) +- Fixed `dep/feat` syntax not working when co-exist with `dep:` syntax, and + trying to enable features of an optional dependency. + [#12130](https://github.com/rust-lang/cargo/pull/12130) +- Fixed `cargo tree` not handling the output with `-e no-proc-macro` correctly. + [#12044](https://github.com/rust-lang/cargo/pull/12044) +- Warn instead of error in `cargo package` on empty `readme` or `license-file` + in Cargo.toml. + [#12036](https://github.com/rust-lang/cargo/pull/12036) +- Fixed when an HTTP proxy is in use and the Cargo executable links to a + certain version of system libcurl, CURL connections might fail. Affected + libcurl versions: 7.87.0, 7.88.0, 7.88.1. + [#12234](https://github.com/rust-lang/cargo/pull/12234) + [#12242](https://github.com/rust-lang/cargo/pull/12242) ### Nightly only +- 🔥 The `-Zgitoxide` feature now supports shallow clones and fetches for + dependencies and registry indexes. + [docs](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#gitoxide) + [#11840](https://github.com/rust-lang/cargo/pull/11840) +- 🔥 The `-Zlints` feature enables configuring lints rules in Cargo.toml + [docs](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#lints) + [#12148](https://github.com/rust-lang/cargo/pull/12148) + [#12168](https://github.com/rust-lang/cargo/pull/12168) - The `-Zbuild-std` breakage of missing features in `nightly-2023-05-04` has been fixed in `nightly-2023-05-05`. [#12088](https://github.com/rust-lang/cargo/pull/12088) - Recompile on profile rustflags changes. [#11981](https://github.com/rust-lang/cargo/pull/11981) +- Added `-Zmsrv-policy` feature flag placeholder. + [#12043](https://github.com/rust-lang/cargo/pull/12043) ### Documentation +- Added Cargo team charter. + [docs](https://doc.crates.io/contrib/team.html) + [#12010](https://github.com/rust-lang/cargo/pull/12010) +- SemVer: Adding `#[non_exhaustive]` on existing items is a breaking change. + [#10877](https://github.com/rust-lang/cargo/pull/10877) +- SemVer: It is not a breaking change to make an unsafe function safe. + [#12116](https://github.com/rust-lang/cargo/pull/12116) +- SemVer: changeing MSRV is generally a minor change. + [#12122](https://github.com/rust-lang/cargo/pull/12122) +- Clarify when and how to `cargo yank`. + [#11862](https://github.com/rust-lang/cargo/pull/11862) +- Clarify that crates.io doesn't link to docs.rs right away. + [#12146](https://github.com/rust-lang/cargo/pull/12146) +- Clarify documentation around test target setting. + [#12032](https://github.com/rust-lang/cargo/pull/12032) +- Specify `rust_version` in Index format. + [#12040](https://github.com/rust-lang/cargo/pull/12040) +- Specify `msg` in owner-remove registry API response. + [#12068](https://github.com/rust-lang/cargo/pull/12068) +- Added more documentation for artifact-dependencies. + [#12110](https://github.com/rust-lang/cargo/pull/12110) +- Added doc comments for `Source` and build script for cargo-the-library. + [#12133](https://github.com/rust-lang/cargo/pull/12133) + [#12153](https://github.com/rust-lang/cargo/pull/12153) + [#12159](https://github.com/rust-lang/cargo/pull/12159) +- Several typo and broken link fixes. + [#12018](https://github.com/rust-lang/cargo/pull/12018) + [#12020](https://github.com/rust-lang/cargo/pull/12020) + [#12049](https://github.com/rust-lang/cargo/pull/12049) + [#12067](https://github.com/rust-lang/cargo/pull/12067) + [#12073](https://github.com/rust-lang/cargo/pull/12073) + [#12143](https://github.com/rust-lang/cargo/pull/12143) +- home: clarify the behavior on each platform + [#12047](https://github.com/rust-lang/cargo/pull/12047) + ### Internal -- Cargo is now a Cargo workspace. We dogfood ourselves finally. +- Updated to `linux-raw-sys` 0.3.2 + [#11998](https://github.com/rust-lang/cargo/pull/11998) +- Updated to `git2` 0.17.1, which corresponds to libgit2 1.6.4. + [#12096](https://github.com/rust-lang/cargo/pull/12096) +- Updated to `windows-sys` 0.48.0 + [#12021](https://github.com/rust-lang/cargo/pull/12021) +- Updated to `libc` 0.2.144 + [#12014](https://github.com/rust-lang/cargo/pull/12014) + [#12098](https://github.com/rust-lang/cargo/pull/12098) +- Updated to `openssl-src` 111.25.3+1.1.1t + [#12005](https://github.com/rust-lang/cargo/pull/12005) +- Updated to `home` 0.5.5 + [#12037](https://github.com/rust-lang/cargo/pull/12037) +- Enabled feature `Win32_System_Console` feature since it is used. + [#12016](https://github.com/rust-lang/cargo/pull/12016) +- Cargo is now a Cargo workspace. We dogfood ourselves finally! [#11851](https://github.com/rust-lang/cargo/pull/11851) [#11994](https://github.com/rust-lang/cargo/pull/11994) [#11996](https://github.com/rust-lang/cargo/pull/11996) -- Allow win/mac credential managers to build on all platforms. - [#11993](https://github.com/rust-lang/cargo/pull/11993) -- Use `openssl` only on non-Windows platforms. - [#11979](https://github.com/rust-lang/cargo/pull/11979) -- A new, straightforward issue labels system for Cargo contributors. + [#12024](https://github.com/rust-lang/cargo/pull/12024) + [#12025](https://github.com/rust-lang/cargo/pull/12025) + [#12057](https://github.com/rust-lang/cargo/pull/12057) +- 🔥 A new, straightforward issue labels system for Cargo contributors. [docs](https://doc.crates.io/contrib/issues.html) [#11995](https://github.com/rust-lang/cargo/pull/11995) [#12002](https://github.com/rust-lang/cargo/pull/12002) [#12003](https://github.com/rust-lang/cargo/pull/12003) +- Allow win/mac credential managers to build on all platforms. + [#11993](https://github.com/rust-lang/cargo/pull/11993) + [#12027](https://github.com/rust-lang/cargo/pull/12027) +- Use `openssl` only on non-Windows platforms. + [#11979](https://github.com/rust-lang/cargo/pull/11979) +- Use restricted Damerau-Levenshtein algorithm to provide typo suggestions. + [#11963](https://github.com/rust-lang/cargo/pull/11963) +- Added a new xtask `cargo build-man`. + [#12048](https://github.com/rust-lang/cargo/pull/12048) +- Added a new xtask `cargo stale-label`. + [#12051](https://github.com/rust-lang/cargo/pull/12051) +- Added a new xtask `cargo unpublished`. + [#12039](https://github.com/rust-lang/cargo/pull/12039) + [#12045](https://github.com/rust-lang/cargo/pull/12045) + [#12085](https://github.com/rust-lang/cargo/pull/12085) +- CI: check if any version bump needed for member crates. + [#12126](https://github.com/rust-lang/cargo/pull/12126) +- Fixed some test infra issues. + [#11976](https://github.com/rust-lang/cargo/pull/11976) + [#12026](https://github.com/rust-lang/cargo/pull/12026) + [#12055](https://github.com/rust-lang/cargo/pull/12055) + [#12117](https://github.com/rust-lang/cargo/pull/12117) ## Cargo 1.70 (2023-06-01) [9880b408...rust-1.70.0](https://github.com/rust-lang/cargo/compare/9880b408...rust-1.70.0) @@ -90,7 +296,7 @@ [#11878](https://github.com/rust-lang/cargo/pull/11878) - Added delays to network retries in Cargo. [#11881](https://github.com/rust-lang/cargo/pull/11881) -- Refined `cargo puslish` message when waiting for a publish complete. +- Refined `cargo publish` message when waiting for a publish complete. [#11713](https://github.com/rust-lang/cargo/pull/11713) - Better error message when `cargo install` from a git repository but found multiple packages. @@ -392,7 +598,7 @@ for each revision from the same git repository. [#10690](https://github.com/rust-lang/cargo/pull/1090) - Cargo contributors can relabel issues via triagebot. - [doc](https://github.com/rust-lang/triagebot/wiki/Labeling) + [doc](https://forge.rust-lang.org/triagebot/labeling.html) [#11498](https://github.com/rust-lang/cargo/pull/11498) - Cargo contributors can write tests in containers. [#11583](https://github.com/rust-lang/cargo/pull/11583) diff --git a/src/tools/cargo/Cargo.lock b/src/tools/cargo/Cargo.lock index 14fd1d056..fe365bbcb 100644 --- a/src/tools/cargo/Cargo.lock +++ b/src/tools/cargo/Cargo.lock @@ -29,51 +29,69 @@ dependencies = [ "memchr", ] +[[package]] +name = "aho-corasick" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +dependencies = [ + "memchr", +] + [[package]] name = "anstream" -version = "0.2.6" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" dependencies = [ "anstyle", "anstyle-parse", + "anstyle-query", "anstyle-wincon", - "concolor-override", - "concolor-query", + "colorchoice", "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "0.3.5" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" [[package]] name = "anstyle-parse" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" dependencies = [ "utf8parse", ] +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "anstyle-wincon" -version = "0.2.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "arc-swap" @@ -112,9 +130,9 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "base64ct" @@ -156,9 +174,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.2.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813" +checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded" [[package]] name = "bitmaps" @@ -180,9 +198,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" +checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" dependencies = [ "memchr", "once_cell", @@ -201,9 +219,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byteorder" @@ -244,7 +262,7 @@ dependencies = [ [[package]] name = "cargo" -version = "0.72.1" +version = "0.73.0" dependencies = [ "anyhow", "base64", @@ -253,7 +271,7 @@ dependencies = [ "cargo-test-macro", "cargo-test-support", "cargo-util", - "clap 4.2.1", + "clap 4.3.3", "crates-io", "curl", "curl-sys", @@ -274,10 +292,8 @@ dependencies = [ "ignore", "im-rc", "indexmap", - "is-terminal", "itertools", "jobserver", - "lazy_static", "lazycell", "libc", "libgit2-sys", @@ -289,6 +305,7 @@ dependencies = [ "pasetors", "pathdiff", "pretty_env_logger", + "pulldown-cmark", "rand", "rustfix", "same-file", @@ -301,6 +318,7 @@ dependencies = [ "shell-escape", "snapbox", "strip-ansi-escapes", + "syn 2.0.18", "tar", "tempfile", "termcolor", @@ -399,7 +417,7 @@ dependencies = [ [[package]] name = "cargo-util" -version = "0.2.4" +version = "0.2.5" dependencies = [ "anyhow", "core-foundation", @@ -464,18 +482,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.2.1" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3" +checksum = "ca8f255e4b8027970e78db75e78831229c9815fdbfa67eb1a1b777a62e24b4a0" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.2.1" +version = "4.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f" +checksum = "acd4f3c17c83b0ba34ffbc4f8bbd74f079413f747f84a6f89292f138057e36ab" dependencies = [ "anstream", "anstyle", @@ -487,9 +505,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "clru" @@ -498,19 +516,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8191fa7302e03607ff0e237d4246cc043ff5b3cb9409d995172ba3bea16b807" [[package]] -name = "concolor-override" +name = "colorchoice" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" - -[[package]] -name = "concolor-query" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" -dependencies = [ - "windows-sys 0.45.0", -] +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "const-oid" @@ -545,9 +554,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" +checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" dependencies = [ "libc", ] @@ -632,9 +641,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", @@ -645,18 +654,18 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] [[package]] name = "crypto-bigint" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2538c4e68e52548bacb3e83ac549f903d44f011ac9d5abb5e132e67d0808f7" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" dependencies = [ "generic-array", "rand_core", @@ -676,9 +685,9 @@ dependencies = [ [[package]] name = "csv" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b015497079b9a9d69c02ad25de6c0a6edef051ea6360a327d0bd05802ef64ad" +checksum = "626ae34994d3d8d668f4269922248239db4ae42d538b14c398b74a52208e8086" dependencies = [ "csv-core", "itoa 1.0.6", @@ -728,9 +737,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.61+curl-8.0.1" +version = "0.4.63+curl-8.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79" +checksum = "aeb0fef7046022a1e2ad67a004978f0e3cacb9e3123dc62ce768f92197b771dc" dependencies = [ "cc", "libc", @@ -744,9 +753,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.3" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b10af9f9f9f2134a42d3f8aa74658660f2e0234b0eb81bd171df8aa32779ed" +checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" dependencies = [ "const-oid", "pem-rfc7468", @@ -761,9 +770,9 @@ checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "const-oid", @@ -773,21 +782,22 @@ dependencies = [ [[package]] name = "dunce" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "ecdsa" -version = "0.16.6" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a48e5d537b8a30c0b023116d981b16334be1485af7ca68db3a2b7024cbc957fd" +checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" dependencies = [ "der", "digest", "elliptic-curve", "rfc6979", "signature", + "spki", ] [[package]] @@ -807,9 +817,9 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.13.4" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75c71eaa367f2e5d556414a8eea812bc62985c879748d6403edabd9cb03f16e7" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct", "crypto-bigint", @@ -912,9 +922,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", "libz-sys", @@ -944,9 +954,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -974,9 +984,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "js-sys", @@ -987,9 +997,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.17.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b7905cdfe33d31a88bb2e8419ddd054451f5432d1da9eaf2ac7804ee1ea12d5" +checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044" dependencies = [ "bitflags 1.3.2", "libc", @@ -1014,12 +1024,13 @@ dependencies = [ [[package]] name = "gix" -version = "0.44.1" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf41b61f7df395284f7a579c0fa1a7e012c5aede655174d4e91299ef1cac643" +checksum = "bf2a03ec66ee24d1b2bae3ab718f8d14f141613810cb7ff6756f7db667f1cd82" dependencies = [ "gix-actor", "gix-attributes", + "gix-commitgraph", "gix-config", "gix-credentials", "gix-date", @@ -1034,6 +1045,7 @@ dependencies = [ "gix-index", "gix-lock", "gix-mailmap", + "gix-negotiate", "gix-object", "gix-odb", "gix-pack", @@ -1062,9 +1074,9 @@ dependencies = [ [[package]] name = "gix-actor" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "848efa0f1210cea8638f95691c82a46f98a74b9e3524f01d4955ebc25a8f84f3" +checksum = "9fe73f9f6be1afbf1bd5be919a9636fa560e2f14d42262a934423ed6760cd838" dependencies = [ "bstr", "btoi", @@ -1076,9 +1088,9 @@ dependencies = [ [[package]] name = "gix-attributes" -version = "0.12.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3015baa01ad2122fbcaab7863c857a603eb7b7ec12ac8141207c42c6439805e2" +checksum = "78b79590ac382f80d87e06416f5fcac6fee5d83dcb152a00ed0bdbaa988acc31" dependencies = [ "bstr", "gix-glob", @@ -1093,36 +1105,50 @@ dependencies = [ [[package]] name = "gix-bitmap" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55a95f4942360766c3880bdb2b4b57f1ef73b190fc424755e7fdf480430af618" +checksum = "fc02feb20ad313d52a450852f2005c2205d24f851e74d82b7807cbe12c371667" dependencies = [ "thiserror", ] [[package]] name = "gix-chunk" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0d39583cab06464b8bf73b3f1707458270f0e7383cb24c3c9c1a16e6f792978" +checksum = "a7acf3bc6c4b91e8fb260086daf5e105ea3a6d913f5fd3318137f7e309d6e540" dependencies = [ "thiserror", ] [[package]] name = "gix-command" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2c6f75c1e0f924de39e750880a6e21307194bb1ab773efe3c7d2d787277f8ab" +checksum = "5f6141b70cfb21255223e42f3379855037cbbe8673b58dd8318d2f09b516fad1" dependencies = [ "bstr", ] +[[package]] +name = "gix-commitgraph" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8490ae1b3d55c47e6a71d247c082304a2f79f8d0332c1a2f5693d42a2021a09" +dependencies = [ + "bstr", + "gix-chunk", + "gix-features", + "gix-hash", + "memmap2", + "thiserror", +] + [[package]] name = "gix-config" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d252a0eddb6df74600d3d8872dc9fe98835a7da43110411d705b682f49d4ac1" +checksum = "51f310120ae1ba8f0ca52fb22876ce9bad5b15c8ffb3eb7302e4b64a3b9f681c" dependencies = [ "bstr", "gix-config-value", @@ -1142,11 +1168,11 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786861e84a5793ad5f863d846de5eb064cd23b87e61ad708c8c402608202e7be" +checksum = "6f216df1c33e6e1555923eff0096858a879e8aaadd35b5d788641e4e8064c892" dependencies = [ - "bitflags 2.2.1", + "bitflags 2.3.2", "bstr", "gix-path", "libc", @@ -1155,9 +1181,9 @@ dependencies = [ [[package]] name = "gix-credentials" -version = "0.14.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4874a4fc11ffa844a3c2b87a66957bda30a73b577ef1acf15ac34df5745de5ff" +checksum = "c6f89fea8acd28f5ef8fa5042146f1637afd4d834bc8f13439d8fd1e5aca0d65" dependencies = [ "bstr", "gix-command", @@ -1171,9 +1197,9 @@ dependencies = [ [[package]] name = "gix-date" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99056f37270715f5c7584fd8b46899a2296af9cae92463bf58b8bd1f5a78e553" +checksum = "bc164145670e9130a60a21670d9b6f0f4f8de04e5dd256c51fa5a0340c625902" dependencies = [ "bstr", "itoa 1.0.6", @@ -1183,9 +1209,9 @@ dependencies = [ [[package]] name = "gix-diff" -version = "0.29.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644a0f2768bc42d7a69289ada80c9e15c589caefc6a315d2307202df83ed1186" +checksum = "9029ad0083cc286a4bd2f5b3bf66bb66398abc26f2731a2824cd5edfc41a0e33" dependencies = [ "gix-hash", "gix-object", @@ -1195,9 +1221,9 @@ dependencies = [ [[package]] name = "gix-discover" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5012710ebdecf6193c6866d6409a3b702a4aa0d78c605bc343590b44ab9962a1" +checksum = "aba9c6c0d1f2b2efe65581de73de4305004612d49c83773e783202a7ef204f46" dependencies = [ "bstr", "dunce", @@ -1210,9 +1236,9 @@ dependencies = [ [[package]] name = "gix-features" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf69b0f5c701cc3ae22d3204b671907668f6437ca88862d355eaf9bc47a4f897" +checksum = "3a8c493409bf6060d408eec9bbdd1b12ea351266b50012e2a522f75dfc7b8314" dependencies = [ "bytes", "crc32fast", @@ -1230,20 +1256,20 @@ dependencies = [ [[package]] name = "gix-fs" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b37a1832f691fdc09910bd267f9a2e413737c1f9ec68c6e31f9e802616278a9" +checksum = "30da8997008adb87f94e15beb7ee229f8a48e97af585a584bfee4a5a1880aab5" dependencies = [ "gix-features", ] [[package]] name = "gix-glob" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c07c98204529ac3f24b34754540a852593d2a4c7349008df389240266627a72a" +checksum = "cd0ade1e80ab1f079703d1824e1daf73009096386aa7fd2f0477f6e4ac0a558e" dependencies = [ - "bitflags 2.2.1", + "bitflags 2.3.2", "bstr", "gix-features", "gix-path", @@ -1251,9 +1277,9 @@ dependencies = [ [[package]] name = "gix-hash" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078eec3ac2808cc03f0bddd2704cb661da5c5dc33b41a9d7947b141d499c7c42" +checksum = "ee181c85d3955f54c4426e6bfaeeada4428692e1a39b8788c2ac7785fc301dd8" dependencies = [ "hex", "thiserror", @@ -1261,9 +1287,9 @@ dependencies = [ [[package]] name = "gix-hashtable" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afebb85691c6a085b114e01a27f4a61364519298c5826cb87a45c304802299bc" +checksum = "bd259bd0d96e6153e357a8cdaca76c48e103fd34208b6c0ce77b1ad995834bd2" dependencies = [ "gix-hash", "hashbrown 0.13.2", @@ -1272,9 +1298,9 @@ dependencies = [ [[package]] name = "gix-ignore" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba205b6df563e2906768bb22834c82eb46c5fdfcd86ba2c347270bc8309a05b2" +checksum = "fc6f7f101a0ccce808dbf7008ba131dede94e20257e7bde7a44cbb2f8c775625" dependencies = [ "bstr", "gix-glob", @@ -1284,11 +1310,11 @@ dependencies = [ [[package]] name = "gix-index" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa282756760f79c401d4f4f42588fbb4aa27bbb4b0830f3b4d3480c21a4ac5a7" +checksum = "616ba958fabfb11263fa042c35690d48a6c7be4e9277e2c7e24ff263b3fe7b82" dependencies = [ - "bitflags 2.2.1", + "bitflags 2.3.2", "bstr", "btoi", "filetime", @@ -1306,31 +1332,46 @@ dependencies = [ [[package]] name = "gix-lock" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b80172055c5d8017a48ddac5cc7a95421c00211047db0165c97853c4f05194" +checksum = "3ec5d5e6f07316d3553aa7425e3ecd935ec29882556021fe1696297a448af8d2" dependencies = [ - "fastrand", "gix-tempfile", + "gix-utils", "thiserror", ] [[package]] name = "gix-mailmap" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8856cec3bdc3610c06970d28b6cb20a0c6621621cf9a8ec48cbd23f2630f362" +checksum = "4653701922c920e009f1bc4309feaff14882ade017770788f9a150928da3fa6a" dependencies = [ "bstr", "gix-actor", "thiserror", ] +[[package]] +name = "gix-negotiate" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "945c3ef1e912e44a5f405fc9e924edf42000566a1b257ed52cb1293300f6f08c" +dependencies = [ + "bitflags 2.3.2", + "gix-commitgraph", + "gix-hash", + "gix-object", + "gix-revision", + "smallvec", + "thiserror", +] + [[package]] name = "gix-object" -version = "0.29.1" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9bb30ce0818d37096daa29efe361a4bc6dd0b51a5726598898be7e9a40a01e1" +checksum = "8926c8f51c44dec3e709cb5dbc93deb9e8d4064c43c9efc54c158dcdfe8446c7" dependencies = [ "bstr", "btoi", @@ -1347,9 +1388,9 @@ dependencies = [ [[package]] name = "gix-odb" -version = "0.45.0" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2f324aa67672b6d0f2c0fa93f96eb6a7029d260e4c1df5dce3c015f5e5add" +checksum = "4b234d806278eeac2f907c8b5a105c4ba537230c1a9d9236d822bf0db291f8f3" dependencies = [ "arc-swap", "gix-features", @@ -1365,9 +1406,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.35.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164a515900a83257ae4aa80e741655bee7a2e39113fb535d7a5ac623b445ff20" +checksum = "7d2a14cb3156037eedb17d6cb7209b7180522b8949b21fd0fe3184c0a1d0af88" dependencies = [ "clru", "gix-chunk", @@ -1387,9 +1428,9 @@ dependencies = [ [[package]] name = "gix-packetline" -version = "0.16.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f53abaf1171d2fe99f80ac8ed6645904a1bfd706674749ac112bdd2d4f0777" +checksum = "74414f89a6b72fa1a530ce8e646faf1a05499c3f4a5c15441d17ae8c978578eb" dependencies = [ "bstr", "hex", @@ -1398,9 +1439,9 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc78f47095a0c15aea0e66103838f0748f4494bf7a9555dfe0f00425400396c" +checksum = "c1226f2e50adeb4d76c754c1856c06f13a24cad1624801653fbf09b869e5b808" dependencies = [ "bstr", "home 0.5.5", @@ -1410,9 +1451,9 @@ dependencies = [ [[package]] name = "gix-prompt" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "330d11fdf88fff3366c2491efde2f3e454958efe7d5ddf60272e8fb1d944bb01" +checksum = "e15fe57fa48572b7d3bf465d6a2a0351cd3c55cba74fd5f0b9c23689f9c1a31e" dependencies = [ "gix-command", "gix-config-value", @@ -1423,9 +1464,9 @@ dependencies = [ [[package]] name = "gix-protocol" -version = "0.32.0" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e49417f1730f4dbc2f7d9a2ab0f8b2f49ef08f97270691403ecde3d961e3a" +checksum = "92a17058b45c461f0847528c5fb6ee6e76115e026979eb2d2202f98ee94f6c24" dependencies = [ "bstr", "btoi", @@ -1440,9 +1481,9 @@ dependencies = [ [[package]] name = "gix-quote" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a282f5a8d9ee0b09ec47390ac727350c48f2f5c76d803cd8da6b3e7ad56e0bcb" +checksum = "29d59489bff95b06dcdabe763b7266d3dc0a628cac1ac1caf65a7ca0a43eeae0" dependencies = [ "bstr", "btoi", @@ -1451,9 +1492,9 @@ dependencies = [ [[package]] name = "gix-ref" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8212ecfe41815a2f1b059d82171d6276758cfac5506a5e0f04ad45ef0b1924a" +checksum = "ebdd999256f4ce8a5eefa89999879c159c263f3493a951d62aa5ce42c0397e1c" dependencies = [ "gix-actor", "gix-features", @@ -1471,9 +1512,9 @@ dependencies = [ [[package]] name = "gix-refspec" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6ea733820df67e4cd7797deb12727905824d8f5b7c59d943c456d314475892" +checksum = "72bfd622abc86dd8ad1ec51b9eb77b4f1a766b94e3a1b87cf4a022c5b5570cf4" dependencies = [ "bstr", "gix-hash", @@ -1485,25 +1526,40 @@ dependencies = [ [[package]] name = "gix-revision" -version = "0.13.0" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "810f35e9afeccca999d5d348b239f9c162353127d2e13ff3240e31b919e35476" +checksum = "5044f56cd7a487ce9b034cbe0252ae0b6b47ff56ca3dabd79bc30214d0932cd7" dependencies = [ "bstr", "gix-date", "gix-hash", "gix-hashtable", "gix-object", + "gix-revwalk", + "thiserror", +] + +[[package]] +name = "gix-revwalk" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc2623ba8747914f151f5e12b65adac576ab459dbed5f50a36c7a3e9cbf2d3ca" +dependencies = [ + "gix-commitgraph", + "gix-hash", + "gix-hashtable", + "gix-object", + "smallvec", "thiserror", ] [[package]] name = "gix-sec" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794520043d5a024dfeac335c6e520cb616f6963e30dab995892382e998c12897" +checksum = "b2b7b38b766eb95dcc5350a9c450030b69892c0902fa35f4a6d0809273bd9dae" dependencies = [ - "bitflags 2.2.1", + "bitflags 2.3.2", "gix-path", "libc", "windows", @@ -1511,10 +1567,11 @@ dependencies = [ [[package]] name = "gix-tempfile" -version = "5.0.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ceb30a610e3f5f2d5f9a5114689fde507ba9417705a8cf3429604275b2153c" +checksum = "b3785cb010e9dc5c446dfbf02bc1119fc17d3a48a27c029efcb3a3c32953eb10" dependencies = [ + "gix-fs", "libc", "once_cell", "parking_lot", @@ -1525,9 +1582,9 @@ dependencies = [ [[package]] name = "gix-transport" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f01c2bf7b989c679695ef635fc7d9e80072e08101be4b53193c8e8b649900102" +checksum = "64a39ffed9a9078ed700605e064b15d7c6ae50aa65e7faa36ca6919e8081df15" dependencies = [ "base64", "bstr", @@ -1544,9 +1601,9 @@ dependencies = [ [[package]] name = "gix-traverse" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5be1e807f288c33bb005075111886cceb43ed8a167b3182a0f62c186e2a0dd1" +checksum = "b0842e984cb4bf26339dc559f3a1b8bf8cdb83547799b2b096822a59f87f33d9" dependencies = [ "gix-hash", "gix-hashtable", @@ -1556,9 +1613,9 @@ dependencies = [ [[package]] name = "gix-url" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc77f89054297cc81491e31f1bab4027e554b5ef742a44bd7035db9a0f78b76" +checksum = "f1663df25ac42047a2547618d2a6979a26f478073f6306997429235d2cd4c863" dependencies = [ "bstr", "gix-features", @@ -1570,18 +1627,18 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c10b69beac219acb8df673187a1f07dde2d74092f974fb3f9eb385aeb667c909" +checksum = "dbcfcb150c7ef553d76988467d223254045bdcad0dc6724890f32fbe96415da5" dependencies = [ "fastrand", ] [[package]] name = "gix-validate" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd629d3680773e1785e585d76fd4295b740b559cad9141517300d99a0c8c049" +checksum = "57ea5845b506c7728b9d89f4227cc369a5fc5a1d5b26c3add0f0d323413a3a60" dependencies = [ "bstr", "thiserror", @@ -1589,9 +1646,9 @@ dependencies = [ [[package]] name = "gix-worktree" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10bf56a1f5037d84293ea6cece61d9f27c4866b1e13c1c95f37cf56b7da7af25" +checksum = "d388ad962e8854402734a7387af8790f6bdbc8d05349052dab16ca4a0def50f6" dependencies = [ "bstr", "filetime", @@ -1620,7 +1677,7 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" dependencies = [ - "aho-corasick", + "aho-corasick 0.7.20", "bstr", "fnv", "log", @@ -1761,9 +1818,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1841,9 +1898,9 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", @@ -1894,9 +1951,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1930,15 +1987,15 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libgit2-sys" -version = "0.15.1+1.6.4" +version = "0.15.2+1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb4577bde8cdfc7d6a2a4bcb7b049598597de33ffd337276e9c7db6cd4a2cee7" +checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa" dependencies = [ "cc", "libc", @@ -1950,9 +2007,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libnghttp2-sys" @@ -1980,9 +2037,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" dependencies = [ "cc", "libc", @@ -1992,15 +2049,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.4" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36eb31c1778188ae1e64398743890d0877fef36d11521ac60406b42016e8c2cf" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -2008,12 +2065,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "maybe-async" @@ -2056,9 +2110,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -2071,9 +2125,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] @@ -2134,9 +2188,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "oorandom" @@ -2156,9 +2210,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.50" +version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ "bitflags 1.3.2", "cfg-if", @@ -2177,7 +2231,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.18", ] [[package]] @@ -2188,18 +2242,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.25.3+1.1.1t" +version = "111.26.0+1.1.1u" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924757a6a226bf60da5f7dd0311a34d2b52283dd82ddeb103208ddc66362f80c" +checksum = "efc62c9f12b22b8f5208c23a7200a442b2e5999f8bdf80233852122b5a4f6f37" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.85" +version = "0.9.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d3d193fb1488ad46ffe3aaabc912cc931d02ee8518fe2959aea8ef52718b0c0" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" dependencies = [ "cc", "libc", @@ -2272,15 +2326,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets", ] [[package]] @@ -2305,9 +2359,9 @@ dependencies = [ [[package]] name = "pasetors" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824bf633b85dc1dece2eb07161627ba5d90a951597cd5dbf8d85f4d82b7aea69" +checksum = "ba765699a309908d55950919a3445e9491453e89b2587b1b2abe4143a48894c0" dependencies = [ "ct-codecs", "ed25519-compact", @@ -2341,15 +2395,15 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.5.7" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1403e8401ad5dedea73c626b99758535b342502f8d1e361f4a2dd952749122" +checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70" dependencies = [ "thiserror", "ucd-trie", @@ -2357,9 +2411,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.7" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be99c4c1d2fc2769b1d00239431d711d08f6efedcecb8b6e30707160aee99c15" +checksum = "6b79d4c71c865a25a4322296122e3924d30bc8ee0834c8bfc8b95f7f054afbfb" dependencies = [ "pest", "pest_generator", @@ -2367,22 +2421,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.7" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e56094789873daa36164de2e822b3888c6ae4b4f9da555a1103587658c805b1e" +checksum = "6c435bf1076437b851ebc8edc3a18442796b30f1728ffea6262d59bbe28b077e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.18", ] [[package]] name = "pest_meta" -version = "2.5.7" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6733073c7cff3d8459fda0e42f13a047870242aed8b509fe98000928975f359e" +checksum = "745a452f8eb71e39ffd8ee32b3c5f51d03845f99786fa9b68db6ff509c505411" dependencies = [ "once_cell", "pest", @@ -2401,9 +2455,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "plotters" @@ -2463,47 +2517,46 @@ dependencies = [ [[package]] name = "primeorder" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf8d3875361e28f7753baefef104386e7aa47642c93023356d97fdef4003bfb5" +checksum = "3c2fcef82c0ec6eefcc179b978446c399b3cdf73c392c35604e399eee6df1ee3" dependencies = [ "elliptic-curve", ] [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "prodash" -version = "23.1.2" +version = "25.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9516b775656bc3e8985e19cd4b8c0c0de045095074e453d2c0a513b5f978392d" +checksum = "3236ce1618b6da4c7b618e0143c4d5b5dc190f75f81c49f248221382f7e9e9ae" dependencies = [ "parking_lot", ] [[package]] name = "proptest" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70" +checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", "bitflags 1.3.2", "byteorder", "lazy_static", "num-traits", - "quick-error 2.0.1", "rand", "rand_chacha", "rand_xorshift", - "regex-syntax", + "regex-syntax 0.6.29", "rusty-fork", "tempfile", "unarray", @@ -2511,9 +2564,9 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" +checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" dependencies = [ "bitflags 1.3.2", "memchr", @@ -2534,9 +2587,9 @@ checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -2631,13 +2684,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.3" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ - "aho-corasick", + "aho-corasick 1.0.2", "memchr", - "regex-syntax", + "regex-syntax 0.7.2", ] [[package]] @@ -2652,13 +2705,18 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +[[package]] +name = "regex-syntax" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" + [[package]] name = "resolver-tests" version = "0.0.0" dependencies = [ "cargo", "cargo-util", - "is-terminal", "lazy_static", "proptest", "varisat", @@ -2694,9 +2752,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.15" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0661814f891c57c930a610266415528da53c4933e6dea5fb350cbfe048a9ece" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags 1.3.2", "errno", @@ -2764,9 +2822,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.8.2" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -2777,9 +2835,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" dependencies = [ "core-foundation-sys", "libc", @@ -2803,9 +2861,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] @@ -2832,13 +2890,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.18", ] [[package]] @@ -2852,9 +2910,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.95" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa 1.0.6", "ryu", @@ -2863,9 +2921,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" dependencies = [ "serde", ] @@ -2957,9 +3015,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snapbox" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9615402f9cff539301119bdf2c2f328739cf2b45c2116666618fb6ac399f75bb" +checksum = "f6bccd62078347f89a914e3004d94582e13824d4e3d8a816317862884c423835" dependencies = [ "anstream", "anstyle", @@ -2975,9 +3033,9 @@ dependencies = [ [[package]] name = "snapbox-macros" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8e40c667388ed1cb5060f545d0013bf0a23efdfa6c5c3e9ef592de391cd860f" +checksum = "eaaf09df9f0eeae82be96290918520214530e738a7fe5a351b0f24cf77c0ca31" dependencies = [ "anstream", ] @@ -2994,9 +3052,9 @@ dependencies = [ [[package]] name = "spki" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a5be806ab6f127c3da44b7378837ebf01dadca8510a0e572460216b228bd0e" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", @@ -3025,9 +3083,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" @@ -3042,9 +3100,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.14" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf316d5356ed6847742d036f8a39c3b8435cac10bd528a4bd461928a6ab34d5" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -3075,15 +3133,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -3131,7 +3190,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.14", + "syn 2.0.18", ] [[package]] @@ -3146,9 +3205,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.20" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ "itoa 1.0.6", "libc", @@ -3160,15 +3219,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" dependencies = [ "time-core", ] @@ -3200,9 +3259,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "toml" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" dependencies = [ "serde", "serde_spanned", @@ -3212,18 +3271,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.8" +version = "0.19.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" dependencies = [ "indexmap", "serde", @@ -3273,9 +3332,9 @@ checksum = "98e90c70c9f0d4d1ee6d0a7d04aa06cb9bbd53d8cfbdd62a0269a7c2eb640552" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -3300,9 +3359,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -3462,9 +3521,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3472,24 +3531,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3497,28 +3556,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -3561,7 +3620,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets", ] [[package]] @@ -3579,37 +3638,13 @@ dependencies = [ "windows_x86_64_msvc 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -3713,9 +3748,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.1" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" dependencies = [ "memchr", ] @@ -3737,7 +3772,7 @@ version = "0.0.0" dependencies = [ "anyhow", "cargo", - "clap 4.2.1", + "clap 4.3.3", "env_logger 0.10.0", "log", ] diff --git a/src/tools/cargo/Cargo.toml b/src/tools/cargo/Cargo.toml index 05c95c727..7e383be69 100644 --- a/src/tools/cargo/Cargo.toml +++ b/src/tools/cargo/Cargo.toml @@ -19,22 +19,22 @@ cargo-credential = { version = "0.2.0", path = "credential/cargo-credential" } cargo-platform = { path = "crates/cargo-platform", version = "0.1.3" } cargo-test-macro = { path = "crates/cargo-test-macro" } cargo-test-support = { path = "crates/cargo-test-support" } -cargo-util = { version = "0.2.4", path = "crates/cargo-util" } +cargo-util = { version = "0.2.5", path = "crates/cargo-util" } cargo_metadata = "0.14.0" clap = "4.2.0" core-foundation = { version = "0.9.0", features = ["mac_os_10_7_support"] } crates-io = { version = "0.37.0", path = "crates/crates-io" } criterion = { version = "0.3.5", features = ["html_reports"] } curl = "0.4.44" -curl-sys = "0.4.61" +curl-sys = "0.4.63" env_logger = "0.10.0" filetime = "0.2.9" flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] } fwdansi = "1.1.0" git2 = "0.17.1" git2-curl = "0.18.0" -gix = { version = "0.44.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] } -gix-features-for-configuration-only = { version = "0.29.0", package = "gix-features", features = [ "parallel" ] } +gix = { version = "0.45.1", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] } +gix-features-for-configuration-only = { version = "0.30.0", package = "gix-features", features = [ "parallel" ] } glob = "0.3.0" handlebars = { version = "3.2.1", features = ["dir_source"] } hex = "0.4.2" @@ -45,7 +45,6 @@ humantime = "2.0.0" ignore = "0.4.7" im-rc = "15.0.0" indexmap = "1" -is-terminal = "0.4.4" itertools = "0.10.0" jobserver = "0.1.26" lazy_static = "1.3.0" @@ -56,7 +55,7 @@ log = "0.4.17" memchr = "2.1.3" miow = "0.5.0" opener = "0.5" -openssl ="0.10.50" +openssl ="0.10.55" os_info = "3.5.0" pasetors = { version = "0.6.4", features = ["v3", "paserk", "std", "serde"] } pathdiff = "0.2" @@ -80,6 +79,7 @@ sha2 = "0.10.6" shell-escape = "0.1.4" snapbox = { version = "0.4.0", features = ["diff", "path"] } strip-ansi-escapes = "0.1.0" +syn = { version = "2.0.14", features = ["extra-traits", "full"] } tar = { version = "0.4.39", default-features = false } tempfile = "3.1.0" termcolor = "1.1.2" @@ -95,7 +95,7 @@ windows-sys = "0.48" [package] name = "cargo" -version = "0.72.1" +version = "0.73.0" edition = "2021" license = "MIT OR Apache-2.0" homepage = "https://crates.io" @@ -136,10 +136,8 @@ humantime.workspace = true ignore.workspace = true im-rc.workspace = true indexmap.workspace = true -is-terminal.workspace = true itertools.workspace = true jobserver.workspace = true -lazy_static.workspace = true lazycell.workspace = true libc.workspace = true libgit2-sys.workspace = true @@ -150,6 +148,7 @@ os_info.workspace = true pasetors.workspace = true pathdiff.workspace = true pretty_env_logger = { workspace = true, optional = true } +pulldown-cmark.workspace = true rand.workspace = true rustfix.workspace = true semver.workspace = true @@ -160,6 +159,7 @@ serde_json = { workspace = true, features = ["raw_value"] } sha1.workspace = true shell-escape.workspace = true strip-ansi-escapes.workspace = true +syn.workspace = true tar.workspace = true tempfile.workspace = true termcolor.workspace = true @@ -183,11 +183,8 @@ features = [ "Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_Console", - "Win32_System_IO", "Win32_System_Threading", "Win32_System_JobObjects", - "Win32_Security", - "Win32_System_SystemServices" ] [dev-dependencies] diff --git a/src/tools/cargo/README.md b/src/tools/cargo/README.md index 423555e62..1d806b978 100644 --- a/src/tools/cargo/README.md +++ b/src/tools/cargo/README.md @@ -13,7 +13,7 @@ Cargo downloads your Rust project’s dependencies and compiles your project. [![CI](https://github.com/rust-lang/cargo/actions/workflows/main.yml/badge.svg?branch=auto-cargo)](https://github.com/rust-lang/cargo/actions/workflows/main.yml) -Code documentation: https://docs.rs/cargo/ +Code documentation: ## Installing Cargo diff --git a/src/tools/cargo/clippy.toml b/src/tools/cargo/clippy.toml index 4f9be8f9b..050cc8716 100644 --- a/src/tools/cargo/clippy.toml +++ b/src/tools/cargo/clippy.toml @@ -1,3 +1,5 @@ +allow-print-in-tests = true +allow-dbg-in-tests = true disallowed-methods = [ { path = "std::env::var", reason = "Use `Config::get_env` instead. See rust-lang/cargo#11588" }, { path = "std::env::var_os", reason = "Use `Config::get_env_os` instead. See rust-lang/cargo#11588" }, diff --git a/src/tools/cargo/crates/cargo-test-support/src/containers.rs b/src/tools/cargo/crates/cargo-test-support/src/containers.rs index 17040d82a..22fd5fd85 100644 --- a/src/tools/cargo/crates/cargo-test-support/src/containers.rs +++ b/src/tools/cargo/crates/cargo-test-support/src/containers.rs @@ -94,7 +94,9 @@ impl Container { let image_base = self.build_context.file_name().unwrap(); let image_name = format!("cargo-test-{}", image_base.to_str().unwrap()); - let _lock = BUILD_LOCK.lock().unwrap(); + let _lock = BUILD_LOCK + .lock() + .map_err(|_| panic!("previous docker build failed, unable to run test")); ProcessBuilder::new("docker") .args(&["build", "--tag", image_name.as_str()]) .arg(&self.build_context) diff --git a/src/tools/cargo/crates/cargo-test-support/src/lib.rs b/src/tools/cargo/crates/cargo-test-support/src/lib.rs index d27aab44f..a2fa54c60 100644 --- a/src/tools/cargo/crates/cargo-test-support/src/lib.rs +++ b/src/tools/cargo/crates/cargo-test-support/src/lib.rs @@ -110,7 +110,9 @@ impl FileBuilder { fn mk(&mut self) { if self.executable { - self.path.set_extension(env::consts::EXE_EXTENSION); + let mut path = self.path.clone().into_os_string(); + write!(path, "{}", env::consts::EXE_SUFFIX).unwrap(); + self.path = path.into(); } self.dirname().mkdir_p(); @@ -1259,6 +1261,8 @@ pub trait TestEnv: Sized { .env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "stable") // Keeps cargo within its sandbox. .env("__CARGO_TEST_DISABLE_GLOBAL_KNOWN_HOST", "1") + // Set retry sleep to 1 millisecond. + .env("__CARGO_TEST_FIXED_RETRY_SLEEP_MS", "1") // Incremental generates a huge amount of data per test, which we // don't particularly need. Tests that specifically need to check // the incremental behavior should turn this back on. diff --git a/src/tools/cargo/crates/cargo-test-support/src/paths.rs b/src/tools/cargo/crates/cargo-test-support/src/paths.rs index ef1fddb70..50040e1d4 100644 --- a/src/tools/cargo/crates/cargo-test-support/src/paths.rs +++ b/src/tools/cargo/crates/cargo-test-support/src/paths.rs @@ -1,7 +1,6 @@ use filetime::{self, FileTime}; -use lazy_static::lazy_static; + use std::cell::RefCell; -use std::collections::HashMap; use std::env; use std::fs; use std::io::{self, ErrorKind}; @@ -9,15 +8,11 @@ use std::path::{Path, PathBuf}; use std::process::Command; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Mutex; +use std::sync::OnceLock; static CARGO_INTEGRATION_TEST_DIR: &str = "cit"; -lazy_static! { - // TODO: Use `SyncOnceCell` when stable - static ref GLOBAL_ROOT: Mutex> = Mutex::new(None); - - static ref TEST_ROOTS: Mutex> = Default::default(); -} +static GLOBAL_ROOT: OnceLock>> = OnceLock::new(); /// This is used when running cargo is pre-CARGO_TARGET_TMPDIR /// TODO: Remove when CARGO_TARGET_TMPDIR grows old enough. @@ -31,7 +26,10 @@ fn global_root_legacy() -> PathBuf { } fn set_global_root(tmp_dir: Option<&'static str>) { - let mut lock = GLOBAL_ROOT.lock().unwrap(); + let mut lock = GLOBAL_ROOT + .get_or_init(|| Default::default()) + .lock() + .unwrap(); if lock.is_none() { let mut root = match tmp_dir { Some(tmp_dir) => PathBuf::from(tmp_dir), @@ -44,7 +42,10 @@ fn set_global_root(tmp_dir: Option<&'static str>) { } pub fn global_root() -> PathBuf { - let lock = GLOBAL_ROOT.lock().unwrap(); + let lock = GLOBAL_ROOT + .get_or_init(|| Default::default()) + .lock() + .unwrap(); match lock.as_ref() { Some(p) => p.clone(), None => unreachable!("GLOBAL_ROOT not set yet"), diff --git a/src/tools/cargo/crates/cargo-test-support/src/registry.rs b/src/tools/cargo/crates/cargo-test-support/src/registry.rs index 0cf82cb70..910f95bfa 100644 --- a/src/tools/cargo/crates/cargo-test-support/src/registry.rs +++ b/src/tools/cargo/crates/cargo-test-support/src/registry.rs @@ -1342,7 +1342,7 @@ impl Package { /// Sets the index schema version for this package. /// - /// See `cargo::sources::registry::RegistryPackage` for more information. + /// See `cargo::sources::registry::IndexPackage` for more information. pub fn schema_version(&mut self, version: u32) -> &mut Package { self.v = Some(version); self diff --git a/src/tools/cargo/crates/cargo-test-support/src/tools.rs b/src/tools/cargo/crates/cargo-test-support/src/tools.rs index 7c056b6fa..2ce2849ae 100644 --- a/src/tools/cargo/crates/cargo-test-support/src/tools.rs +++ b/src/tools/cargo/crates/cargo-test-support/src/tools.rs @@ -1,20 +1,21 @@ //! Common executables that can be reused by various tests. use crate::{basic_manifest, paths, project, Project}; -use lazy_static::lazy_static; use std::path::{Path, PathBuf}; use std::sync::Mutex; +use std::sync::OnceLock; -lazy_static! { - static ref ECHO_WRAPPER: Mutex> = Mutex::new(None); - static ref ECHO: Mutex> = Mutex::new(None); -} +static ECHO_WRAPPER: OnceLock>> = OnceLock::new(); +static ECHO: OnceLock>> = OnceLock::new(); /// Returns the path to an executable that works as a wrapper around rustc. /// /// The wrapper will echo the command line it was called with to stderr. pub fn echo_wrapper() -> PathBuf { - let mut lock = ECHO_WRAPPER.lock().unwrap(); + let mut lock = ECHO_WRAPPER + .get_or_init(|| Default::default()) + .lock() + .unwrap(); if let Some(path) = &*lock { return path.clone(); } @@ -53,7 +54,7 @@ pub fn echo_wrapper() -> PathBuf { /// /// Do not expect this to be anything fancy. pub fn echo() -> PathBuf { - let mut lock = ECHO.lock().unwrap(); + let mut lock = ECHO.get_or_init(|| Default::default()).lock().unwrap(); if let Some(path) = &*lock { return path.clone(); } diff --git a/src/tools/cargo/crates/cargo-util/Cargo.toml b/src/tools/cargo/crates/cargo-util/Cargo.toml index f01705fca..614581037 100644 --- a/src/tools/cargo/crates/cargo-util/Cargo.toml +++ b/src/tools/cargo/crates/cargo-util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-util" -version = "0.2.4" +version = "0.2.5" edition = "2021" license = "MIT OR Apache-2.0" homepage = "https://github.com/rust-lang/cargo" diff --git a/src/tools/cargo/crates/cargo-util/src/paths.rs b/src/tools/cargo/crates/cargo-util/src/paths.rs index 69df7a209..4a917821b 100644 --- a/src/tools/cargo/crates/cargo-util/src/paths.rs +++ b/src/tools/cargo/crates/cargo-util/src/paths.rs @@ -55,6 +55,8 @@ pub fn dylib_path_envvar() -> &'static str { // penalty starting in 10.13. Cargo's testsuite ran more than twice as // slow with it on CI. "DYLD_FALLBACK_LIBRARY_PATH" + } else if cfg!(target_os = "aix") { + "LIBPATH" } else { "LD_LIBRARY_PATH" } @@ -411,11 +413,22 @@ fn _create_dir_all(p: &Path) -> Result<()> { Ok(()) } -/// Recursively remove all files and directories at the given directory. +/// Equivalent to [`std::fs::remove_dir_all`] with better error messages. /// /// This does *not* follow symlinks. pub fn remove_dir_all>(p: P) -> Result<()> { - _remove_dir_all(p.as_ref()) + _remove_dir_all(p.as_ref()).or_else(|prev_err| { + // `std::fs::remove_dir_all` is highly specialized for different platforms + // and may be more reliable than a simple walk. We try the walk first in + // order to report more detailed errors. + fs::remove_dir_all(p.as_ref()).with_context(|| { + format!( + "{:?}\n\nError: failed to remove directory `{}`", + prev_err, + p.as_ref().display(), + ) + }) + }) } fn _remove_dir_all(p: &Path) -> Result<()> { diff --git a/src/tools/cargo/crates/resolver-tests/Cargo.toml b/src/tools/cargo/crates/resolver-tests/Cargo.toml index 8a7cab113..e0efb9b6d 100644 --- a/src/tools/cargo/crates/resolver-tests/Cargo.toml +++ b/src/tools/cargo/crates/resolver-tests/Cargo.toml @@ -7,7 +7,6 @@ publish = false [dependencies] cargo.workspace = true cargo-util.workspace = true -is-terminal.workspace = true lazy_static.workspace = true proptest.workspace = true varisat.workspace = true diff --git a/src/tools/cargo/crates/resolver-tests/src/lib.rs b/src/tools/cargo/crates/resolver-tests/src/lib.rs index 01d9b5e6d..ab34e8663 100644 --- a/src/tools/cargo/crates/resolver-tests/src/lib.rs +++ b/src/tools/cargo/crates/resolver-tests/src/lib.rs @@ -179,7 +179,6 @@ pub fn resolve_with_config_raw( used: HashSet::new(), }; let summary = Summary::new( - config, pkg_id("root"), deps, &BTreeMap::new(), @@ -581,7 +580,6 @@ pub fn pkg_dep(name: T, dep: Vec) -> Summary { None }; Summary::new( - &Config::default().unwrap(), name.to_pkgid(), dep, &BTreeMap::new(), @@ -610,7 +608,6 @@ pub fn pkg_loc(name: &str, loc: &str) -> Summary { None }; Summary::new( - &Config::default().unwrap(), pkg_id_loc(name, loc), Vec::new(), &BTreeMap::new(), @@ -625,7 +622,6 @@ pub fn remove_dep(sum: &Summary, ind: usize) -> Summary { deps.remove(ind); // note: more things will need to be copied over in the future, but it works for now. Summary::new( - &Config::default().unwrap(), sum.package_id(), deps, &BTreeMap::new(), diff --git a/src/tools/cargo/crates/resolver-tests/tests/resolve.rs b/src/tools/cargo/crates/resolver-tests/tests/resolve.rs index df74826f0..02486bfb5 100644 --- a/src/tools/cargo/crates/resolver-tests/tests/resolve.rs +++ b/src/tools/cargo/crates/resolver-tests/tests/resolve.rs @@ -1,3 +1,5 @@ +use std::io::IsTerminal; + use cargo::core::dependency::DepKind; use cargo::core::Dependency; use cargo::util::Config; @@ -21,7 +23,7 @@ use proptest::prelude::*; proptest! { #![proptest_config(ProptestConfig { max_shrink_iters: - if is_ci() || !is_terminal::IsTerminal::is_terminal(&std::io::stderr()){ + if is_ci() || !std::io::stderr().is_terminal() { // This attempts to make sure that CI will fail fast, 0 } else { diff --git a/src/tools/cargo/credential/cargo-credential-1password/README.md b/src/tools/cargo/credential/cargo-credential-1password/README.md new file mode 100644 index 000000000..7cc15e05b --- /dev/null +++ b/src/tools/cargo/credential/cargo-credential-1password/README.md @@ -0,0 +1,7 @@ +# cargo-credential-1password + +This is the implementation for the Cargo credential helper for [1password]. +See the [credential-process] documentation for how to use this. + +[1password]: https://1password.com/ +[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process diff --git a/src/tools/cargo/credential/cargo-credential-gnome-secret/README.md b/src/tools/cargo/credential/cargo-credential-gnome-secret/README.md new file mode 100644 index 000000000..7a4b02838 --- /dev/null +++ b/src/tools/cargo/credential/cargo-credential-gnome-secret/README.md @@ -0,0 +1,7 @@ +# cargo-credential-gnome-secret + +This is the implementation for the Cargo credential helper for [GNOME libsecret]. +See the [credential-process] documentation for how to use this. + +[GNOME libsecret]: https://wiki.gnome.org/Projects/Libsecret +[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process diff --git a/src/tools/cargo/credential/cargo-credential-gnome-secret/build.rs b/src/tools/cargo/credential/cargo-credential-gnome-secret/build.rs index 9283535af..8bb86ee43 100644 --- a/src/tools/cargo/credential/cargo-credential-gnome-secret/build.rs +++ b/src/tools/cargo/credential/cargo-credential-gnome-secret/build.rs @@ -1,3 +1,8 @@ fn main() { - pkg_config::probe_library("libsecret-1").unwrap(); + if cfg!(target_os = "linux") { + // TODO: Consider ignoring errors when libsecret is not installed and + // switching the impl to UnsupportedCredential (possibly along with a + // warning?). + pkg_config::probe_library("libsecret-1").unwrap(); + } } diff --git a/src/tools/cargo/credential/cargo-credential-gnome-secret/src/libsecret.rs b/src/tools/cargo/credential/cargo-credential-gnome-secret/src/libsecret.rs new file mode 100644 index 000000000..c584eeecf --- /dev/null +++ b/src/tools/cargo/credential/cargo-credential-gnome-secret/src/libsecret.rs @@ -0,0 +1,190 @@ +//! Implementation of the libsecret credential helper. + +use cargo_credential::{Credential, Error}; +use std::ffi::{CStr, CString}; +use std::os::raw::{c_char, c_int}; +use std::ptr::{null, null_mut}; + +#[allow(non_camel_case_types)] +type gchar = c_char; + +#[allow(non_camel_case_types)] +type gboolean = c_int; + +type GQuark = u32; + +#[repr(C)] +struct GError { + domain: GQuark, + code: c_int, + message: *mut gchar, +} + +#[repr(C)] +struct GCancellable { + _private: [u8; 0], +} + +#[repr(C)] +struct SecretSchema { + name: *const gchar, + flags: SecretSchemaFlags, + attributes: [SecretSchemaAttribute; 32], +} + +#[repr(C)] +#[derive(Copy, Clone)] +struct SecretSchemaAttribute { + name: *const gchar, + attr_type: SecretSchemaAttributeType, +} + +#[repr(C)] +enum SecretSchemaFlags { + None = 0, +} + +#[repr(C)] +#[derive(Copy, Clone)] +enum SecretSchemaAttributeType { + String = 0, +} + +extern "C" { + fn secret_password_store_sync( + schema: *const SecretSchema, + collection: *const gchar, + label: *const gchar, + password: *const gchar, + cancellable: *mut GCancellable, + error: *mut *mut GError, + ... + ) -> gboolean; + fn secret_password_clear_sync( + schema: *const SecretSchema, + cancellable: *mut GCancellable, + error: *mut *mut GError, + ... + ) -> gboolean; + fn secret_password_lookup_sync( + schema: *const SecretSchema, + cancellable: *mut GCancellable, + error: *mut *mut GError, + ... + ) -> *mut gchar; +} + +pub struct GnomeSecret; + +fn label(index_url: &str) -> CString { + CString::new(format!("cargo-registry:{}", index_url)).unwrap() +} + +fn schema() -> SecretSchema { + let mut attributes = [SecretSchemaAttribute { + name: null(), + attr_type: SecretSchemaAttributeType::String, + }; 32]; + attributes[0] = SecretSchemaAttribute { + name: b"url\0".as_ptr() as *const gchar, + attr_type: SecretSchemaAttributeType::String, + }; + SecretSchema { + name: b"org.rust-lang.cargo.registry\0".as_ptr() as *const gchar, + flags: SecretSchemaFlags::None, + attributes, + } +} + +impl Credential for GnomeSecret { + fn name(&self) -> &'static str { + env!("CARGO_PKG_NAME") + } + + fn get(&self, index_url: &str) -> Result { + let mut error: *mut GError = null_mut(); + let attr_url = CString::new("url").unwrap(); + let index_url_c = CString::new(index_url).unwrap(); + let schema = schema(); + unsafe { + let token_c = secret_password_lookup_sync( + &schema, + null_mut(), + &mut error, + attr_url.as_ptr(), + index_url_c.as_ptr(), + null() as *const gchar, + ); + if !error.is_null() { + return Err(format!( + "failed to get token: {}", + CStr::from_ptr((*error).message).to_str()? + ) + .into()); + } + if token_c.is_null() { + return Err(format!("cannot find token for {}", index_url).into()); + } + let token = CStr::from_ptr(token_c) + .to_str() + .map_err(|e| format!("expected utf8 token: {}", e))? + .to_string(); + Ok(token) + } + } + + fn store(&self, index_url: &str, token: &str, name: Option<&str>) -> Result<(), Error> { + let label = label(name.unwrap_or(index_url)); + let token = CString::new(token).unwrap(); + let mut error: *mut GError = null_mut(); + let attr_url = CString::new("url").unwrap(); + let index_url_c = CString::new(index_url).unwrap(); + let schema = schema(); + unsafe { + secret_password_store_sync( + &schema, + b"default\0".as_ptr() as *const gchar, + label.as_ptr(), + token.as_ptr(), + null_mut(), + &mut error, + attr_url.as_ptr(), + index_url_c.as_ptr(), + null() as *const gchar, + ); + if !error.is_null() { + return Err(format!( + "failed to store token: {}", + CStr::from_ptr((*error).message).to_str()? + ) + .into()); + } + } + Ok(()) + } + + fn erase(&self, index_url: &str) -> Result<(), Error> { + let schema = schema(); + let mut error: *mut GError = null_mut(); + let attr_url = CString::new("url").unwrap(); + let index_url_c = CString::new(index_url).unwrap(); + unsafe { + secret_password_clear_sync( + &schema, + null_mut(), + &mut error, + attr_url.as_ptr(), + index_url_c.as_ptr(), + null() as *const gchar, + ); + if !error.is_null() { + return Err(format!( + "failed to erase token: {}", + CStr::from_ptr((*error).message).to_str()? + ) + .into()); + } + } + Ok(()) + } +} diff --git a/src/tools/cargo/credential/cargo-credential-gnome-secret/src/main.rs b/src/tools/cargo/credential/cargo-credential-gnome-secret/src/main.rs index 40972b05d..1d2ecc61f 100644 --- a/src/tools/cargo/credential/cargo-credential-gnome-secret/src/main.rs +++ b/src/tools/cargo/credential/cargo-credential-gnome-secret/src/main.rs @@ -1,193 +1,11 @@ //! Cargo registry gnome libsecret credential process. -use cargo_credential::{Credential, Error}; -use std::ffi::{CStr, CString}; -use std::os::raw::{c_char, c_int}; -use std::ptr::{null, null_mut}; - -#[allow(non_camel_case_types)] -type gchar = c_char; - -#[allow(non_camel_case_types)] -type gboolean = c_int; - -type GQuark = u32; - -#[repr(C)] -struct GError { - domain: GQuark, - code: c_int, - message: *mut gchar, -} - -#[repr(C)] -struct GCancellable { - _private: [u8; 0], -} - -#[repr(C)] -struct SecretSchema { - name: *const gchar, - flags: SecretSchemaFlags, - attributes: [SecretSchemaAttribute; 32], -} - -#[repr(C)] -#[derive(Copy, Clone)] -struct SecretSchemaAttribute { - name: *const gchar, - attr_type: SecretSchemaAttributeType, -} - -#[repr(C)] -enum SecretSchemaFlags { - None = 0, -} - -#[repr(C)] -#[derive(Copy, Clone)] -enum SecretSchemaAttributeType { - String = 0, -} - -extern "C" { - fn secret_password_store_sync( - schema: *const SecretSchema, - collection: *const gchar, - label: *const gchar, - password: *const gchar, - cancellable: *mut GCancellable, - error: *mut *mut GError, - ... - ) -> gboolean; - fn secret_password_clear_sync( - schema: *const SecretSchema, - cancellable: *mut GCancellable, - error: *mut *mut GError, - ... - ) -> gboolean; - fn secret_password_lookup_sync( - schema: *const SecretSchema, - cancellable: *mut GCancellable, - error: *mut *mut GError, - ... - ) -> *mut gchar; -} - -struct GnomeSecret; - -fn label(index_url: &str) -> CString { - CString::new(format!("cargo-registry:{}", index_url)).unwrap() -} - -fn schema() -> SecretSchema { - let mut attributes = [SecretSchemaAttribute { - name: null(), - attr_type: SecretSchemaAttributeType::String, - }; 32]; - attributes[0] = SecretSchemaAttribute { - name: b"url\0".as_ptr() as *const gchar, - attr_type: SecretSchemaAttributeType::String, - }; - SecretSchema { - name: b"org.rust-lang.cargo.registry\0".as_ptr() as *const gchar, - flags: SecretSchemaFlags::None, - attributes, - } -} - -impl Credential for GnomeSecret { - fn name(&self) -> &'static str { - env!("CARGO_PKG_NAME") - } - - fn get(&self, index_url: &str) -> Result { - let mut error: *mut GError = null_mut(); - let attr_url = CString::new("url").unwrap(); - let index_url_c = CString::new(index_url).unwrap(); - let schema = schema(); - unsafe { - let token_c = secret_password_lookup_sync( - &schema, - null_mut(), - &mut error, - attr_url.as_ptr(), - index_url_c.as_ptr(), - null() as *const gchar, - ); - if !error.is_null() { - return Err(format!( - "failed to get token: {}", - CStr::from_ptr((*error).message).to_str()? - ) - .into()); - } - if token_c.is_null() { - return Err(format!("cannot find token for {}", index_url).into()); - } - let token = CStr::from_ptr(token_c) - .to_str() - .map_err(|e| format!("expected utf8 token: {}", e))? - .to_string(); - Ok(token) - } - } - - fn store(&self, index_url: &str, token: &str, name: Option<&str>) -> Result<(), Error> { - let label = label(name.unwrap_or(index_url)); - let token = CString::new(token).unwrap(); - let mut error: *mut GError = null_mut(); - let attr_url = CString::new("url").unwrap(); - let index_url_c = CString::new(index_url).unwrap(); - let schema = schema(); - unsafe { - secret_password_store_sync( - &schema, - b"default\0".as_ptr() as *const gchar, - label.as_ptr(), - token.as_ptr(), - null_mut(), - &mut error, - attr_url.as_ptr(), - index_url_c.as_ptr(), - null() as *const gchar, - ); - if !error.is_null() { - return Err(format!( - "failed to store token: {}", - CStr::from_ptr((*error).message).to_str()? - ) - .into()); - } - } - Ok(()) - } - - fn erase(&self, index_url: &str) -> Result<(), Error> { - let schema = schema(); - let mut error: *mut GError = null_mut(); - let attr_url = CString::new("url").unwrap(); - let index_url_c = CString::new(index_url).unwrap(); - unsafe { - secret_password_clear_sync( - &schema, - null_mut(), - &mut error, - attr_url.as_ptr(), - index_url_c.as_ptr(), - null() as *const gchar, - ); - if !error.is_null() { - return Err(format!( - "failed to erase token: {}", - CStr::from_ptr((*error).message).to_str()? - ) - .into()); - } - } - Ok(()) - } -} +#[cfg(target_os = "linux")] +mod libsecret; +#[cfg(not(target_os = "linux"))] +use cargo_credential::UnsupportedCredential as GnomeSecret; +#[cfg(target_os = "linux")] +use libsecret::GnomeSecret; fn main() { cargo_credential::main(GnomeSecret); diff --git a/src/tools/cargo/credential/cargo-credential-macos-keychain/README.md b/src/tools/cargo/credential/cargo-credential-macos-keychain/README.md new file mode 100644 index 000000000..554116b55 --- /dev/null +++ b/src/tools/cargo/credential/cargo-credential-macos-keychain/README.md @@ -0,0 +1,7 @@ +# cargo-credential-macos-keychain + +This is the implementation for the Cargo credential helper for [macOS Keychain]. +See the [credential-process] documentation for how to use this. + +[macOS Keychain]: https://support.apple.com/guide/keychain-access/welcome/mac +[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process diff --git a/src/tools/cargo/credential/cargo-credential-wincred/README.md b/src/tools/cargo/credential/cargo-credential-wincred/README.md new file mode 100644 index 000000000..8c8d18789 --- /dev/null +++ b/src/tools/cargo/credential/cargo-credential-wincred/README.md @@ -0,0 +1,7 @@ +# cargo-credential-wincred + +This is the implementation for the Cargo credential helper for [Windows Credential Manager]. +See the [credential-process] documentation for how to use this. + +[Windows Credential Manager]: https://support.microsoft.com/en-us/windows/accessing-credential-manager-1b5c916a-6a16-889f-8581-fc16e8165ac0 +[credential-process]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#credential-process diff --git a/src/tools/cargo/src/bin/cargo/cli.rs b/src/tools/cargo/src/bin/cargo/cli.rs index 946816571..db52bc8f2 100644 --- a/src/tools/cargo/src/bin/cargo/cli.rs +++ b/src/tools/cargo/src/bin/cargo/cli.rs @@ -1,7 +1,7 @@ use anyhow::{anyhow, Context as _}; use cargo::core::shell::Shell; use cargo::core::{features, CliUnstable}; -use cargo::{self, drop_print, drop_println, CliResult, Config}; +use cargo::{self, drop_print, drop_println, CargoResult, CliResult, Config}; use clap::{Arg, ArgMatches}; use itertools::Itertools; use std::collections::HashMap; @@ -14,16 +14,6 @@ use super::list_commands; use crate::command_prelude::*; use cargo::core::features::HIDDEN; -lazy_static::lazy_static! { - // Maps from commonly known external commands (not builtin to cargo) to their - // description, for the help page. Reserved for external subcommands that are - // core within the rust ecosystem (esp ones that might become internal in the future). - static ref KNOWN_EXTERNAL_COMMAND_DESCRIPTIONS: HashMap<&'static str, &'static str> = HashMap::from([ - ("clippy", "Checks a package to catch common mistakes and improve your Rust code."), - ("fmt", "Formats all bin and lib files of the current crate using rustfmt."), - ]); -} - pub fn main(config: &mut LazyConfig) -> CliResult { let args = cli().try_get_matches()?; @@ -128,15 +118,28 @@ Run with 'cargo -Z [FLAG] [COMMAND]'", } if expanded_args.flag("list") { + // Maps from commonly known external commands (not builtin to cargo) + // to their description, for the help page. Reserved for external + // subcommands that are core within the rust ecosystem (esp ones that + // might become internal in the future). + let known_external_command_descriptions = HashMap::from([ + ( + "clippy", + "Checks a package to catch common mistakes and improve your Rust code.", + ), + ( + "fmt", + "Formats all bin and lib files of the current crate using rustfmt.", + ), + ]); drop_println!(config, "Installed Commands:"); for (name, command) in list_commands(config) { - let known_external_desc = KNOWN_EXTERNAL_COMMAND_DESCRIPTIONS.get(name.as_str()); + let known_external_desc = known_external_command_descriptions.get(name.as_str()); match command { CommandInfo::BuiltIn { about } => { assert!( known_external_desc.is_none(), - "KNOWN_EXTERNAL_COMMANDS shouldn't contain builtin \"{}\"", - name + "known_external_commands shouldn't contain builtin `{name}`", ); let summary = about.unwrap_or_default(); let summary = summary.lines().next().unwrap_or(&summary); // display only the first line @@ -172,10 +175,11 @@ Run with 'cargo -Z [FLAG] [COMMAND]'", return Ok(()); } }; - config_configure(config, &expanded_args, subcommand_args, global_args)?; + let exec = Exec::infer(cmd)?; + config_configure(config, &expanded_args, subcommand_args, global_args, &exec)?; super::init_git(config); - execute_subcommand(config, cmd, subcommand_args) + exec.exec(config, subcommand_args) } pub fn get_version_string(is_verbose: bool) -> String { @@ -255,7 +259,7 @@ fn expand_aliases( args: ArgMatches, mut already_expanded: Vec, ) -> Result<(ArgMatches, GlobalArgs), CliError> { - if let Some((cmd, args)) = args.subcommand() { + if let Some((cmd, sub_args)) = args.subcommand() { let exec = commands::builtin_exec(cmd); let aliased_cmd = super::aliased_command(config, cmd); @@ -271,7 +275,7 @@ fn expand_aliases( // Here we ignore errors from aliasing as we already favor built-in command, // and alias doesn't involve in this context. - if let Some(values) = args.get_many::("") { + if let Some(values) = sub_args.get_many::("") { // Command is built-in and is not conflicting with alias, but contains ignored values. return Err(anyhow::format_err!( "\ @@ -302,17 +306,34 @@ For more information, see issue #10049 ." + ))?; + } + } let mut alias = alias .into_iter() .map(|s| OsString::from(s)) .collect::>(); - alias.extend(args.get_many::("").unwrap_or_default().cloned()); + alias.extend( + sub_args + .get_many::("") + .unwrap_or_default() + .cloned(), + ); // new_args strips out everything before the subcommand, so // capture those global options now. // Note that an alias to an external command will not receive // these arguments. That may be confusing, but such is life. - let global_args = GlobalArgs::new(args); + let global_args = GlobalArgs::new(sub_args); let new_args = cli().no_binary_name(true).try_get_matches_from(alias)?; let new_cmd = new_args.subcommand_name().expect("subcommand is required"); @@ -343,12 +364,26 @@ fn config_configure( args: &ArgMatches, subcommand_args: &ArgMatches, global_args: GlobalArgs, + exec: &Exec, ) -> CliResult { let arg_target_dir = &subcommand_args.value_of_path("target-dir", config); - let verbose = global_args.verbose + args.verbose(); + let mut verbose = global_args.verbose + args.verbose(); // quiet is unusual because it is redefined in some subcommands in order // to provide custom help text. - let quiet = args.flag("quiet") || subcommand_args.flag("quiet") || global_args.quiet; + let mut quiet = args.flag("quiet") || subcommand_args.flag("quiet") || global_args.quiet; + if matches!(exec, Exec::Manifest(_)) && !quiet { + // Verbosity is shifted quieter for `Exec::Manifest` as it is can be used as if you ran + // `cargo install` and we especially shouldn't pollute programmatic output. + // + // For now, interactive output has the same default output as `cargo run` but that is + // subject to change. + if let Some(lower) = verbose.checked_sub(1) { + verbose = lower; + } else if !config.shell().is_err_tty() { + // Don't pollute potentially-scripted output + quiet = true; + } + } let global_color = global_args.color; // Extract so it can take reference. let color = args .get_one::("color") @@ -379,19 +414,65 @@ fn config_configure( Ok(()) } -fn execute_subcommand(config: &mut Config, cmd: &str, subcommand_args: &ArgMatches) -> CliResult { - if let Some(exec) = commands::builtin_exec(cmd) { - return exec(config, subcommand_args); +enum Exec { + Builtin(commands::Exec), + Manifest(String), + External(String), +} + +impl Exec { + /// Precedence isn't the most obvious from this function because + /// - Some is determined by `expand_aliases` + /// - Some is enforced by `avoid_ambiguity_between_builtins_and_manifest_commands` + /// + /// In actuality, it is: + /// 1. built-ins xor manifest-command + /// 2. aliases + /// 3. external subcommands + fn infer(cmd: &str) -> CargoResult { + if let Some(exec) = commands::builtin_exec(cmd) { + Ok(Self::Builtin(exec)) + } else if commands::run::is_manifest_command(cmd) { + Ok(Self::Manifest(cmd.to_owned())) + } else { + Ok(Self::External(cmd.to_owned())) + } } - let mut ext_args: Vec<&OsStr> = vec![OsStr::new(cmd)]; - ext_args.extend( - subcommand_args - .get_many::("") - .unwrap_or_default() - .map(OsString::as_os_str), - ); - super::execute_external_subcommand(config, cmd, &ext_args) + fn exec(self, config: &mut Config, subcommand_args: &ArgMatches) -> CliResult { + match self { + Self::Builtin(exec) => exec(config, subcommand_args), + Self::Manifest(cmd) => { + let ext_path = super::find_external_subcommand(config, &cmd); + if !config.cli_unstable().script && ext_path.is_some() { + config.shell().warn(format_args!( + "\ +external subcommand `{cmd}` has the appearance of a manfiest-command +This was previously accepted but will be phased out when `-Zscript` is stabilized. +For more information, see issue #12207 .", + ))?; + Self::External(cmd).exec(config, subcommand_args) + } else { + let ext_args: Vec = subcommand_args + .get_many::("") + .unwrap_or_default() + .cloned() + .collect(); + commands::run::exec_manifest_command(config, &cmd, &ext_args) + } + } + Self::External(cmd) => { + let mut ext_args = vec![OsStr::new(&cmd)]; + ext_args.extend( + subcommand_args + .get_many::("") + .unwrap_or_default() + .map(OsString::as_os_str), + ); + super::execute_external_subcommand(config, &cmd, &ext_args) + } + } + } } #[derive(Default)] @@ -435,9 +516,9 @@ pub fn cli() -> Command { #[allow(clippy::disallowed_methods)] let is_rustup = std::env::var_os("RUSTUP_HOME").is_some(); let usage = if is_rustup { - "cargo [+toolchain] [OPTIONS] [COMMAND]" + "cargo [+toolchain] [OPTIONS] [COMMAND]\n cargo [+toolchain] [OPTIONS] -Zscript [ARGS]..." } else { - "cargo [OPTIONS] [COMMAND]" + "cargo [OPTIONS] [COMMAND]\n cargo [OPTIONS] -Zscript [ARGS]..." }; Command::new("cargo") // Subcommands all count their args' display order independently (from 0), @@ -567,3 +648,14 @@ impl LazyConfig { fn verify_cli() { cli().debug_assert(); } + +#[test] +fn avoid_ambiguity_between_builtins_and_manifest_commands() { + for cmd in commands::builtin() { + let name = cmd.get_name(); + assert!( + !commands::run::is_manifest_command(&name), + "built-in command {name} is ambiguous with manifest-commands" + ) + } +} diff --git a/src/tools/cargo/src/bin/cargo/commands/add.rs b/src/tools/cargo/src/bin/cargo/commands/add.rs index 90c4f4dd5..52fc38b74 100644 --- a/src/tools/cargo/src/bin/cargo/commands/add.rs +++ b/src/tools/cargo/src/bin/cargo/commands/add.rs @@ -242,7 +242,20 @@ fn parse_dependencies(config: &Config, matches: &ArgMatches) -> CargoResult>(); + let mut infer_crate_name = false; + + for (crate_name, _) in crates.iter() { + let crate_name = crate_name.as_ref().unwrap(); + + if let Some(toolchain) = crate_name.strip_prefix("+") { + anyhow::bail!( + "invalid character `+` in dependency name: `+{toolchain}` + Use `cargo +{toolchain} add` if you meant to use the `{toolchain}` toolchain." + ); + } + } + if crates.is_empty() { if path.is_some() || git.is_some() { crates.insert(None, None); diff --git a/src/tools/cargo/src/bin/cargo/commands/install.rs b/src/tools/cargo/src/bin/cargo/commands/install.rs index 8197a1690..3bb90c2d5 100644 --- a/src/tools/cargo/src/bin/cargo/commands/install.rs +++ b/src/tools/cargo/src/bin/cargo/commands/install.rs @@ -1,5 +1,6 @@ use crate::command_prelude::*; +use anyhow::anyhow; use cargo::core::{GitReference, SourceId, Workspace}; use cargo::ops; use cargo::util::IntoUrl; @@ -108,6 +109,16 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { .map(|k| resolve_crate(k, version)) .collect::>>()?; + for (crate_name, _) in krates.iter() { + if let Some(toolchain) = crate_name.strip_prefix("+") { + return Err(anyhow!( + "invalid character `+` in package name: `+{toolchain}` + Use `cargo +{toolchain} install` if you meant to use the `{toolchain}` toolchain." + ) + .into()); + } + } + let mut from_cwd = false; let source = if let Some(url) = args.get_one::("git") { diff --git a/src/tools/cargo/src/bin/cargo/commands/mod.rs b/src/tools/cargo/src/bin/cargo/commands/mod.rs index da3109260..b9da0e5fb 100644 --- a/src/tools/cargo/src/bin/cargo/commands/mod.rs +++ b/src/tools/cargo/src/bin/cargo/commands/mod.rs @@ -43,7 +43,9 @@ pub fn builtin() -> Vec { ] } -pub fn builtin_exec(cmd: &str) -> Option CliResult> { +pub type Exec = fn(&mut Config, &ArgMatches) -> CliResult; + +pub fn builtin_exec(cmd: &str) -> Option { let f = match cmd { "add" => add::exec, "bench" => bench::exec, diff --git a/src/tools/cargo/src/bin/cargo/commands/run.rs b/src/tools/cargo/src/bin/cargo/commands/run.rs index cde754c7a..366e19396 100644 --- a/src/tools/cargo/src/bin/cargo/commands/run.rs +++ b/src/tools/cargo/src/bin/cargo/commands/run.rs @@ -1,6 +1,11 @@ +use std::ffi::OsStr; +use std::ffi::OsString; +use std::path::Path; + use crate::command_prelude::*; use crate::util::restricted_names::is_glob_pattern; use cargo::core::Verbosity; +use cargo::core::Workspace; use cargo::ops::{self, CompileFilter, Packages}; use cargo_util::ProcessError; @@ -13,7 +18,7 @@ pub fn cli() -> Command { .arg( Arg::new("args") .help("Arguments for the binary or example to run") - .value_parser(value_parser!(std::ffi::OsString)) + .value_parser(value_parser!(OsString)) .num_args(0..) .trailing_var_arg(true), ) @@ -77,27 +82,64 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { } }; - ops::run(&ws, &compile_opts, &values_os(args, "args")).map_err(|err| { - let proc_err = match err.downcast_ref::() { - Some(e) => e, - None => return CliError::new(err, 101), - }; - - // If we never actually spawned the process then that sounds pretty - // bad and we always want to forward that up. - let exit_code = match proc_err.code { - Some(exit) => exit, - None => return CliError::new(err, 101), - }; - - // If `-q` was passed then we suppress extra error information about - // a failed process, we assume the process itself printed out enough - // information about why it failed so we don't do so as well - let is_quiet = config.shell().verbosity() == Verbosity::Quiet; - if is_quiet { - CliError::code(exit_code) - } else { - CliError::new(err, exit_code) - } - }) + ops::run(&ws, &compile_opts, &values_os(args, "args")).map_err(|err| to_run_error(config, err)) +} + +/// See also `util/toml/mod.rs`s `is_embedded` +pub fn is_manifest_command(arg: &str) -> bool { + let path = Path::new(arg); + 1 < path.components().count() + || path.extension() == Some(OsStr::new("rs")) + || path.file_name() == Some(OsStr::new("Cargo.toml")) +} + +pub fn exec_manifest_command(config: &mut Config, cmd: &str, args: &[OsString]) -> CliResult { + if !config.cli_unstable().script { + return Err(anyhow::anyhow!("running `{cmd}` requires `-Zscript`").into()); + } + + let manifest_path = Path::new(cmd); + let manifest_path = root_manifest(Some(manifest_path), config)?; + + // Treat `cargo foo.rs` like `cargo install --path foo` and re-evaluate the config based on the + // location where the script resides, rather than the environment from where it's being run. + let parent_path = manifest_path + .parent() + .expect("a file should always have a parent"); + config.reload_rooted_at(parent_path)?; + + let mut ws = Workspace::new(&manifest_path, config)?; + if config.cli_unstable().avoid_dev_deps { + ws.set_require_optional_deps(false); + } + + let mut compile_opts = + cargo::ops::CompileOptions::new(config, cargo::core::compiler::CompileMode::Build)?; + compile_opts.spec = cargo::ops::Packages::Default; + + cargo::ops::run(&ws, &compile_opts, args).map_err(|err| to_run_error(config, err)) +} + +fn to_run_error(config: &cargo::util::Config, err: anyhow::Error) -> CliError { + let proc_err = match err.downcast_ref::() { + Some(e) => e, + None => return CliError::new(err, 101), + }; + + // If we never actually spawned the process then that sounds pretty + // bad and we always want to forward that up. + let exit_code = match proc_err.code { + Some(exit) => exit, + None => return CliError::new(err, 101), + }; + + // If `-q` was passed then we suppress extra error information about + // a failed process, we assume the process itself printed out enough + // information about why it failed so we don't do so as well + let is_quiet = config.shell().verbosity() == Verbosity::Quiet; + if is_quiet { + CliError::code(exit_code) + } else { + CliError::new(err, exit_code) + } } diff --git a/src/tools/cargo/src/bin/cargo/main.rs b/src/tools/cargo/src/bin/cargo/main.rs index 9fb6635ea..462332fb7 100644 --- a/src/tools/cargo/src/bin/cargo/main.rs +++ b/src/tools/cargo/src/bin/cargo/main.rs @@ -2,6 +2,8 @@ #![allow(clippy::all)] #![warn(clippy::disallowed_methods)] +use cargo::util::network::http::http_handle; +use cargo::util::network::http::needs_custom_http_transport; use cargo::util::toml::StringOrVec; use cargo::util::CliError; use cargo::util::{self, closest_msg, command_prelude, CargoResult, CliResult, Config}; @@ -293,12 +295,12 @@ fn init_git(config: &Config) { /// configured to use libcurl instead of the built-in networking support so /// that those configuration settings can be used. fn init_git_transports(config: &Config) { - match cargo::ops::needs_custom_http_transport(config) { + match needs_custom_http_transport(config) { Ok(true) => {} _ => return, } - let handle = match cargo::ops::http_handle(config) { + let handle = match http_handle(config) { Ok(handle) => handle, Err(..) => return, }; diff --git a/src/tools/cargo/src/cargo/core/compiler/build_config.rs b/src/tools/cargo/src/cargo/core/compiler/build_config.rs index 885b124b9..5d4d754bf 100644 --- a/src/tools/cargo/src/cargo/core/compiler/build_config.rs +++ b/src/tools/cargo/src/cargo/core/compiler/build_config.rs @@ -1,4 +1,5 @@ use crate::core::compiler::CompileKind; +use crate::util::config::JobsConfig; use crate::util::interning::InternedString; use crate::util::{CargoResult, Config, RustfixDiagnosticServer}; use anyhow::{bail, Context as _}; @@ -64,7 +65,7 @@ impl BuildConfig { /// * `target.$target.libfoo.metadata` pub fn new( config: &Config, - jobs: Option, + jobs: Option, keep_going: bool, requested_targets: &[String], mode: CompileMode, @@ -78,11 +79,22 @@ impl BuildConfig { its environment, ignoring the `-j` parameter", )?; } - let jobs = match jobs.or(cfg.jobs) { + let jobs = match jobs.or(cfg.jobs.clone()) { None => default_parallelism()?, - Some(0) => anyhow::bail!("jobs may not be 0"), - Some(j) if j < 0 => (default_parallelism()? as i32 + j).max(1) as u32, - Some(j) => j as u32, + Some(value) => match value { + JobsConfig::Integer(j) => match j { + 0 => anyhow::bail!("jobs may not be 0"), + j if j < 0 => (default_parallelism()? as i32 + j).max(1) as u32, + j => j as u32, + }, + JobsConfig::String(j) => match j.as_str() { + "default" => default_parallelism()?, + _ => { + anyhow::bail!( + format!("could not parse `{j}`. Number of parallel jobs should be `default` or a number.")) + } + }, + }, }; if config.cli_unstable().build_std.is_some() && requested_kinds[0].is_host() { diff --git a/src/tools/cargo/src/cargo/core/compiler/custom_build.rs b/src/tools/cargo/src/cargo/core/compiler/custom_build.rs index 01890e542..d17462174 100644 --- a/src/tools/cargo/src/cargo/core/compiler/custom_build.rs +++ b/src/tools/cargo/src/cargo/core/compiler/custom_build.rs @@ -31,7 +31,7 @@ //! [`CompileMode::RunCustomBuild`]: super::CompileMode //! [instructions]: https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script -use super::{fingerprint, Context, Job, LinkType, Unit, Work}; +use super::{fingerprint, Context, Job, Unit, Work}; use crate::core::compiler::artifact; use crate::core::compiler::context::Metadata; use crate::core::compiler::job_queue::JobState; @@ -62,7 +62,7 @@ pub struct BuildOutput { /// Names and link kinds of libraries, suitable for the `-l` flag. pub library_links: Vec, /// Linker arguments suitable to be passed to `-C link-arg=` - pub linker_args: Vec<(LinkType, String)>, + pub linker_args: Vec<(LinkArgTarget, String)>, /// Various `--cfg` flags to pass to the compiler. pub cfgs: Vec, /// Various `--check-cfg` flags to pass to the compiler. @@ -146,6 +146,47 @@ pub struct BuildDeps { pub rerun_if_env_changed: Vec, } +/// Represents one of the instructions from `cargo:rustc-link-arg-*` build +/// script instruction family. +/// +/// In other words, indicates targets that custom linker arguments applies to. +/// +/// See the [build script documentation][1] for more. +/// +/// [1]: https://doc.rust-lang.org/nightly/cargo/reference/build-scripts.html#cargorustc-link-argflag +#[derive(Clone, Hash, Debug, PartialEq, Eq)] +pub enum LinkArgTarget { + /// Represents `cargo:rustc-link-arg=FLAG`. + All, + /// Represents `cargo:rustc-cdylib-link-arg=FLAG`. + Cdylib, + /// Represents `cargo:rustc-link-arg-bins=FLAG`. + Bin, + /// Represents `cargo:rustc-link-arg-bin=BIN=FLAG`. + SingleBin(String), + /// Represents `cargo:rustc-link-arg-tests=FLAG`. + Test, + /// Represents `cargo:rustc-link-arg-benches=FLAG`. + Bench, + /// Represents `cargo:rustc-link-arg-examples=FLAG`. + Example, +} + +impl LinkArgTarget { + /// Checks if this link type applies to a given [`Target`]. + pub fn applies_to(&self, target: &Target) -> bool { + match self { + LinkArgTarget::All => true, + LinkArgTarget::Cdylib => target.is_cdylib(), + LinkArgTarget::Bin => target.is_bin(), + LinkArgTarget::SingleBin(name) => target.is_bin() && target.name() == name, + LinkArgTarget::Test => target.is_test(), + LinkArgTarget::Bench => target.is_bench(), + LinkArgTarget::Example => target.is_exe_example(), + } + } +} + /// Prepares a `Work` that executes the target as a custom build script. pub fn prepare(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { let _p = profile::start(format!( @@ -711,10 +752,10 @@ impl BuildOutput { key, pkg_descr )); } - linker_args.push((LinkType::Cdylib, value)) + linker_args.push((LinkArgTarget::Cdylib, value)) } "rustc-link-arg-bins" => { - check_and_add_target!("bin", Target::is_bin, LinkType::Bin); + check_and_add_target!("bin", Target::is_bin, LinkArgTarget::Bin); } "rustc-link-arg-bin" => { let mut parts = value.splitn(2, '='); @@ -742,19 +783,19 @@ impl BuildOutput { bin_name ); } - linker_args.push((LinkType::SingleBin(bin_name), arg.to_string())); + linker_args.push((LinkArgTarget::SingleBin(bin_name), arg.to_string())); } "rustc-link-arg-tests" => { - check_and_add_target!("test", Target::is_test, LinkType::Test); + check_and_add_target!("test", Target::is_test, LinkArgTarget::Test); } "rustc-link-arg-benches" => { - check_and_add_target!("benchmark", Target::is_bench, LinkType::Bench); + check_and_add_target!("benchmark", Target::is_bench, LinkArgTarget::Bench); } "rustc-link-arg-examples" => { - check_and_add_target!("example", Target::is_example, LinkType::Example); + check_and_add_target!("example", Target::is_example, LinkArgTarget::Example); } "rustc-link-arg" => { - linker_args.push((LinkType::All, value)); + linker_args.push((LinkArgTarget::All, value)); } "rustc-cfg" => cfgs.push(value.to_string()), "rustc-check-cfg" => { diff --git a/src/tools/cargo/src/cargo/core/compiler/fingerprint/mod.rs b/src/tools/cargo/src/cargo/core/compiler/fingerprint/mod.rs index a3523110b..aa8be50f7 100644 --- a/src/tools/cargo/src/cargo/core/compiler/fingerprint/mod.rs +++ b/src/tools/cargo/src/cargo/core/compiler/fingerprint/mod.rs @@ -1,8 +1,11 @@ -//! # Fingerprints +//! Tracks changes to determine if something needs to be recompiled. //! //! This module implements change-tracking so that Cargo can know whether or //! not something needs to be recompiled. A Cargo [`Unit`] can be either "dirty" //! (needs to be recompiled) or "fresh" (it does not need to be recompiled). +//! +//! ## Mechanisms affecting freshness +//! //! There are several mechanisms that influence a Unit's freshness: //! //! - The [`Fingerprint`] is a hash, saved to the filesystem in the diff --git a/src/tools/cargo/src/cargo/core/compiler/mod.rs b/src/tools/cargo/src/cargo/core/compiler/mod.rs index 7e49f0079..31e63c226 100644 --- a/src/tools/cargo/src/cargo/core/compiler/mod.rs +++ b/src/tools/cargo/src/cargo/core/compiler/mod.rs @@ -76,6 +76,7 @@ pub use self::compilation::{Compilation, Doctest, UnitOutput}; pub use self::compile_kind::{CompileKind, CompileTarget}; pub use self::context::{Context, Metadata}; pub use self::crate_type::CrateType; +pub use self::custom_build::LinkArgTarget; pub use self::custom_build::{BuildOutput, BuildScriptOutputs, BuildScripts}; pub(crate) use self::fingerprint::DirtyReason; pub use self::job_queue::Freshness; @@ -99,44 +100,6 @@ use rustfix::diagnostics::Applicability; const RUSTDOC_CRATE_VERSION_FLAG: &str = "--crate-version"; -// TODO: Rename this to `ExtraLinkArgFor` or else, and move to compiler/custom_build.rs? -/// Represents one of the instruction from `cargo:rustc-link-arg-*` build script -/// instruction family. -/// -/// In other words, indicates targets that custom linker arguments applies to. -#[derive(Clone, Hash, Debug, PartialEq, Eq)] -pub enum LinkType { - /// Represents `cargo:rustc-link-arg=FLAG`. - All, - /// Represents `cargo:rustc-cdylib-link-arg=FLAG`. - Cdylib, - /// Represents `cargo:rustc-link-arg-bins=FLAG`. - Bin, - /// Represents `cargo:rustc-link-arg-bin=BIN=FLAG`. - SingleBin(String), - /// Represents `cargo:rustc-link-arg-tests=FLAG`. - Test, - /// Represents `cargo:rustc-link-arg-benches=FLAG`. - Bench, - /// Represents `cargo:rustc-link-arg-examples=FLAG`. - Example, -} - -impl LinkType { - /// Checks if this link type applies to a given [`Target`]. - pub fn applies_to(&self, target: &Target) -> bool { - match self { - LinkType::All => true, - LinkType::Cdylib => target.is_cdylib(), - LinkType::Bin => target.is_bin(), - LinkType::SingleBin(name) => target.is_bin() && target.name() == name, - LinkType::Test => target.is_test(), - LinkType::Bench => target.is_bench(), - LinkType::Example => target.is_exe_example(), - } - } -} - /// A glorified callback for executing calls to rustc. Rather than calling rustc /// directly, we'll use an `Executor`, giving clients an opportunity to intercept /// the build calls. @@ -286,14 +249,12 @@ fn make_failed_scrape_diagnostic( /// Creates a unit of work invoking `rustc` for building the `unit`. fn rustc(cx: &mut Context<'_, '_>, unit: &Unit, exec: &Arc) -> CargoResult { - let mut rustc = prepare_rustc(cx, &unit.target.rustc_crate_types(), unit)?; + let mut rustc = prepare_rustc(cx, unit)?; let build_plan = cx.bcx.build_config.build_plan; let name = unit.pkg.name().to_string(); let buildkey = unit.buildkey(); - add_cap_lints(cx.bcx, unit, &mut rustc); - let outputs = cx.outputs(unit)?; let root = cx.files().out_dir(unit); @@ -319,10 +280,6 @@ fn rustc(cx: &mut Context<'_, '_>, unit: &Unit, exec: &Arc) -> Car let rustc_dep_info_loc = root.join(dep_info_name); let dep_info_loc = fingerprint::dep_info_loc(cx, unit); - rustc.args(cx.bcx.rustflags_args(unit)); - if cx.bcx.config.cli_unstable().binary_dep_depinfo { - rustc.arg("-Z").arg("binary-dep-depinfo"); - } let mut output_options = OutputOptions::new(cx, unit); let package_id = unit.pkg.package_id(); let target = Target::clone(&unit.target); @@ -544,7 +501,7 @@ fn rustc(cx: &mut Context<'_, '_>, unit: &Unit, exec: &Arc) -> Car // clause should have been kept in the `if` block above. For // now, continue allowing it for cdylib only. // See https://github.com/rust-lang/cargo/issues/9562 - if lt.applies_to(target) && (key.0 == current_id || *lt == LinkType::Cdylib) { + if lt.applies_to(target) && (key.0 == current_id || *lt == LinkArgTarget::Cdylib) { rustc.arg("-C").arg(format!("link-arg={}", arg)); } } @@ -604,7 +561,7 @@ fn link_targets(cx: &mut Context<'_, '_>, unit: &Unit, fresh: bool) -> CargoResu } if json_messages { - let debuginfo = profile.debuginfo.to_option().map(|d| match d { + let debuginfo = match profile.debuginfo.into_inner() { TomlDebugInfo::None => machine_message::ArtifactDebuginfo::Int(0), TomlDebugInfo::Limited => machine_message::ArtifactDebuginfo::Int(1), TomlDebugInfo::Full => machine_message::ArtifactDebuginfo::Int(2), @@ -614,10 +571,10 @@ fn link_targets(cx: &mut Context<'_, '_>, unit: &Unit, fresh: bool) -> CargoResu TomlDebugInfo::LineTablesOnly => { machine_message::ArtifactDebuginfo::Named("line-tables-only") } - }); + }; let art_profile = machine_message::ArtifactProfile { opt_level: profile.opt_level.as_str(), - debuginfo, + debuginfo: Some(debuginfo), debug_assertions: profile.debug_assertions, overflow_checks: profile.overflow_checks, test: unit_mode.is_any_test(), @@ -705,13 +662,13 @@ where search_path } -// TODO: do we really need this as a separate function? -// Maybe we should reorganize `rustc` fn to make it more traceable and readable. -fn prepare_rustc( - cx: &mut Context<'_, '_>, - crate_types: &[CrateType], - unit: &Unit, -) -> CargoResult { +/// Prepares flags and environments we can compute for a `rustc` invocation +/// before the job queue starts compiling any unit. +/// +/// This builds a static view of the invocation. Flags depending on the +/// completion of other units will be added later in runtime, such as flags +/// from build scripts. +fn prepare_rustc(cx: &Context<'_, '_>, unit: &Unit) -> CargoResult { let is_primary = cx.is_primary_package(unit); let is_workspace = cx.bcx.ws.is_member(&unit.pkg); @@ -729,13 +686,23 @@ fn prepare_rustc( } base.inherit_jobserver(&cx.jobserver); - build_base_args(cx, &mut base, unit, crate_types)?; + build_base_args(cx, &mut base, unit)?; build_deps_args(&mut base, cx, unit)?; + add_cap_lints(cx.bcx, unit, &mut base); + base.args(cx.bcx.rustflags_args(unit)); + if cx.bcx.config.cli_unstable().binary_dep_depinfo { + base.arg("-Z").arg("binary-dep-depinfo"); + } Ok(base) } -/// Creates a unit of work invoking `rustdoc` for documenting the `unit`. -fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { +/// Prepares flags and environments we can compute for a `rustdoc` invocation +/// before the job queue starts compiling any unit. +/// +/// This builds a static view of the invocation. Flags depending on the +/// completion of other units will be added later in runtime, such as flags +/// from build scripts. +fn prepare_rustdoc(cx: &Context<'_, '_>, unit: &Unit) -> CargoResult { let bcx = cx.bcx; // script_metadata is not needed here, it is only for tests. let mut rustdoc = cx.compilation.rustdoc_process(unit, None)?; @@ -749,12 +716,6 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { rustdoc.arg("--target").arg(target.rustc_target()); } let doc_dir = cx.files().out_dir(unit); - - // Create the documentation directory ahead of time as rustdoc currently has - // a bug where concurrent invocations will race to create this directory if - // it doesn't already exist. - paths::create_dir_all(&doc_dir)?; - rustdoc.arg("-o").arg(&doc_dir); rustdoc.args(&features_args(unit)); rustdoc.args(&check_cfg_args(cx, unit)); @@ -770,10 +731,6 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { let metadata = cx.metadata_for_doc_units[unit]; rustdoc.arg("-C").arg(format!("metadata={}", metadata)); - let scrape_output_path = |unit: &Unit| -> CargoResult { - cx.outputs(unit).map(|outputs| outputs[0].path.clone()) - }; - if unit.mode.is_doc_scrape() { debug_assert!(cx.bcx.scrape_units.contains(unit)); @@ -785,7 +742,7 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { rustdoc .arg("--scrape-examples-output-path") - .arg(scrape_output_path(unit)?); + .arg(scrape_output_path(cx, unit)?); // Only scrape example for items from crates in the workspace, to reduce generated file size for pkg in cx.bcx.ws.members() { @@ -800,21 +757,9 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { } } - let should_include_scrape_units = unit.mode.is_doc() - && cx.bcx.scrape_units.len() > 0 - && cx.bcx.ws.unit_needs_doc_scrape(unit); - let scrape_outputs = if should_include_scrape_units { + if should_include_scrape_units(cx.bcx, unit) { rustdoc.arg("-Zunstable-options"); - Some( - cx.bcx - .scrape_units - .iter() - .map(|unit| Ok((cx.files().metadata(unit), scrape_output_path(unit)?))) - .collect::>>()?, - ) - } else { - None - }; + } build_deps_args(&mut rustdoc, cx, unit)?; rustdoc::add_root_urls(cx, unit, &mut rustdoc)?; @@ -825,6 +770,20 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { append_crate_version_flag(unit, &mut rustdoc); } + Ok(rustdoc) +} + +/// Creates a unit of work invoking `rustdoc` for documenting the `unit`. +fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { + let mut rustdoc = prepare_rustdoc(cx, unit)?; + + let crate_name = unit.target.crate_name(); + let doc_dir = cx.files().out_dir(unit); + // Create the documentation directory ahead of time as rustdoc currently has + // a bug where concurrent invocations will race to create this directory if + // it doesn't already exist. + paths::create_dir_all(&doc_dir)?; + let target_desc = unit.target.description_named(); let name = unit.pkg.name().to_string(); let build_script_outputs = Arc::clone(&cx.build_script_outputs); @@ -833,6 +792,17 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { let target = Target::clone(&unit.target); let mut output_options = OutputOptions::new(cx, unit); let script_metadata = cx.find_build_script_metadata(unit); + let scrape_outputs = if should_include_scrape_units(cx.bcx, unit) { + Some( + cx.bcx + .scrape_units + .iter() + .map(|unit| Ok((cx.files().metadata(unit), scrape_output_path(cx, unit)?))) + .collect::>>()?, + ) + } else { + None + }; let failed_scrape_units = Arc::clone(&cx.failed_scrape_units); let hide_diagnostics_for_scrape_unit = cx.bcx.unit_can_fail_for_docscraping(unit) @@ -977,12 +947,7 @@ fn add_error_format_and_color(cx: &Context<'_, '_>, cmd: &mut ProcessBuilder) { } /// Adds essential rustc flags and environment variables to the command to execute. -fn build_base_args( - cx: &mut Context<'_, '_>, - cmd: &mut ProcessBuilder, - unit: &Unit, - crate_types: &[CrateType], -) -> CargoResult<()> { +fn build_base_args(cx: &Context<'_, '_>, cmd: &mut ProcessBuilder, unit: &Unit) -> CargoResult<()> { assert!(!unit.mode.is_run_custom_build()); let bcx = cx.bcx; @@ -998,7 +963,7 @@ fn build_base_args( ref panic, incremental, strip, - rustflags, + rustflags: profile_rustflags, .. } = unit.profile.clone(); let test = unit.mode.is_any_test(); @@ -1014,7 +979,7 @@ fn build_base_args( let mut contains_dy_lib = false; if !test { - for crate_type in crate_types { + for crate_type in &unit.target.rustc_crate_types() { cmd.arg("--crate-type").arg(crate_type.as_str()); contains_dy_lib |= crate_type == &CrateType::Dylib; } @@ -1047,22 +1012,6 @@ fn build_base_args( cmd.args(<o_args(cx, unit)); - // This is generally just an optimization on build time so if we don't pass - // it then it's ok. The values for the flag (off, packed, unpacked) may be supported - // or not depending on the platform, so availability is checked per-value. - // For example, at the time of writing this code, on Windows the only stable valid - // value for split-debuginfo is "packed", while on Linux "unpacked" is also stable. - if let Some(split) = split_debuginfo { - if cx - .bcx - .target_data - .info(unit.kind) - .supports_debuginfo_split(split) - { - cmd.arg("-C").arg(format!("split-debuginfo={}", split)); - } - } - if let Some(backend) = codegen_backend { cmd.arg("-Z").arg(&format!("codegen-backend={}", backend)); } @@ -1071,14 +1020,30 @@ fn build_base_args( cmd.arg("-C").arg(&format!("codegen-units={}", n)); } - if let Some(debuginfo) = debuginfo.to_option() { - cmd.arg("-C").arg(format!("debuginfo={}", debuginfo)); + let debuginfo = debuginfo.into_inner(); + // Shorten the number of arguments if possible. + if debuginfo != TomlDebugInfo::None { + cmd.arg("-C").arg(format!("debuginfo={debuginfo}")); + // This is generally just an optimization on build time so if we don't + // pass it then it's ok. The values for the flag (off, packed, unpacked) + // may be supported or not depending on the platform, so availability is + // checked per-value. For example, at the time of writing this code, on + // Windows the only stable valid value for split-debuginfo is "packed", + // while on Linux "unpacked" is also stable. + if let Some(split) = split_debuginfo { + if cx + .bcx + .target_data + .info(unit.kind) + .supports_debuginfo_split(split) + { + cmd.arg("-C").arg(format!("split-debuginfo={split}")); + } + } } cmd.args(unit.pkg.manifest().lint_rustflags()); - if !rustflags.is_empty() { - cmd.args(&rustflags); - } + cmd.args(&profile_rustflags); if let Some(args) = cx.bcx.extra_args_for(unit) { cmd.args(args); } @@ -1277,11 +1242,7 @@ fn lto_args(cx: &Context<'_, '_>, unit: &Unit) -> Vec { /// /// [`-L`]: https://doc.rust-lang.org/nightly/rustc/command-line-arguments.html#-l-add-a-directory-to-the-library-search-path /// [`--extern`]: https://doc.rust-lang.org/nightly/rustc/command-line-arguments.html#--extern-specify-where-an-external-library-is-located -fn build_deps_args( - cmd: &mut ProcessBuilder, - cx: &mut Context<'_, '_>, - unit: &Unit, -) -> CargoResult<()> { +fn build_deps_args(cmd: &mut ProcessBuilder, cx: &Context<'_, '_>, unit: &Unit) -> CargoResult<()> { let bcx = cx.bcx; cmd.arg("-L").arg(&{ let mut deps = OsString::from("dependency="); @@ -1821,3 +1782,14 @@ fn apply_env_config(config: &crate::Config, cmd: &mut ProcessBuilder) -> CargoRe } Ok(()) } + +/// Checks if there are some scrape units waiting to be processed. +fn should_include_scrape_units(bcx: &BuildContext<'_, '_>, unit: &Unit) -> bool { + unit.mode.is_doc() && bcx.scrape_units.len() > 0 && bcx.ws.unit_needs_doc_scrape(unit) +} + +/// Gets the file path of function call information output from `rustdoc`. +fn scrape_output_path(cx: &Context<'_, '_>, unit: &Unit) -> CargoResult { + assert!(unit.mode.is_doc() || unit.mode.is_doc_scrape()); + cx.outputs(unit).map(|outputs| outputs[0].path.clone()) +} diff --git a/src/tools/cargo/src/cargo/core/compiler/unit_dependencies.rs b/src/tools/cargo/src/cargo/core/compiler/unit_dependencies.rs index 3bf8b0c77..369fd8318 100644 --- a/src/tools/cargo/src/cargo/core/compiler/unit_dependencies.rs +++ b/src/tools/cargo/src/cargo/core/compiler/unit_dependencies.rs @@ -1,4 +1,4 @@ -//! # Constructs the dependency graph for compilation +//! Constructs the dependency graph for compilation. //! //! Rust code is typically organized as a set of Cargo packages. The //! dependencies between the packages themselves are stored in the diff --git a/src/tools/cargo/src/cargo/core/features.rs b/src/tools/cargo/src/cargo/core/features.rs index d56054a0a..9b99d5a15 100644 --- a/src/tools/cargo/src/cargo/core/features.rs +++ b/src/tools/cargo/src/cargo/core/features.rs @@ -687,6 +687,26 @@ macro_rules! unstable_cli_options { fields } } + + #[cfg(test)] + mod test { + #[test] + fn ensure_sorted() { + // This will be printed out if the fields are not sorted. + let location = std::panic::Location::caller(); + println!( + "\nTo fix this test, sort the features inside the macro at {}:{}\n", + location.file(), + location.line() + ); + let mut expected = vec![$(stringify!($element)),*]; + expected[2..].sort(); + snapbox::assert_eq( + format!("{:#?}", expected), + format!("{:#?}", vec![$(stringify!($element)),*]) + ); + } + } } } @@ -696,7 +716,7 @@ unstable_cli_options!( print_im_a_teapot: bool = (HIDDEN), // All other unstable features. - // Please keep this list lexiographically ordered. + // Please keep this list lexicographically ordered. advanced_env: bool = (HIDDEN), avoid_dev_deps: bool = ("Avoid installing dev-dependencies if possible"), binary_dep_depinfo: bool = ("Track changes to dependency artifacts"), @@ -704,34 +724,34 @@ unstable_cli_options!( #[serde(deserialize_with = "deserialize_build_std")] build_std: Option> = ("Enable Cargo to compile the standard library itself as part of a crate graph compilation"), build_std_features: Option> = ("Configure features enabled for the standard library itself when building the standard library"), + #[serde(deserialize_with = "deserialize_check_cfg")] + check_cfg: Option<(/*features:*/ bool, /*well_known_names:*/ bool, /*well_known_values:*/ bool, /*output:*/ bool)> = ("Specify scope of compile-time checking of `cfg` names/values"), codegen_backend: bool = ("Enable the `codegen-backend` option in profiles in .cargo/config.toml file"), config_include: bool = ("Enable the `include` key in config files"), credential_process: bool = ("Add a config setting to fetch registry authentication tokens by calling an external process"), - #[serde(deserialize_with = "deserialize_check_cfg")] - check_cfg: Option<(/*features:*/ bool, /*well_known_names:*/ bool, /*well_known_values:*/ bool, /*output:*/ bool)> = ("Specify scope of compile-time checking of `cfg` names/values"), - doctest_in_workspace: bool = ("Compile doctests with paths relative to the workspace root"), + direct_minimal_versions: bool = ("Resolve minimal dependency versions instead of maximum (direct dependencies only)"), doctest_xcompile: bool = ("Compile and run doctests for non-host target using runner config"), dual_proc_macros: bool = ("Build proc-macros for both the host and the target"), features: Option> = (HIDDEN), gitoxide: Option = ("Use gitoxide for the given git interactions, or all of them if no argument is given"), - jobserver_per_rustc: bool = (HIDDEN), + host_config: bool = ("Enable the [host] section in the .cargo/config.toml file"), + lints: bool = ("Pass `[lints]` to the linting tools"), minimal_versions: bool = ("Resolve minimal dependency versions instead of maximum"), - direct_minimal_versions: bool = ("Resolve minimal dependency versions instead of maximum (direct dependencies only)"), + msrv_policy: bool = ("Enable rust-version aware policy within cargo"), mtime_on_use: bool = ("Configure Cargo to update the mtime of used files"), + next_lockfile_bump: bool = (HIDDEN), no_index_update: bool = ("Do not update the registry index even if the cache is outdated"), panic_abort_tests: bool = ("Enable support to run tests with -Cpanic=abort"), profile_rustflags: bool = ("Enable the `rustflags` option in profiles in .cargo/config.toml file"), - host_config: bool = ("Enable the [host] section in the .cargo/config.toml file"), + publish_timeout: bool = ("Enable the `publish.timeout` key in .cargo/config.toml file"), registry_auth: bool = ("Authentication for alternative registries, and generate registry authentication tokens using asymmetric cryptography"), - target_applies_to_host: bool = ("Enable the `target-applies-to-host` key in the .cargo/config.toml file"), rustdoc_map: bool = ("Allow passing external documentation mappings to rustdoc"), + rustdoc_scrape_examples: bool = ("Allows Rustdoc to scrape code examples from reverse-dependencies"), + script: bool = ("Enable support for single-file, `.rs` packages"), separate_nightlies: bool = (HIDDEN), - publish_timeout: bool = ("Enable the `publish.timeout` key in .cargo/config.toml file"), - unstable_options: bool = ("Allow the usage of unstable options"), skip_rustdoc_fingerprint: bool = (HIDDEN), - rustdoc_scrape_examples: bool = ("Allows Rustdoc to scrape code examples from reverse-dependencies"), - msrv_policy: bool = ("Enable rust-version aware policy within cargo"), - lints: bool = ("Pass `[lints]` to the linting tools"), + target_applies_to_host: bool = ("Enable the `target-applies-to-host` key in the .cargo/config.toml file"), + unstable_options: bool = ("Allow the usage of unstable options"), ); const STABILIZED_COMPILE_PROGRESS: &str = "The progress bar is now always \ @@ -779,6 +799,9 @@ const STABILIZED_NAMED_PROFILES: &str = "The named-profiles feature is now alway See https://doc.rust-lang.org/nightly/cargo/reference/profiles.html#custom-profiles \ for more information"; +const STABILIZED_DOCTEST_IN_WORKSPACE: &str = + "The doctest-in-workspace feature is now always enabled."; + const STABILIZED_FUTURE_INCOMPAT_REPORT: &str = "The future-incompat-report feature is now always enabled."; @@ -1011,41 +1034,19 @@ impl CliUnstable { } match k { - "print-im-a-teapot" => self.print_im_a_teapot = parse_bool(k, v)?, + // Permanently unstable features + // Sorted alphabetically: "allow-features" => self.allow_features = Some(parse_features(v).into_iter().collect()), - "unstable-options" => self.unstable_options = parse_empty(k, v)?, - "no-index-update" => self.no_index_update = parse_empty(k, v)?, - "avoid-dev-deps" => self.avoid_dev_deps = parse_empty(k, v)?, - "minimal-versions" => self.minimal_versions = parse_empty(k, v)?, - "direct-minimal-versions" => self.direct_minimal_versions = parse_empty(k, v)?, - "advanced-env" => self.advanced_env = parse_empty(k, v)?, - "config-include" => self.config_include = parse_empty(k, v)?, - "check-cfg" => { - self.check_cfg = v.map_or(Ok(None), |v| parse_check_cfg(v.split(',')))? - } - "dual-proc-macros" => self.dual_proc_macros = parse_empty(k, v)?, - // can also be set in .cargo/config or with and ENV - "mtime-on-use" => self.mtime_on_use = parse_empty(k, v)?, - "named-profiles" => stabilized_warn(k, "1.57", STABILIZED_NAMED_PROFILES), - "binary-dep-depinfo" => self.binary_dep_depinfo = parse_empty(k, v)?, - "bindeps" => self.bindeps = parse_empty(k, v)?, - "build-std" => { - self.build_std = Some(crate::core::compiler::standard_lib::parse_unstable_flag(v)) - } - "build-std-features" => self.build_std_features = Some(parse_features(v)), - "doctest-xcompile" => self.doctest_xcompile = parse_empty(k, v)?, - "doctest-in-workspace" => self.doctest_in_workspace = parse_empty(k, v)?, - "panic-abort-tests" => self.panic_abort_tests = parse_empty(k, v)?, - "jobserver-per-rustc" => self.jobserver_per_rustc = parse_empty(k, v)?, - "gitoxide" => { - self.gitoxide = v.map_or_else( - || Ok(Some(GitoxideFeatures::all())), - |v| parse_gitoxide(v.split(',')), - )? - } - "host-config" => self.host_config = parse_empty(k, v)?, - "target-applies-to-host" => self.target_applies_to_host = parse_empty(k, v)?, - "publish-timeout" => self.publish_timeout = parse_empty(k, v)?, + "print-im-a-teapot" => self.print_im_a_teapot = parse_bool(k, v)?, + + // Stabilized features + // Sorted by version, then alphabetically: + "compile-progress" => stabilized_warn(k, "1.30", STABILIZED_COMPILE_PROGRESS), + "offline" => stabilized_err(k, "1.36", STABILIZED_OFFLINE)?, + "cache-messages" => stabilized_warn(k, "1.40", STABILIZED_CACHE_MESSAGES), + "install-upgrade" => stabilized_warn(k, "1.41", STABILIZED_INSTALL_UPGRADE), + "config-profile" => stabilized_warn(k, "1.43", STABILIZED_CONFIG_PROFILE), + "crate-versions" => stabilized_warn(k, "1.47", STABILIZED_CRATE_VERSIONS), "features" => { // `-Z features` has been stabilized since 1.51, // but `-Z features=compare` is still allowed for convenience @@ -1067,35 +1068,66 @@ impl CliUnstable { } self.features = Some(feats); } - "separate-nightlies" => self.separate_nightlies = parse_empty(k, v)?, - "multitarget" => stabilized_warn(k, "1.64", STABILISED_MULTITARGET), - "rustdoc-map" => self.rustdoc_map = parse_empty(k, v)?, - "terminal-width" => stabilized_warn(k, "1.68", STABILIZED_TERMINAL_WIDTH), - "sparse-registry" => stabilized_warn(k, "1.68", STABILISED_SPARSE_REGISTRY), - "registry-auth" => self.registry_auth = parse_empty(k, v)?, - "namespaced-features" => stabilized_warn(k, "1.60", STABILISED_NAMESPACED_FEATURES), - "weak-dep-features" => stabilized_warn(k, "1.60", STABILIZED_WEAK_DEP_FEATURES), - "credential-process" => self.credential_process = parse_empty(k, v)?, - "rustdoc-scrape-examples" => self.rustdoc_scrape_examples = parse_empty(k, v)?, - "skip-rustdoc-fingerprint" => self.skip_rustdoc_fingerprint = parse_empty(k, v)?, - "compile-progress" => stabilized_warn(k, "1.30", STABILIZED_COMPILE_PROGRESS), - "offline" => stabilized_err(k, "1.36", STABILIZED_OFFLINE)?, - "cache-messages" => stabilized_warn(k, "1.40", STABILIZED_CACHE_MESSAGES), - "install-upgrade" => stabilized_warn(k, "1.41", STABILIZED_INSTALL_UPGRADE), - "config-profile" => stabilized_warn(k, "1.43", STABILIZED_CONFIG_PROFILE), - "crate-versions" => stabilized_warn(k, "1.47", STABILIZED_CRATE_VERSIONS), "package-features" => stabilized_warn(k, "1.51", STABILIZED_PACKAGE_FEATURES), - "extra-link-arg" => stabilized_warn(k, "1.56", STABILIZED_EXTRA_LINK_ARG), "configurable-env" => stabilized_warn(k, "1.56", STABILIZED_CONFIGURABLE_ENV), + "extra-link-arg" => stabilized_warn(k, "1.56", STABILIZED_EXTRA_LINK_ARG), "patch-in-config" => stabilized_warn(k, "1.56", STABILIZED_PATCH_IN_CONFIG), + "named-profiles" => stabilized_warn(k, "1.57", STABILIZED_NAMED_PROFILES), "future-incompat-report" => { stabilized_warn(k, "1.59.0", STABILIZED_FUTURE_INCOMPAT_REPORT) } + "namespaced-features" => stabilized_warn(k, "1.60", STABILISED_NAMESPACED_FEATURES), "timings" => stabilized_warn(k, "1.60", STABILIZED_TIMINGS), + "weak-dep-features" => stabilized_warn(k, "1.60", STABILIZED_WEAK_DEP_FEATURES), + "multitarget" => stabilized_warn(k, "1.64", STABILISED_MULTITARGET), + "sparse-registry" => stabilized_warn(k, "1.68", STABILISED_SPARSE_REGISTRY), + "terminal-width" => stabilized_warn(k, "1.68", STABILIZED_TERMINAL_WIDTH), + "doctest-in-workspace" => stabilized_warn(k, "1.72", STABILIZED_DOCTEST_IN_WORKSPACE), + + // Unstable features + // Sorted alphabetically: + "advanced-env" => self.advanced_env = parse_empty(k, v)?, + "avoid-dev-deps" => self.avoid_dev_deps = parse_empty(k, v)?, + "binary-dep-depinfo" => self.binary_dep_depinfo = parse_empty(k, v)?, + "bindeps" => self.bindeps = parse_empty(k, v)?, + "build-std" => { + self.build_std = Some(crate::core::compiler::standard_lib::parse_unstable_flag(v)) + } + "build-std-features" => self.build_std_features = Some(parse_features(v)), + "check-cfg" => { + self.check_cfg = v.map_or(Ok(None), |v| parse_check_cfg(v.split(',')))? + } "codegen-backend" => self.codegen_backend = parse_empty(k, v)?, - "profile-rustflags" => self.profile_rustflags = parse_empty(k, v)?, - "msrv-policy" => self.msrv_policy = parse_empty(k, v)?, + "config-include" => self.config_include = parse_empty(k, v)?, + "credential-process" => self.credential_process = parse_empty(k, v)?, + "direct-minimal-versions" => self.direct_minimal_versions = parse_empty(k, v)?, + "doctest-xcompile" => self.doctest_xcompile = parse_empty(k, v)?, + "dual-proc-macros" => self.dual_proc_macros = parse_empty(k, v)?, + "gitoxide" => { + self.gitoxide = v.map_or_else( + || Ok(Some(GitoxideFeatures::all())), + |v| parse_gitoxide(v.split(',')), + )? + } + "host-config" => self.host_config = parse_empty(k, v)?, "lints" => self.lints = parse_empty(k, v)?, + "next-lockfile-bump" => self.next_lockfile_bump = parse_empty(k, v)?, + "minimal-versions" => self.minimal_versions = parse_empty(k, v)?, + "msrv-policy" => self.msrv_policy = parse_empty(k, v)?, + // can also be set in .cargo/config or with and ENV + "mtime-on-use" => self.mtime_on_use = parse_empty(k, v)?, + "no-index-update" => self.no_index_update = parse_empty(k, v)?, + "panic-abort-tests" => self.panic_abort_tests = parse_empty(k, v)?, + "profile-rustflags" => self.profile_rustflags = parse_empty(k, v)?, + "publish-timeout" => self.publish_timeout = parse_empty(k, v)?, + "registry-auth" => self.registry_auth = parse_empty(k, v)?, + "rustdoc-map" => self.rustdoc_map = parse_empty(k, v)?, + "rustdoc-scrape-examples" => self.rustdoc_scrape_examples = parse_empty(k, v)?, + "separate-nightlies" => self.separate_nightlies = parse_empty(k, v)?, + "skip-rustdoc-fingerprint" => self.skip_rustdoc_fingerprint = parse_empty(k, v)?, + "script" => self.script = parse_empty(k, v)?, + "target-applies-to-host" => self.target_applies_to_host = parse_empty(k, v)?, + "unstable-options" => self.unstable_options = parse_empty(k, v)?, _ => bail!("unknown `-Z` flag specified: {}", k), } diff --git a/src/tools/cargo/src/cargo/core/manifest.rs b/src/tools/cargo/src/cargo/core/manifest.rs index 98498ead8..5d46a7e06 100644 --- a/src/tools/cargo/src/cargo/core/manifest.rs +++ b/src/tools/cargo/src/cargo/core/manifest.rs @@ -64,6 +64,7 @@ pub struct Manifest { metabuild: Option>, resolve_behavior: Option, lint_rustflags: Vec, + embedded: bool, } /// When parsing `Cargo.toml`, some warnings should silenced @@ -407,6 +408,7 @@ impl Manifest { metabuild: Option>, resolve_behavior: Option, lint_rustflags: Vec, + embedded: bool, ) -> Manifest { Manifest { summary, @@ -433,6 +435,7 @@ impl Manifest { metabuild, resolve_behavior, lint_rustflags, + embedded, } } @@ -500,6 +503,9 @@ impl Manifest { pub fn links(&self) -> Option<&str> { self.links.as_deref() } + pub fn is_embedded(&self) -> bool { + self.embedded + } pub fn workspace_config(&self) -> &WorkspaceConfig { &self.workspace diff --git a/src/tools/cargo/src/cargo/core/package.rs b/src/tools/cargo/src/cargo/core/package.rs index 40ba9cdf8..f4ab448d2 100644 --- a/src/tools/cargo/src/cargo/core/package.rs +++ b/src/tools/cargo/src/cargo/core/package.rs @@ -10,10 +10,10 @@ use std::time::{Duration, Instant}; use anyhow::Context; use bytesize::ByteSize; -use curl::easy::{Easy, HttpVersion}; +use curl::easy::Easy; use curl::multi::{EasyHandle, Multi}; use lazycell::LazyCell; -use log::{debug, warn}; +use log::debug; use semver::Version; use serde::Serialize; @@ -24,10 +24,11 @@ use crate::core::resolver::{HasDevUnits, Resolve}; use crate::core::source::MaybePackage; use crate::core::{Dependency, Manifest, PackageId, SourceId, Target}; use crate::core::{SourceMap, Summary, Workspace}; -use crate::ops; use crate::util::config::PackageCacheLock; use crate::util::errors::{CargoResult, HttpNotSuccessful, DEBUG_HEADERS}; use crate::util::interning::InternedString; +use crate::util::network::http::http_handle_and_timeout; +use crate::util::network::http::HttpTimeout; use crate::util::network::retry::{Retry, RetryResult}; use crate::util::network::sleep::SleepTracker; use crate::util::{self, internal, Config, Progress, ProgressStyle}; @@ -348,7 +349,7 @@ pub struct Downloads<'a, 'cfg> { /// Note that timeout management is done manually here instead of in libcurl /// because we want to apply timeouts to an entire batch of operations, not /// any one particular single operation. - timeout: ops::HttpTimeout, + timeout: HttpTimeout, /// Last time bytes were received. updated_at: Cell, /// This is a slow-speed check. It is reset to `now + timeout_duration` @@ -441,7 +442,7 @@ impl<'cfg> PackageSet<'cfg> { pub fn enable_download<'a>(&'a self) -> CargoResult> { assert!(!self.downloading.replace(true)); - let timeout = ops::HttpTimeout::new(self.config)?; + let timeout = HttpTimeout::new(self.config)?; Ok(Downloads { start: Instant::now(), set: self, @@ -713,7 +714,7 @@ impl<'a, 'cfg> Downloads<'a, 'cfg> { debug!("downloading {} as {}", id, token); assert!(self.pending_ids.insert(id)); - let (mut handle, _timeout) = ops::http_handle_and_timeout(self.set.config)?; + let (mut handle, _timeout) = http_handle_and_timeout(self.set.config)?; handle.get(true)?; handle.url(&url)?; handle.follow_location(true)?; // follow redirects @@ -725,32 +726,8 @@ impl<'a, 'cfg> Downloads<'a, 'cfg> { handle.http_headers(headers)?; } - // Enable HTTP/2 to be used as it'll allow true multiplexing which makes - // downloads much faster. - // - // Currently Cargo requests the `http2` feature of the `curl` crate - // which means it should always be built in. On OSX, however, we ship - // cargo still linked against the system libcurl. Building curl with - // ALPN support for HTTP/2 requires newer versions of OSX (the - // SecureTransport API) than we want to ship Cargo for. By linking Cargo - // against the system libcurl then older curl installations won't use - // HTTP/2 but newer ones will. All that to basically say we ignore - // errors here on OSX, but consider this a fatal error to not activate - // HTTP/2 on all other platforms. - if self.set.multiplexing { - crate::try_old_curl!(handle.http_version(HttpVersion::V2), "HTTP2"); - } else { - handle.http_version(HttpVersion::V11)?; - } - - // This is an option to `libcurl` which indicates that if there's a - // bunch of parallel requests to the same host they all wait until the - // pipelining status of the host is known. This means that we won't - // initiate dozens of connections to crates.io, but rather only one. - // Once the main one is opened we realized that pipelining is possible - // and multiplexing is possible with static.crates.io. All in all this - // reduces the number of connections down to a more manageable state. - crate::try_old_curl!(handle.pipewait(true), "pipewait"); + // Enable HTTP/2 if possible. + crate::try_old_curl_http2_pipewait!(self.set.multiplexing, handle); handle.write_function(move |buf| { debug!("{} - {} bytes of data", token, buf.len()); diff --git a/src/tools/cargo/src/cargo/core/package_id.rs b/src/tools/cargo/src/cargo/core/package_id.rs index ee31e9c48..e17a73e68 100644 --- a/src/tools/cargo/src/cargo/core/package_id.rs +++ b/src/tools/cargo/src/cargo/core/package_id.rs @@ -5,6 +5,7 @@ use std::hash::Hash; use std::path::Path; use std::ptr; use std::sync::Mutex; +use std::sync::OnceLock; use serde::de; use serde::ser; @@ -13,10 +14,7 @@ use crate::core::source::SourceId; use crate::util::interning::InternedString; use crate::util::{CargoResult, ToSemver}; -lazy_static::lazy_static! { - static ref PACKAGE_ID_CACHE: Mutex> = - Mutex::new(HashSet::new()); -} +static PACKAGE_ID_CACHE: OnceLock>> = OnceLock::new(); /// Identifier for a specific version of a package in a specific source. #[derive(Clone, Copy, Eq, PartialOrd, Ord)] @@ -147,7 +145,10 @@ impl PackageId { version, source_id, }; - let mut cache = PACKAGE_ID_CACHE.lock().unwrap(); + let mut cache = PACKAGE_ID_CACHE + .get_or_init(|| Default::default()) + .lock() + .unwrap(); let inner = cache.get(&inner).cloned().unwrap_or_else(|| { let inner = Box::leak(Box::new(inner)); cache.insert(inner); @@ -195,6 +196,11 @@ impl PackageId { pub fn stable_hash(self, workspace: &Path) -> PackageIdStableHash<'_> { PackageIdStableHash(self, workspace) } + + /// Filename of the `.crate` tarball, e.g., `once_cell-1.18.0.crate`. + pub fn tarball_name(&self) -> String { + format!("{}-{}.crate", self.name(), self.version()) + } } pub struct PackageIdStableHash<'a>(PackageId, &'a Path); diff --git a/src/tools/cargo/src/cargo/core/profiles.rs b/src/tools/cargo/src/cargo/core/profiles.rs index 3831f18c2..5c7d3e248 100644 --- a/src/tools/cargo/src/cargo/core/profiles.rs +++ b/src/tools/cargo/src/cargo/core/profiles.rs @@ -1,4 +1,4 @@ -//! # Profiles: built-in and customizable compiler flag presets +//! Handles built-in and customizable compiler flag presets. //! //! [`Profiles`] is a collections of built-in profiles, and profiles defined //! in the root manifest and configurations. @@ -449,9 +449,7 @@ impl ProfileMaker { // a unit is shared. If that's the case, we'll use the deferred value // below so the unit can be reused, otherwise we can avoid emitting // the unit's debuginfo. - if let Some(debuginfo) = profile.debuginfo.to_option() { - profile.debuginfo = DebugInfo::Deferred(debuginfo); - } + profile.debuginfo = DebugInfo::Deferred(profile.debuginfo.into_inner()); } // ... and next comes any other sorts of overrides specified in // profiles, such as `[profile.release.build-override]` or @@ -529,7 +527,7 @@ fn merge_profile(profile: &mut Profile, toml: &TomlProfile) { profile.codegen_units = toml.codegen_units; } if let Some(debuginfo) = toml.debug { - profile.debuginfo = DebugInfo::Explicit(debuginfo); + profile.debuginfo = DebugInfo::Resolved(debuginfo); } if let Some(debug_assertions) = toml.debug_assertions { profile.debug_assertions = debug_assertions; @@ -611,7 +609,7 @@ impl Default for Profile { lto: Lto::Bool(false), codegen_backend: None, codegen_units: None, - debuginfo: DebugInfo::None, + debuginfo: DebugInfo::Resolved(TomlDebugInfo::None), debug_assertions: false, split_debuginfo: None, overflow_checks: false, @@ -680,7 +678,7 @@ impl Profile { Profile { name: InternedString::new("dev"), root: ProfileRoot::Debug, - debuginfo: DebugInfo::Explicit(TomlDebugInfo::Full), + debuginfo: DebugInfo::Resolved(TomlDebugInfo::Full), debug_assertions: true, overflow_checks: true, incremental: true, @@ -720,11 +718,8 @@ impl Profile { /// The debuginfo level setting. /// -/// This is semantically an `Option`, and should be used as so via the -/// [DebugInfo::to_option] method for all intents and purposes: -/// - `DebugInfo::None` corresponds to `None` -/// - `DebugInfo::Explicit(u32)` and `DebugInfo::Deferred` correspond to -/// `Option::Some` +/// This is semantically a [`TomlDebugInfo`], and should be used as so via the +/// [`DebugInfo::into_inner`] method for all intents and purposes. /// /// Internally, it's used to model a debuginfo level whose value can be deferred /// for optimization purposes: host dependencies usually don't need the same @@ -736,35 +731,34 @@ impl Profile { #[derive(Debug, Copy, Clone, serde::Serialize)] #[serde(untagged)] pub enum DebugInfo { - /// No debuginfo level was set. - None, - /// A debuginfo level that is explicitly set, by a profile or a user. - Explicit(TomlDebugInfo), + /// A debuginfo level that is fixed and will not change. + /// + /// This can be set by a profile, user, or default value. + Resolved(TomlDebugInfo), /// For internal purposes: a deferred debuginfo level that can be optimized /// away, but has this value otherwise. /// - /// Behaves like `Explicit` in all situations except for the default build + /// Behaves like `Resolved` in all situations except for the default build /// dependencies profile: whenever a build dependency is not shared with /// runtime dependencies, this level is weakened to a lower level that is - /// faster to build (see [DebugInfo::weaken]). + /// faster to build (see [`DebugInfo::weaken`]). /// /// In all other situations, this level value will be the one to use. Deferred(TomlDebugInfo), } impl DebugInfo { - /// The main way to interact with this debuginfo level, turning it into an Option. - pub fn to_option(self) -> Option { + /// The main way to interact with this debuginfo level, turning it into a [`TomlDebugInfo`]. + pub fn into_inner(self) -> TomlDebugInfo { match self { - DebugInfo::None => None, - DebugInfo::Explicit(v) | DebugInfo::Deferred(v) => Some(v), + DebugInfo::Resolved(v) | DebugInfo::Deferred(v) => v, } } /// Returns true if any debuginfo will be generated. Helper /// for a common operation on the usual `Option` representation. pub(crate) fn is_turned_on(&self) -> bool { - !matches!(self.to_option(), None | Some(TomlDebugInfo::None)) + !matches!(self.into_inner(), TomlDebugInfo::None) } pub(crate) fn is_deferred(&self) -> bool { @@ -774,24 +768,20 @@ impl DebugInfo { /// Force the deferred, preferred, debuginfo level to a finalized explicit value. pub(crate) fn finalize(self) -> Self { match self { - DebugInfo::Deferred(v) => DebugInfo::Explicit(v), + DebugInfo::Deferred(v) => DebugInfo::Resolved(v), _ => self, } } /// Reset to the lowest level: no debuginfo. - /// If it is explicitly set, keep it explicit. pub(crate) fn weaken(self) -> Self { - match self { - DebugInfo::None => DebugInfo::None, - _ => DebugInfo::Explicit(TomlDebugInfo::None), - } + DebugInfo::Resolved(TomlDebugInfo::None) } } impl PartialEq for DebugInfo { fn eq(&self, other: &DebugInfo) -> bool { - self.to_option().eq(&other.to_option()) + self.into_inner().eq(&other.into_inner()) } } @@ -799,19 +789,19 @@ impl Eq for DebugInfo {} impl Hash for DebugInfo { fn hash(&self, state: &mut H) { - self.to_option().hash(state); + self.into_inner().hash(state); } } impl PartialOrd for DebugInfo { fn partial_cmp(&self, other: &Self) -> Option { - self.to_option().partial_cmp(&other.to_option()) + self.into_inner().partial_cmp(&other.into_inner()) } } impl Ord for DebugInfo { fn cmp(&self, other: &Self) -> std::cmp::Ordering { - self.to_option().cmp(&other.to_option()) + self.into_inner().cmp(&other.into_inner()) } } diff --git a/src/tools/cargo/src/cargo/core/resolver/encode.rs b/src/tools/cargo/src/cargo/core/resolver/encode.rs index 88d0d8296..f73d023b1 100644 --- a/src/tools/cargo/src/cargo/core/resolver/encode.rs +++ b/src/tools/cargo/src/cargo/core/resolver/encode.rs @@ -154,10 +154,18 @@ impl EncodableResolve { /// primary uses is to be used with `resolve_with_previous` to guide the /// resolver to create a complete Resolve. pub fn into_resolve(self, original: &str, ws: &Workspace<'_>) -> CargoResult { + let unstable_lockfile_version_allowed = ws.config().cli_unstable().next_lockfile_bump; let path_deps = build_path_deps(ws)?; let mut checksums = HashMap::new(); let mut version = match self.version { + Some(4) if ws.config().nightly_features_allowed => { + if unstable_lockfile_version_allowed { + ResolveVersion::V4 + } else { + anyhow::bail!("lock file version 4 requires `-Znext-lockfile-bump`"); + } + } Some(3) => ResolveVersion::V3, Some(n) => bail!( "lock file version `{}` was found, but this version of Cargo \ @@ -612,6 +620,7 @@ impl ser::Serialize for Resolve { metadata, patch, version: match self.version() { + ResolveVersion::V4 => Some(4), ResolveVersion::V3 => Some(3), ResolveVersion::V2 | ResolveVersion::V1 => None, }, diff --git a/src/tools/cargo/src/cargo/core/resolver/features.rs b/src/tools/cargo/src/cargo/core/resolver/features.rs index 6b79722ca..3670e8711 100644 --- a/src/tools/cargo/src/cargo/core/resolver/features.rs +++ b/src/tools/cargo/src/cargo/core/resolver/features.rs @@ -1,4 +1,4 @@ -//! # Feature resolver +//! Resolves conditional compilation for [`features` section] in the manifest. //! //! This is a [new feature resolver] that runs independently of the main //! dependency resolver. It has several options which can enable new feature @@ -34,6 +34,7 @@ //! //! There are probably other assumptions that I am forgetting. //! +//! [`features` section]: https://doc.rust-lang.org/nightly/cargo/reference/features.html //! [new feature resolver]: https://doc.rust-lang.org/nightly/cargo/reference/resolver.html#feature-resolver-version-2 //! [`resolve_ws_with_opts`]: crate::ops::resolve_ws_with_opts diff --git a/src/tools/cargo/src/cargo/core/resolver/resolve.rs b/src/tools/cargo/src/cargo/core/resolver/resolve.rs index 6ab957e92..8405a1245 100644 --- a/src/tools/cargo/src/cargo/core/resolver/resolve.rs +++ b/src/tools/cargo/src/cargo/core/resolver/resolve.rs @@ -80,6 +80,10 @@ pub enum ResolveVersion { /// V3 by default staring in 1.53. #[default] V3, + /// Unstable. Will collect a certain amount of changes and then go. + /// + /// Changes made: + V4, } impl Resolve { diff --git a/src/tools/cargo/src/cargo/core/resolver/version_prefs.rs b/src/tools/cargo/src/cargo/core/resolver/version_prefs.rs index 002f11ff8..bf26d0498 100644 --- a/src/tools/cargo/src/cargo/core/resolver/version_prefs.rs +++ b/src/tools/cargo/src/cargo/core/resolver/version_prefs.rs @@ -81,7 +81,6 @@ impl VersionPreferences { mod test { use super::*; use crate::core::SourceId; - use crate::util::Config; use std::collections::BTreeMap; fn pkgid(name: &str, version: &str) -> PackageId { @@ -98,10 +97,8 @@ mod test { fn summ(name: &str, version: &str) -> Summary { let pkg_id = pkgid(name, version); - let config = Config::default().unwrap(); let features = BTreeMap::new(); Summary::new( - &config, pkg_id, Vec::new(), &features, diff --git a/src/tools/cargo/src/cargo/core/shell.rs b/src/tools/cargo/src/cargo/core/shell.rs index f74bde257..4d45e6098 100644 --- a/src/tools/cargo/src/cargo/core/shell.rs +++ b/src/tools/cargo/src/cargo/core/shell.rs @@ -1,7 +1,7 @@ use std::fmt; use std::io::prelude::*; +use std::io::IsTerminal; -use is_terminal::IsTerminal; use termcolor::Color::{Cyan, Green, Red, Yellow}; use termcolor::{self, Color, ColorSpec, StandardStream, WriteColor}; diff --git a/src/tools/cargo/src/cargo/core/source/mod.rs b/src/tools/cargo/src/cargo/core/source/mod.rs index 6ca614d34..2d1db1d53 100644 --- a/src/tools/cargo/src/cargo/core/source/mod.rs +++ b/src/tools/cargo/src/cargo/core/source/mod.rs @@ -87,10 +87,25 @@ pub trait Source { /// If quiet, the source should not display any progress or status messages. fn set_quiet(&mut self, quiet: bool); - /// Fetches the full package for each name and version specified. + /// Starts the process to fetch a [`Package`] for the given [`PackageId`]. + /// + /// If the source already has the package available on disk, then it + /// should return immediately with [`MaybePackage::Ready`] with the + /// [`Package`]. Otherwise it should return a [`MaybePackage::Download`] + /// to indicate the URL to download the package (this is for remote + /// registry sources only). + /// + /// In the case where [`MaybePackage::Download`] is returned, then the + /// package downloader will call [`Source::finish_download`] after the + /// download has finished. fn download(&mut self, package: PackageId) -> CargoResult; - /// Fetches the full package **immediately** for each name and version specified. + /// Convenience method used to **immediately** fetch a [`Package`] for the + /// given [`PackageId`]. + /// + /// This may trigger a download if necessary. This should only be used + /// when a single package is needed (as in the case for `cargo install`). + /// Otherwise downloads should be batched together via [`PackageSet`]. fn download_now(self: Box, package: PackageId, config: &Config) -> CargoResult where Self: std::marker::Sized, @@ -102,7 +117,13 @@ pub trait Source { Ok(Package::clone(pkg)) } - /// Finalizes the download contents of the given [`PackageId`] to a [`Package`]. + /// Gives the source the downloaded `.crate` file. + /// + /// When a source has returned [`MaybePackage::Download`] in the + /// [`Source::download`] method, then this function will be called with + /// the results of the download of the given URL. The source is + /// responsible for saving to disk, and returning the appropriate + /// [`Package`]. fn finish_download(&mut self, pkg_id: PackageId, contents: Vec) -> CargoResult; /// Generates a unique string which represents the fingerprint of the diff --git a/src/tools/cargo/src/cargo/core/source/source_id.rs b/src/tools/cargo/src/cargo/core/source/source_id.rs index c369dab16..4064364d5 100644 --- a/src/tools/cargo/src/cargo/core/source/source_id.rs +++ b/src/tools/cargo/src/cargo/core/source/source_id.rs @@ -13,11 +13,10 @@ use std::hash::{self, Hash}; use std::path::{Path, PathBuf}; use std::ptr; use std::sync::Mutex; +use std::sync::OnceLock; use url::Url; -lazy_static::lazy_static! { - static ref SOURCE_ID_CACHE: Mutex> = Default::default(); -} +static SOURCE_ID_CACHE: OnceLock>> = OnceLock::new(); /// Unique identifier for a source of packages. /// @@ -118,7 +117,10 @@ impl SourceId { /// Interns the value and returns the wrapped type. fn wrap(inner: SourceIdInner) -> SourceId { - let mut cache = SOURCE_ID_CACHE.lock().unwrap(); + let mut cache = SOURCE_ID_CACHE + .get_or_init(|| Default::default()) + .lock() + .unwrap(); let inner = cache.get(&inner).cloned().unwrap_or_else(|| { let inner = Box::leak(Box::new(inner)); cache.insert(inner); diff --git a/src/tools/cargo/src/cargo/core/summary.rs b/src/tools/cargo/src/cargo/core/summary.rs index 2535c4482..1883df33b 100644 --- a/src/tools/cargo/src/cargo/core/summary.rs +++ b/src/tools/cargo/src/cargo/core/summary.rs @@ -1,6 +1,6 @@ use crate::core::{Dependency, PackageId, SourceId}; use crate::util::interning::InternedString; -use crate::util::{CargoResult, Config}; +use crate::util::CargoResult; use anyhow::bail; use semver::Version; use std::collections::{BTreeMap, HashMap, HashSet}; @@ -30,7 +30,6 @@ struct Inner { impl Summary { pub fn new( - config: &Config, pkg_id: PackageId, dependencies: Vec, features: &BTreeMap>, @@ -49,7 +48,7 @@ impl Summary { ) } } - let feature_map = build_feature_map(config, pkg_id, features, &dependencies)?; + let feature_map = build_feature_map(pkg_id, features, &dependencies)?; Ok(Summary { inner: Rc::new(Inner { package_id: pkg_id, @@ -140,7 +139,6 @@ impl Hash for Summary { /// Checks features for errors, bailing out a CargoResult:Err if invalid, /// and creates FeatureValues for each feature. fn build_feature_map( - config: &Config, pkg_id: PackageId, features: &BTreeMap>, dependencies: &[Dependency], @@ -204,7 +202,7 @@ fn build_feature_map( feature ); } - validate_feature_name(config, pkg_id, feature)?; + validate_feature_name(pkg_id, feature)?; for fv in fvs { // Find data for the referenced dependency... let dep_data = { @@ -431,33 +429,63 @@ impl fmt::Display for FeatureValue { pub type FeatureMap = BTreeMap>; -fn validate_feature_name(config: &Config, pkg_id: PackageId, name: &str) -> CargoResult<()> { +fn validate_feature_name(pkg_id: PackageId, name: &str) -> CargoResult<()> { let mut chars = name.chars(); - const FUTURE: &str = "This was previously accepted but is being phased out; \ - it will become a hard error in a future release.\n\ - For more information, see issue #8813 , \ - and please leave a comment if this will be a problem for your project."; if let Some(ch) = chars.next() { if !(unicode_xid::UnicodeXID::is_xid_start(ch) || ch == '_' || ch.is_digit(10)) { - config.shell().warn(&format!( + bail!( "invalid character `{}` in feature `{}` in package {}, \ the first character must be a Unicode XID start character or digit \ - (most letters or `_` or `0` to `9`)\n\ - {}", - ch, name, pkg_id, FUTURE - ))?; + (most letters or `_` or `0` to `9`)", + ch, + name, + pkg_id + ); } } for ch in chars { if !(unicode_xid::UnicodeXID::is_xid_continue(ch) || ch == '-' || ch == '+' || ch == '.') { - config.shell().warn(&format!( + bail!( "invalid character `{}` in feature `{}` in package {}, \ characters must be Unicode XID characters, `+`, or `.` \ - (numbers, `+`, `-`, `_`, `.`, or most letters)\n\ - {}", - ch, name, pkg_id, FUTURE - ))?; + (numbers, `+`, `-`, `_`, `.`, or most letters)", + ch, + name, + pkg_id + ); } } Ok(()) } + +#[cfg(test)] +mod tests { + use super::*; + use crate::sources::CRATES_IO_INDEX; + use crate::util::into_url::IntoUrl; + + use crate::core::SourceId; + + #[test] + fn valid_feature_names() { + let loc = CRATES_IO_INDEX.into_url().unwrap(); + let source_id = SourceId::for_registry(&loc).unwrap(); + let pkg_id = PackageId::new("foo", "1.0.0", source_id).unwrap(); + + assert!(validate_feature_name(pkg_id, "c++17").is_ok()); + assert!(validate_feature_name(pkg_id, "128bit").is_ok()); + assert!(validate_feature_name(pkg_id, "_foo").is_ok()); + assert!(validate_feature_name(pkg_id, "feat-name").is_ok()); + assert!(validate_feature_name(pkg_id, "feat_name").is_ok()); + assert!(validate_feature_name(pkg_id, "foo.bar").is_ok()); + + assert!(validate_feature_name(pkg_id, "+foo").is_err()); + assert!(validate_feature_name(pkg_id, "-foo").is_err()); + assert!(validate_feature_name(pkg_id, ".foo").is_err()); + assert!(validate_feature_name(pkg_id, "foo:bar").is_err()); + assert!(validate_feature_name(pkg_id, "foo?").is_err()); + assert!(validate_feature_name(pkg_id, "?foo").is_err()); + assert!(validate_feature_name(pkg_id, "ⒶⒷⒸ").is_err()); + assert!(validate_feature_name(pkg_id, "a¼").is_err()); + } +} diff --git a/src/tools/cargo/src/cargo/core/workspace.rs b/src/tools/cargo/src/cargo/core/workspace.rs index 9922d6d33..db9c18010 100644 --- a/src/tools/cargo/src/cargo/core/workspace.rs +++ b/src/tools/cargo/src/cargo/core/workspace.rs @@ -15,7 +15,7 @@ use crate::core::features::Features; use crate::core::registry::PackageRegistry; use crate::core::resolver::features::CliFeatures; use crate::core::resolver::ResolveBehavior; -use crate::core::{Dependency, FeatureValue, PackageId, PackageIdSpec}; +use crate::core::{Dependency, Edition, FeatureValue, PackageId, PackageIdSpec}; use crate::core::{EitherManifest, Package, SourceId, VirtualManifest}; use crate::ops; use crate::sources::{PathSource, CRATES_IO_INDEX, CRATES_IO_REGISTRY}; @@ -381,7 +381,21 @@ impl<'cfg> Workspace<'cfg> { pub fn target_dir(&self) -> Filesystem { self.target_dir .clone() - .unwrap_or_else(|| Filesystem::new(self.root().join("target"))) + .unwrap_or_else(|| self.default_target_dir()) + } + + fn default_target_dir(&self) -> Filesystem { + if self.root_maybe().is_embedded() { + let hash = crate::util::hex::short_hash(&self.root_manifest().to_string_lossy()); + let mut rel_path = PathBuf::new(); + rel_path.push("target"); + rel_path.push(&hash[0..2]); + rel_path.push(&hash[2..]); + + self.config().home().join(rel_path) + } else { + Filesystem::new(self.root().join("target")) + } } /// Returns the root `[replace]` section of this workspace. @@ -726,6 +740,10 @@ impl<'cfg> Workspace<'cfg> { if self.members.contains(&manifest_path) { return Ok(()); } + if is_path_dep && self.root_maybe().is_embedded() { + // Embedded manifests cannot have workspace members + return Ok(()); + } if is_path_dep && !manifest_path.parent().unwrap().starts_with(self.root()) && self.find_root(&manifest_path)? != self.root_manifest @@ -993,6 +1011,24 @@ impl<'cfg> Workspace<'cfg> { } } } + if let MaybePackage::Virtual(vm) = self.root_maybe() { + if vm.resolve_behavior().is_none() { + if let Some(edition) = self + .members() + .filter(|p| p.manifest_path() != root_manifest) + .map(|p| p.manifest().edition()) + .filter(|&e| e >= Edition::Edition2021) + .max() + { + let resolver = edition.default_resolve_behavior().to_manifest(); + self.config.shell().warn(format_args!("some crates are on edition {edition} which defaults to `resolver = \"{resolver}\"`, but virtual workspaces default to `resolver = \"1\"`"))?; + self.config.shell().note( + "to keep the current resolver, specify `workspace.resolver = \"1\"` in the workspace root's manifest", + )?; + self.config.shell().note(format_args!("to use the edition {edition} resolver, specify `workspace.resolver = \"{resolver}\"` in the workspace root's manifest"))?; + } + } + } } Ok(()) } @@ -1562,6 +1598,14 @@ impl MaybePackage { MaybePackage::Virtual(ref vm) => vm.workspace_config(), } } + + /// Has an embedded manifest (single-file package) + pub fn is_embedded(&self) -> bool { + match self { + MaybePackage::Package(p) => p.manifest().is_embedded(), + MaybePackage::Virtual(_) => false, + } + } } impl WorkspaceRootConfig { diff --git a/src/tools/cargo/src/cargo/lib.rs b/src/tools/cargo/src/cargo/lib.rs index 31d03ad25..a03d51199 100644 --- a/src/tools/cargo/src/cargo/lib.rs +++ b/src/tools/cargo/src/cargo/lib.rs @@ -6,6 +6,9 @@ #![allow(clippy::all)] #![warn(clippy::disallowed_methods)] #![warn(clippy::self_named_module_files)] +#![warn(clippy::print_stdout)] +#![warn(clippy::print_stderr)] +#![warn(clippy::dbg_macro)] #![allow(rustdoc::private_intra_doc_links)] //! # Cargo as a library diff --git a/src/tools/cargo/src/cargo/ops/cargo_clean.rs b/src/tools/cargo/src/cargo/ops/cargo_clean.rs index de3139c99..b9b33690e 100644 --- a/src/tools/cargo/src/cargo/ops/cargo_clean.rs +++ b/src/tools/cargo/src/cargo/ops/cargo_clean.rs @@ -297,7 +297,12 @@ fn rm_rf(path: &Path, config: &Config, progress: &mut dyn CleaningProgressBar) - let entry = entry?; progress.on_clean()?; if entry.file_type().is_dir() { - paths::remove_dir(entry.path()).with_context(|| "could not remove build directory")?; + // The contents should have been removed by now, but sometimes a race condition is hit + // where other files have been added by the OS. `paths::remove_dir_all` also falls back + // to `std::fs::remove_dir_all`, which may be more reliable than a simple walk in + // platform-specific edge cases. + paths::remove_dir_all(entry.path()) + .with_context(|| "could not remove build directory")?; } else { paths::remove_file(entry.path()).with_context(|| "failed to remove build artifact")?; } diff --git a/src/tools/cargo/src/cargo/ops/cargo_compile/mod.rs b/src/tools/cargo/src/cargo/ops/cargo_compile/mod.rs index 3b6043d4f..f53a9e934 100644 --- a/src/tools/cargo/src/cargo/ops/cargo_compile/mod.rs +++ b/src/tools/cargo/src/cargo/ops/cargo_compile/mod.rs @@ -1,7 +1,5 @@ -//! # The Cargo "compile" operation -//! -//! This module contains the entry point for starting the compilation process -//! for commands like `build`, `test`, `doc`, `rustc`, etc. +//! The entry point for starting the compilation process for commands like +//! `build`, `test`, `doc`, `rustc`, etc. //! //! The [`compile`] function will do all the work to compile a workspace. A //! rough outline is: diff --git a/src/tools/cargo/src/cargo/ops/cargo_fetch.rs b/src/tools/cargo/src/cargo/ops/cargo_fetch.rs index bac3f0278..273bce284 100644 --- a/src/tools/cargo/src/cargo/ops/cargo_fetch.rs +++ b/src/tools/cargo/src/cargo/ops/cargo_fetch.rs @@ -2,6 +2,7 @@ use crate::core::compiler::standard_lib; use crate::core::compiler::{BuildConfig, CompileMode, RustcTargetData}; use crate::core::{PackageSet, Resolve, Workspace}; use crate::ops; +use crate::util::config::JobsConfig; use crate::util::CargoResult; use crate::util::Config; use std::collections::HashSet; @@ -20,7 +21,7 @@ pub fn fetch<'a>( ws.emit_warnings()?; let (mut packages, resolve) = ops::resolve_ws(ws)?; - let jobs = Some(1); + let jobs = Some(JobsConfig::Integer(1)); let keep_going = false; let config = ws.config(); let build_config = BuildConfig::new( diff --git a/src/tools/cargo/src/cargo/ops/cargo_install.rs b/src/tools/cargo/src/cargo/ops/cargo_install.rs index 5f843e8c7..8ddfa4fab 100644 --- a/src/tools/cargo/src/cargo/ops/cargo_install.rs +++ b/src/tools/cargo/src/cargo/ops/cargo_install.rs @@ -320,7 +320,9 @@ impl<'cfg, 'a> InstallablePackage<'cfg, 'a> { format!( "failed to compile `{}`, intermediate artifacts can be \ - found at `{}`", + found at `{}`.\nTo reuse those artifacts with a future \ + compilation, set the environment variable \ + `CARGO_TARGET_DIR` to that path.", self.pkg, self.ws.target_dir().display() ) diff --git a/src/tools/cargo/src/cargo/ops/cargo_new.rs b/src/tools/cargo/src/cargo/ops/cargo_new.rs index 697798c0c..b113671b0 100644 --- a/src/tools/cargo/src/cargo/ops/cargo_new.rs +++ b/src/tools/cargo/src/cargo/ops/cargo_new.rs @@ -163,6 +163,7 @@ fn get_name<'a>(path: &'a Path, opts: &'a NewOptions) -> CargoResult<&'a str> { }) } +/// See also `util::toml::embedded::sanitize_name` fn check_name( name: &str, show_name_help: bool, @@ -820,6 +821,18 @@ fn mk(config: &Config, opts: &MkOptions<'_>) -> CargoResult<()> { workspace_package_keys, ) } + + // Try to inherit the workspace lints key if it exists. + if config.cli_unstable().lints + && workspace_document + .get("workspace") + .and_then(|workspace| workspace.get("lints")) + .is_some() + { + let mut table = toml_edit::Table::new(); + table["workspace"] = toml_edit::value(true); + manifest["lints"] = toml_edit::Item::Table(table); + } } } diff --git a/src/tools/cargo/src/cargo/ops/cargo_package.rs b/src/tools/cargo/src/cargo/ops/cargo_package.rs index f80848c75..a322afbb3 100644 --- a/src/tools/cargo/src/cargo/ops/cargo_package.rs +++ b/src/tools/cargo/src/cargo/ops/cargo_package.rs @@ -13,6 +13,7 @@ use crate::core::{registry::PackageRegistry, resolver::HasDevUnits}; use crate::core::{Feature, Shell, Verbosity, Workspace}; use crate::core::{Package, PackageId, PackageSet, Resolve, SourceId}; use crate::sources::PathSource; +use crate::util::config::JobsConfig; use crate::util::errors::CargoResult; use crate::util::toml::TomlManifest; use crate::util::{self, human_readable_bytes, restricted_names, Config, FileLock}; @@ -31,7 +32,7 @@ pub struct PackageOpts<'cfg> { pub check_metadata: bool, pub allow_dirty: bool, pub verify: bool, - pub jobs: Option, + pub jobs: Option, pub keep_going: bool, pub to_package: ops::Packages, pub targets: Vec, @@ -126,7 +127,7 @@ pub fn package_one( super::check_dep_has_version(dep, false)?; } - let filename = format!("{}-{}.crate", pkg.name(), pkg.version()); + let filename = pkg.package_id().tarball_name(); let dir = ws.target_dir().join("package"); let mut dst = { let tmp = format!(".{}", filename); @@ -198,7 +199,7 @@ pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult