6712 Commits

Author SHA1 Message Date
bors
3c4c0a2b3c Auto merge of #14688 - weihanglo:git-cli, r=epage
fix(git): dont fetch tags by default

### What does this PR try to resolve?

Change Cargo to pass [`--no-tags`] Git CLI option by default. This aligns with how libgit2 works in Cargo.

Based on the Git official doc,
the flag has been there since at least 2.0.5

[`--no-tags`]: https://git-scm.com/docs/git-fetch/2.0.5#Documentation/git-fetch.txt---no-tags

### How should we test and review this PR?

Not sure if we want a test for this.
`CARGO_NET_GIT_FETCH_WITH_CLI` is barely tested.

### Additional information

Fixes #14687
2024-10-15 04:26:53 +00:00
Weihang Lo
1975c3ca53
fix(git): dont fetch tags by default
Change Cargo to pass [`--no-tags`] Git CLI option by default.
This aligns with how libgit2 works in Cargo.

Based on the Git official doc,
the flag has been there since at least 2.0.5

[`--no-tags`]: https://git-scm.com/docs/git-fetch/2.0.5#Documentation/git-fetch.txt---no-tags
2024-10-14 23:54:48 -04:00
bors
5b220de42b Auto merge of #14659 - tweag:publish-workspace-cli-args, r=weihanglo
Support package selection options like `--exclude` in `cargo publish`

Fixes #14652.

Is there a way to make the help text depend on whether nightly/unstable features are enabled? I couldn't find one...
2024-10-15 03:51:32 +00:00
Ralf Jung
2791c127f4 cargo ... --help: clarify --tests and --benches 2024-10-12 16:30:20 +02:00
bors
1e5bad3164 Auto merge of #14593 - elchukc:fix_cargo_tree_bindep_crosscompile, r=weihanglo
Fix panic when running cargo tree on a package with a cross compiled bindep

### What does this PR try to resolve?

This is an attempt to close out `@rukai's` [PR](https://github.com/rust-lang/cargo/pull/13207#issue-2056019109) for #12358 and #10593 by adjusting the new integration test and resolving merge conflicts.

I have also separated the changes into atomic commits as per [previous review](https://github.com/rust-lang/cargo/pull/13207#discussion_r1543447659).

### How should we test and review this PR?

The integration test that has been edited here is sufficient, plus the new integration test that confirms a more specific case where `cargo tree` throws an error.

### Additional information

I have confirmed the test `artifact_dep_target_specified` fails on master branch and succeeds on this branch.

The first commit fixes the panic and the integration test. Commits 2 and 3 add other tests that confirm behaviour mentioned in related issues.

Commits:
1. [Fix panic when running cargo tree on a package with a cross compiled bindep](5c5ea78ecd) - fixes some panics and changes the integration test to succeed
2. [test: cargo tree panic on artifact dep target deactivated](ed294ab4e7) - adds test to confirm the behaviour for the specific panic from [#10539 (comment)](https://github.com/rust-lang/cargo/issues/10593#issuecomment-1317759526)
2024-10-11 14:30:03 +00:00
Rustin170506
76cd19b549 Remove the support for Cargo.toml of the cargo-script 2024-10-11 11:59:11 +02:00
elchc
ed294ab4e7 test: cargo tree panic on artifact dep target deactivated 2024-10-10 22:21:50 -04:00
Lucas Kent
5c5ea78ecd Fix panic when running cargo tree on a package with a cross compiled bindep 2024-10-10 21:34:19 -04:00
Joe Neeman
4e051c47be Support package selection in cargo publish 2024-10-10 09:37:10 +07:00
Joe Neeman
3ffcdee1ce Add failing test 2024-10-10 09:17:27 +07:00
bors
15fbd2f607 Auto merge of #14137 - Xaeroxe:checksum-freshness, r=weihanglo
initial version of checksum based freshness

Implementation for https://github.com/rust-lang/cargo/issues/14136 and resolves https://github.com/rust-lang/cargo/issues/6529

This PR implements the use of checksums in cargo fingerprints as an alternative to using mtimes. This is most useful on systems with poor mtime implementations.

This has a dependency on https://github.com/rust-lang/rust/pull/126930. It's expected this will increase the time it takes to declare a build to be fresh. Still this loss in performance may be preferable to the issues the ecosystem has had with the use of mtimes for determining freshness.
2024-10-08 21:08:11 +00:00
Jacob Kiesel
cf893c1695
test(freshness_checksum): verify cargo depinfo is properly encoded 2024-10-08 16:30:54 -04:00
Jacob Kiesel
c0e550ee5b
test(freshness_checksum): different fingeprint methods are compatible
This ensures that users can switch between different fingerprint
freshness methods and still correctly rebuild stuff.
2024-10-08 16:29:46 -04:00
Jacob Kiesel
0d08e19661
test(freshness_checksum): verify unstable flag is gated correctly 2024-10-08 16:29:45 -04:00
Weihang Lo
66998ea24a
test(freshness_checksum): verify checksum works
Two new tests:

* checksum_actually_uses_checksum: chekcsum works when mtime forwards
* same_size_different_content: checksum does check content
2024-10-08 16:29:45 -04:00
Weihang Lo
b48fe7354f
test(freshness_checksum): remove unnecessary sleep
We don't rely on mtime anymore for checksum-based fingerprint
2024-10-08 16:29:45 -04:00
Weihang Lo
74cc1deb51
test(freshness_checksum): enable -Zfreshness-checksum
These tests are modified or renamed to reflect the switch to
checksum fingerprint:

* bust_patched_dep
* modifying_and_moving
* rebuild_on_mid_build_file_modification
* rebuild_sub_package_then_while_package
* skip_mtime_check_in_selected_cargo_home_subdirs
* use_mtime_cache_in_cargo_home
2024-10-08 16:29:45 -04:00
Weihang Lo
e5a44e24a1
test(freshness_checksum): requires nightly rustc 2024-10-08 16:29:45 -04:00
Weihang Lo
eea5fe9b00
test(freshness_checksum): remove unnecessary tests
* cargo_env_changes
* fingerprint_cleaner_does_not_rebuild
* modify_only_some_files
* rebuild_if_build_artifacts_move_forward_in_time
* simulated_docker_deps_stay_cached
* update_dependency_mtime_does_not_rebuild
2024-10-08 16:29:45 -04:00
Weihang Lo
9b17115534
test(freshness_checksum): update test module description 2024-10-08 16:29:45 -04:00
Weihang Lo
ad7d33d893
test: copy freshness tests in preparation of checksum tests 2024-10-08 16:29:44 -04:00
Jacob Kiesel
f4ca739073
implement checksum freshness fingerprints for cargo 2024-10-08 16:29:44 -04:00
bors
fbcd9bb571 Auto merge of #14464 - linyihai:issue-14194, r=weihanglo
fix: avoid inserting duplicate `dylib_path_envvar` when calling `cargo run` recursively

### What does this PR try to resolve?

If the current program started by `cargo run` recursively call into `cargo run`, the second `cargo run` will insert  `search_path`  into `dylib_path_envvar` again.

Fixes #14194

### How should we test and review this PR?

The first commit adds the test to reflect the issue. The first call to `cargo run` stores the dylib search path env var to a file. Subsequent calls verify that env var remains the same.

The second commit fixes the behavior by checking if env vars in `search_path` are a prefix of the slice of env vars in `dylib_path_envvar`.
2024-10-08 12:51:33 +00:00
Lin Yihai
54dbc2bf66 fix: Avoid inserting search_path again. 2024-10-08 16:20:21 +08:00
Lin Yihai
e888c1306f test: Add test for issue-14194 2024-10-08 16:16:25 +08:00
Lucas Kent
1623c414ad improve error reporting when feature not found in activated_features 2024-10-05 17:10:54 -04:00
Ed Page
0498e84f89 feat: Stabilize MSRV-aware resolver config
This includes
- `cargo generate-lockfile --ignore-rust-version`
- `cargo update --ignore-rust-version`

This does not include
- `edition = "2024"`
- `resolver = "3"`
2024-10-04 12:49:28 -05:00
Ed Page
c18765a152 test: Migrate remaining build with_json tests to snapbox 2024-10-03 21:15:10 -05:00
Ed Page
f92e54faf9 test: Migrate remaining metadata with_json tests to snapbox 2024-10-03 21:15:10 -05:00
bors
fd5f1a05c1 Auto merge of #14630 - epage:implicit-removal, r=weihanglo
fix: Remove implicit feature removal

### What does this PR try to resolve?

Due to problems we ran into with #14016, we're removing implicit features from the 2024 edition to give ourselves more time to design it as we should.

### How should we test and review this PR?

### Additional information

I could have added a new flag for this or made an EditionNext but I decided to remove it in the hopes to avoid any path dependency in solving this the next time.
2024-10-01 20:06:46 +00:00
Weihang Lo
b4253e5057
fix(help): mention --config <PATH> in help text 2024-10-01 14:54:52 -04:00
Ed Page
7be5a2146b fix: Remove implicit feature removal
Due to problems we ran into with #14016, we're removing implicit
features from the 2024 edition to give ourselves more time to design it
as we should.

I could have added a new flag for this or made an EditionNext but I
decided to remove it in the hopes to avoid any path dependency in
solving this the next time.
2024-10-01 11:48:31 -05:00
Weihang Lo
dfa8f26ddc
test(test): unnecessay env_remove("RUST_BACKTRACE")
This is done for all tests in f3c7525a61d61b347ed9e2e278dd84cc8c943531
2024-09-30 14:23:47 -04:00
Weihang Lo
e965b41fa0
test(test): relax compiler panic assertions 2024-09-30 14:23:47 -04:00
Weihang Lo
c3a74f5c36
test(rustflags): relax compiler panic assertions 2024-09-30 14:23:47 -04:00
Weihang Lo
e2946ab9fb
test(install): relax compiler panic assertions 2024-09-30 14:23:47 -04:00
Weihang Lo
d6ebb14227
test(features2): relax compiler panic assertions 2024-09-30 14:23:47 -04:00
Weihang Lo
7cb5be34c0
test(bench): relax compiler panic assertions 2024-09-30 14:23:47 -04:00
Weihang Lo
3f1b82893a
test(artifact_dep): relax compiler panic assertions 2024-09-30 13:26:49 -04:00
Weihang Lo
8534276f0d
test(build-std): relax compiler panic assertions 2024-09-30 13:25:34 -04:00
Weihang Lo
b1f574a10d
test(jobserver): relax compiler panic assertions 2024-09-30 13:25:33 -04:00
Weihang Lo
e4e970d309
test(freshness): relax compiler panic assertions 2024-09-30 13:25:33 -04:00
bors
1fad770250 Auto merge of #14556 - Ifropc:lockfile-path-install, r=weihanglo
feat: lockfile path implies --locked on cargo install

Follow-up of https://github.com/rust-lang/cargo/issues/14421
Resolving one of the items
> cargo install should make --lockfile-path imply --locked

Simply mirrored behavior as if `--locked` was provided (on creating the workspace)
2024-09-27 16:57:50 +00:00
bors
b396f2c3aa Auto merge of #14591 - epage:autolib, r=weihanglo
feat(toml): Add `autolib`

### What does this PR try to resolve?

PR #5335 added `autobins`, etc for #5330.  Nowhere in there is
discussion of `autolib`.

Cargo script disables support for additional build-targets by disabling
discovery.
Except we don't have a way to disable discovery of `autolib`, leading to #14476.
By adding `autolib`, we can continue in that direction.

This also allows us to bypass inferring of libs on published packages,
like all other build-targets which were handled in #13849.

Fixes #14476

### How should we test and review this PR?

### Additional information

As this seems fairly low controversy, this insta-stabilizes the field.
In prior versions of Cargo, users will get an "unused manifest key"
warning.
For packages where this is set by `cargo publish`, the warning will be suppressed and things will work as normal.
For `cargo vendor`, the same except there will be some churn in the
vendored source as this field will now be set.
For local development, it should be rare to set `autolib` so the lack of
error by discovering a file when this is set shouldn't be a problem.
2024-09-27 12:25:16 +00:00
bors
a3b35a0ccc Auto merge of #14598 - yichi170:correct-error-count, r=weihanglo
fix: correct error count for `cargo check --message-format json`

Hi! This is my first time contributing to Cargo. If there is anything that I need to do, please let me know!
(I'm not sure whether the commit message is aligned with the Cargo's convention. If it doesn't, I'm willing to modify it!)

This PR resolves the issue with incorrect error count and ensures warnings are correctly displayed when using `cargo check --message-format json`.

Fixes #14472
2024-09-27 11:47:04 +00:00
yichi170
71c830ccef fix: correct error count for cargo check --message-format json 2024-09-26 23:07:51 -05:00
Weihang Lo
498ae399bf
test: relax panic output assertion
rust-lang/rust#122565 adds a new line to thread panic output.
To make the current test suites works on stable, beta, and nightly,
this relaxes the assertion around that by globbing everything.
2024-09-26 16:00:54 -04:00
bors
7cbdcf0b21 Auto merge of #14404 - Ifropc:cargo_manifest_path, r=weihanglo
feat: add CARGO_MANIFEST_PATH env variable

Adds `CARGO_MANIFEST_PATH` variable as part of https://github.com/rust-lang/cargo/issues/12207
Context: `CARGO_MANIFEST_DIR` is not very useful, because there is no `Cargo.toml` file when running a cargo script. In cases when multiple scripts are stored in the same folder, we can't tell which script exactly is being run using `CARGO_MANIFEST_DIR`
2024-09-26 13:01:01 +00:00
Ifropc
d4ac929563 test: add tests for CARGO_MANIFEST_PATH in build.rs
- Uses same checks as for already existing CARGO_MANIFEST_DIR
2024-09-26 01:43:16 -04:00
Ifropc
bf37cf7f32 feat: --lockfile-path add install support 2024-09-26 01:19:40 -04:00