6729 Commits

Author SHA1 Message Date
Weihang Lo
010f171ca4
fix(): error context for git_fetch refspec not found (#14806)
### What does this PR try to resolve?

Fixes Issue : #14621

Adds more error context for fetching a commit that doesn't exists.

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

I've created two tests, one for fast_path and one for libgit2.

r? @weihanglo
2024-11-17 22:35:29 +00:00
Dacian Pascu
43a5dee2a8
fix(git): added extra error context for a revision that doesn't exist
See issue rust-lang#14621
2024-11-17 22:49:36 +02:00
Dacian Pascu
f3edba9197
test(git): added tests for issue rust-lang#14621 2024-11-17 21:14:48 +02:00
Eric Huss
ca3eb82632
feat(resolver): Stabilize resolver v3 (#14754)
### What does this PR try to resolve?

This is a follow up to #14639 in prep for Edition 2024

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

This is stacked on #14753

### Additional information
2024-11-15 17:18:15 +00:00
Ed Page
878caf7447 docs: Surround identifiers in backticks
This was mostly done by clippy via `clippy::doc_markdown`.
I then reviewed it to fix words that shouldn't have it or where `--fix`
put the backtick in the wrong location.
2024-11-15 09:33:23 -06:00
Eric Huss
c54a8e8750
fix(remove): On error, suggest other dependencies (#14818)
### What does this PR try to resolve?

`cargo remove` already will suggest other tables if appropriate.
`cargo add` auto-corrects `_` and `-`.

This is an extension of the two by suggesting existing dependencies
within the same table that are "close".

Related to #14814

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

I chose to make alt tables and alt deps mutually exclusive in the
message because I didn't wantto deal with how to separate things if both
show up.
Most likely, people will only expect one or the other and if its in an
alt table, then most likely they mean that.

### Additional information
2024-11-14 15:21:15 +00:00
Weihang Lo
cfea0658b5
Always include Cargo.lock in published crates (#14815)
### What does this PR try to resolve?

Originally it was only included for packages that have executables or
examples for `cargo install`, however this causes inconsistencies and is
kind of unexpected nowadays, e.g. with cdylib crates.

Including it always only slightly increases the crate size and allows
for all crates to know a set of dependency versions that were working,
which can make regression tracking easier.

Fixes https://github.com/rust-lang/cargo/issues/13447

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

The existing tests are covering this change in all kinds of various
already, and one test that previously asserted that there is *no*
Cargo.lock for library crates was changed to explicitly check for the
new behaviour.
2024-11-14 14:40:01 +00:00
Sebastian Dröge
dd698ff048 Always include Cargo.lock in published crates
Originally it was only included for packages that have executables or
examples for `cargo install`, however this causes inconsistencies and
is kind of unexpected nowadays, e.g. with cdylib crates.

Including it always only slightly increases the crate size and allows
for all crates to know a set of dependency versions that were working,
which can make regression tracking easier.

Fixes https://github.com/rust-lang/cargo/issues/13447
2024-11-14 09:06:18 +02:00
Ed Page
33d1361bb8 fix(remove): On error, suggest other dependencies
`cargo remove` already will suggest other tables if appropriate.
`cargo add` auto-corrects `_` and `-`.

This is an extension of the two by suggesting existing dependencies
within the same table that are "close".

I chose to make alt tables and alt deps mutually exclusive in the
message because I didn't wantto deal with how to separate things if both
show up.
Most likely, people will only expect one or the other and if its in an
alt table, then most likely they mean that.

Related to #14814
2024-11-13 15:26:11 -06:00
Ed Page
4da1b2ee78 test(remove): Update fixture for a suggestion 2024-11-13 15:25:15 -06:00
Ed Page
cad379f3e3 test(remove): Reduce the fixture size 2024-11-13 15:24:12 -06:00
Ed Page
f7f2206474 test(remove): Don't use shared fixture 2024-11-13 15:22:54 -06:00
Weihang Lo
9a5fd425e1
feat(rustdoc): diplay env vars in extra verbose mode
This seems to be an overlook
2024-11-12 22:57:45 -05:00
Piotr Osiewicz
63c01d8dd0 test(git): Add submodule to _corrupted_checkout tests 2024-11-11 16:25:31 -06:00
Ed Page
e8ad597ed4 test(git): Verify corrupted checkout is fixed 2024-11-11 16:25:22 -06:00
Ed Page
f1895819bc test(git): Clarify checkout path 2024-11-11 16:24:23 -06:00
Weihang Lo
7347918e38
test: redact host target when comparing CARGO_ENV path
This was found when updating git submodule in rust-lang/rust

```
---- test::cargo_test_env stdout ----
running `/Users/weihanglo/dev/rust/build/aarch64-apple-darwin/stage2-tools/aarch64-apple-darwin/release/cargo test --lib -- --nocapture`
thread 'test::cargo_test_env' panicked at tests/testsuite/test.rs:3904:10:

test failed running `/Users/weihanglo/dev/rust/build/aarch64-apple-darwin/stage2-tools/aarch64-apple-darwin/release/cargo test --lib -- --nocapture`
error: expected to find:
/Users/weihanglo/dev/rust/build/aarch64-apple-darwin/stage2-tools/aarch64-apple-darwin/release/cargo

did not find in output:
[COMPILING] foo v0.5.0 ([ROOT]/foo)
[FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
[RUNNING] unittests src/lib.rs (target/debug/deps/foo-[HASH])
/Users/weihanglo/dev/rust/build/[HOST_TARGET]/stage2-tools/[HOST_TARGET]/release/cargo
```
2024-11-09 13:08:55 -05:00
Weihang Lo
c03c5807e8
test: fix replacing .exe only once
On non-Windows platform the redacted string became something like below,
which was valid but didn't make sense:

```
[EXE]/[EXE]U[EXE]s[EXE]e[EXE]r[EXE]s[EXE]/[EXE]w[EXE]h[EXE]l[EXE]o[EXE]/[EXE]d[EXE]e[EXE]v[EXE]/[EXE]r[EXE]u[EXE]s[EXE]t[EXE]/[EXE]b[EXE]u[EXE]i[EXE]l[EXE]d[EXE]/[EXE]a[EXE]a[EXE]r[EXE]c[EXE]h[EXE]6[EXE]4[EXE]-[EXE]a[EXE]p[EXE]p[EXE]l[EXE]e[EXE]-[EXE]d[EXE]a[EXE]r[EXE]w[EXE]i[EXE]n[EXE]/[EXE]s[EXE]t[EXE]a[EXE]g[EXE]e[EXE]2[EXE]-[EXE]t[EXE]o[EXE]o[EXE]l[EXE]s[EXE]/[EXE]a[EXE]a[EXE]r[EXE]c[EXE]h[EXE]6[EXE]4[EXE]-[EXE]a[EXE]p[EXE]p[EXE]l[EXE]e[EXE]-[EXE]d[EXE]a[EXE]r[EXE]w[EXE]i[EXE]n[EXE]/[EXE]r[EXE]e[EXE]l[EXE]e[EXE]a[EXE]s[EXE]e[EXE]/[EXE]c[EXE]a[EXE]r[EXE]g[EXE]o[EXE]
```

Here we simply remove the extension and append `[EXE]` at the end.
2024-11-09 12:05:03 -05:00
Arlo Siemsen
d8cb5fb7f8
Merge pull request #14388 from arlosi/warnings2
feat(warnings): add build.warnings option
2024-11-09 00:29:19 +00:00
Arlo Siemsen
2274a1a946 feat: add build.warnings config option to control rustc warnings 2024-11-08 15:27:33 -06:00
Arlo Siemsen
cfa1873d4e Add tests that show existing behavior 2024-11-08 15:27:30 -06:00
Ed Page
cada441a16 Revert "feat: Add CARGO_RUSTC_CURRENT_DIR"
This reverts commit e81d84cc17d7df6a249e60cbc620f25edbe782db.

Fixes #14798
2024-11-08 14:36:21 -06:00
Ed Page
af3cfd5abe fix(test): Un-deprecate contains assertions 2024-11-07 15:55:35 -06:00
Ed Page
a03adcf6e2 fix(test): Make redactions consistent with snapbox
I'm unsure how we should be replacing these use cases, so I'm exploring
keeping them but making them use snapbox under the hood.
Part of the intent of snapbox is that it provides you the building
blocks to make what you need.
2024-11-06 20:03:53 -06:00
Ed Page
7b58bd51c3 feat(resolver): Stabilize v3 resolver 2024-11-06 12:57:19 -06:00
bors
be87c96b23 Auto merge of #14785 - epage:test-unordered, r=ehuss
test(gc): Update remaining unordered tests to snapbox

### What does this PR try to resolve?

This gets rid of the last unordered tests and removes the functions from `cargo-test-support` as part of #14039

Some tests are being less specific than they were before but in talking to ehuss, it sounded like that was ok.

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

### Additional information
2024-11-06 18:06:06 +00:00
bors
d050945fe4 Auto merge of #14497 - linyihai:issue-14227, r=epage
Normalize the `target` paths

### What does this PR try to resolve?

The `targets` path of the `normalized_toml` could be relative,   which isn't user-friendly.

What is this PR doing?

This PR applys the `paths::normalize_path` to remove the relative part.

Fixes #14227

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

Add a test originted from the issue,  and fixing it in the next commit.

### Additional information
2024-11-06 17:10:46 +00:00
Lin Yihai
a456c22531 fix: Apply path::normalize_path to targets in toml::normalize_toml phase 2024-11-06 15:05:11 +08:00
bors
91809c45b1 Auto merge of #14781 - epage:to, r=weihanglo
test: Update some emaining unordered tests to snapbox

### What does this PR try to resolve?

This is part of #14039

This leaves `global_cache_tracker.rs` as it requires some more thinking.

As for the flakiness in `freshness.rs`  that was seen in #14161, `compare.rs` would prioritize expected lines according to their length (assuming its more specific).  Currently, snapbox prioritizes according to the line order.  So we just need to put the proc-macro line before the other one to ensure it gets precedence.

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

### Additional information
2024-11-05 04:15:40 +00:00
Ed Page
f7f7abccf3 test(gc): Update remaining unordered tests to snapbox 2024-11-04 16:05:49 -06:00
Ed Page
6ba83152e5 test(freshness): Update remaining unordered tests to snapbox
`compare.rs` gives priority based on expected-line length.
`snapbox` gives priority according to the expected line order.
2024-11-04 16:03:39 -06:00
Ed Page
99090694dc test(clean): Update remaining unordered test to snapbox 2024-11-04 16:03:32 -06:00
bors
ad3cdb4575 Auto merge of #14749 - Rustin170506:rustin-patch-cargo-script, r=epage
Change config paths to only check CARGO_HOME for cargo-script
2024-11-04 16:34:55 +00:00
Rustin170506
bd47da1ab1 Change config paths to only check CARGO_HOME for cargo-script
Signed-off-by: Rustin170506 <29879298+Rustin170506@users.noreply.github.com>
2024-11-03 18:11:52 +08:00
Lin Yihai
f8df39b133 test: Add a test for issue #14227 2024-11-01 14:39:15 +08:00
Weihang Lo
8aec0a40f5
test(rustfix): switch to a simpler case for dedup-suggestions
This case also emits an insert-only suggestions (span start == end),
and doesn't rely on any lint behavior.

See also

* https://github.com/rust-lang/cargo/pull/13728
* https://github.com/rust-lang/cargo/issues/13027
2024-10-31 22:05:24 -04:00
bors
7421ccf915 Auto merge of #14760 - epage:test-flake, r=ehuss
test(doc): Resolve flaky test

Saw this failure on #14759
2024-10-31 22:39:12 +00:00
Ed Page
35baa734ff test(doc): Resolve flaky test
Saw this failure on #14759
2024-10-31 16:26:37 -05:00
bors
40d804ba5d Auto merge of #14752 - RalfJung:rustc-root-path, r=epage
add unstable -Zroot-dir flag to configure the path from which rustc should be invoked

This implements the proposal described [here](https://github.com/rust-lang/cargo/issues/9887#issuecomment-2273742881): we add a new flag, for now called `-Zroot-dir`, that configures the directory relative to which rustc is given the crate root filenames to build. (Files outside this directory are passed absolutely.)

This is necessary to be able to fix (no github don't close that issue yet) https://github.com/rust-lang/rust/issues/128726: in multi-workspace repositories that use scripts to manage a whole bunch of cargo invocations, currently the output cargo+rustc produce is often hard or even impossible to interpret for both human and machine consumption. This is because directories in the output are always relative to the workspace root, but when cargo is invoked many times for different workspaces, it is quite unclear what the workspace root is for the invocation that failed.

So I suggest we should have a new flag that the build script in such a repo can set to the consistent "root dir" that the user would recognize as such (e.g., the root of the rustc source tree), and all paths emitted by cargo and rustc should be relative to that directory.

I don't know all the places that cargo itself emits paths (if any), but this PR changes the way we invoke rustc to honor the new flag, so all paths emitted by rustc will be relative to the `-Zroot-dir`.

See https://github.com/rust-lang/rust/pull/132390 for the changes needed in rustc bootstrap to wire this up; together, that suffices to finally properly show errors in RA for all parts of the rustc src tree. :)
2024-10-31 21:16:35 +00:00
Ralf Jung
c2be327042 add unstable -Zroot-path flag to configure the path from which rustc should be invoked 2024-10-31 21:35:57 +01:00
Ralf Jung
573ff00fe6 add tests in preparation for root-dir flag that changes their behavior 2024-10-31 21:34:48 +01:00
bors
5f9257e685 Auto merge of #14748 - epage:msrv-policy, r=Rustin170506
test: Remove unused msrv-policy

### What does this PR try to resolve?

Missed this in #14639

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

### Additional information
2024-10-30 23:04:29 +00:00
Ed Page
d125262545 download transitive deps of artifact deps on target platform 2024-10-30 16:26:17 -04:00
elchc
7ec86a118c un-ignore test: proc_macro_in_artifact_dep with a network error 2024-10-30 15:46:40 -04:00
Ed Page
51f634b3bd test: Remove unused msrv-policy
Missed this in #14639
2024-10-30 09:57:01 -05:00
bors
9abcaefd51 Auto merge of #14317 - harmou01:dev/harmou01/remove-target-flag-req, r=ehuss
Remove requirement for --target when invoking Cargo with -Zbuild-std

This PR addresses [this issue](https://github.com/rust-lang/wg-cargo-std-aware/issues/25) re: build-std stabilization. We believe the requirement for --target to be specified when invoking cargo with -Zbuild-std, from our testing, is no longer needed. Now, with this change, by default Cargo will use the Host CompileKind, rather than a manually specified CompileTarget. We propose removing this restriction in order to test this more widely. Our own testing is detailed below.

This change has been tested in the following manner:
* Building crates depending on proc_macro, std, and build scripts (which themselves depend on proc_macro)
* Various RUSTFLAGS, such as `-Zsanitizer=cfi`, `-Cembed-bitcode=yes`, `-Cforce-frame-pointers`, `-Cforce-unwind-tables=yes`, `-Csoft-float=yes`, `-Zbranch-protection=pac-ret`.
2024-10-30 13:54:02 +00:00
bors
4f74477679 Auto merge of #14743 - ehuss:build-script-errors, r=epage
Allow build scripts to report error messages through `cargo::error`

Adds the `cargo::error` build script directive. It is similar to `cargo::warning`, but it emits an error message and it also fails the build.

This is a repost of #14435 with the tests updated, a note added to the documentation about using this in a library, and updating the MSRV.

Closes #10159
2024-10-29 16:36:58 +00:00
bors
92f94a54ac Auto merge of #14742 - epage:publish, r=ehuss
fix(publish): Downgrade version-exists error to warning on dry-run

### What does this PR try to resolve?

Especially for beta, this was the most conservative, minimal change.

Fixes #14721

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

### Additional information

This will get cherry-picked to beta
2024-10-29 16:04:22 +00:00
Ed Page
947e1ffe3f fix(publish): Downgrade version-exists error to warning on dry-run
This will get cherry-picked to beta

Fixes #14721
2024-10-29 10:21:52 -05:00
Ed Page
ae6b279277 test(publish): Verify version-exists error in dry-run 2024-10-29 10:14:22 -05:00