Commit Graph

12723 Commits

Author SHA1 Message Date
Scott Schafer 251a2c7915 cargo-test-support: Make publish http api write to file system 2022-09-22 10:00:49 -06:00
Scott Schafer 0ba6224a70 cargo-test-support: allow processing of the body of a request for test http registries 2022-09-21 10:07:09 -06:00
bors 247ca7fd04 Auto merge of #11087 - weihanglo:issue-11013, r=epage
Report cmd aliasing failure with more contexts

### What does this PR try to resolve?

Commands aliasing resolution should report TOML parsing error to users.

Fixes #11013.

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

https://github.com/rust-lang/cargo/pull/11087/commits/ef7a4ef is the most important commit in this PR. `has_key` now throws errors after this PR, so any use `Config::get<Option<…>>()` is affected if there is a malformed config. Had a skim over all usages of `get::<Option<…>>`, `get_string` and `get_path`, I don't feel any of them should ignore errors.
2022-09-22 14:51:58 +00:00
bors 8882d993f3 Auto merge of #11127 - matklad:unused-mut, r=Eh2406
minor: remove unused mut
2022-09-22 14:06:49 +00:00
Aleksey Kladov 73c79c7821 minor: remove unused mut 2022-09-22 15:04:00 +01:00
Weihang Lo 5caabc0ade
doc: rustdoc for `aliased_command` 2022-09-22 10:52:39 +01:00
Weihang Lo 5dd982d8af
Make `cargo version` work even with malformed configurations 2022-09-22 10:52:39 +01:00
Weihang Lo ef7a4ef062
Dont swallow errors when checking existence of a config key 2022-09-22 10:52:39 +01:00
Weihang Lo 2c6647df80
test(alias): with malformed config no proper error emitted
This demonstrate the old behaviour that no proper error is emitted if
there is a parse error during configuration parsing.
2022-09-22 10:46:32 +01:00
bors 7c8a5a67d3 Auto merge of #11118 - epage:external, r=weihanglo
fix(cli): Forward non-UTF8 arguments to external subcommands

Whether we allow non-UTF-8 arguments or not, we shouldn't preclude external subcommands from deciding to do so.

I noticed this because clap v4 changed the default for external subcommands from `String` to `OsString` with the assumption that this would help people to "do the right thing" more often.
2022-09-22 07:56:31 +00:00
bors 635a84854b Auto merge of #10938 - ptdecker:add-author-example, r=weihanglo
This change adds an example to the authors attribute in the manifest.

It is submitted to clarify the documenation for new folks such as
myself. See the forum issue linked below which prompted this change
since the error message the compiler issues is not clear for new
folks.

https://users.rust-lang.org/t/compile-error-when-adding-authors-to-cargo-toml/79383

Thank you for considering this contribution. It's my first so go
easy on me please!  :-)
2022-09-21 20:44:58 +00:00
P. Todd Decker 51dc6fb3c4
Update src/doc/src/reference/manifest.md
Adding newline back per @weihanglo's input (thank you)

Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
2022-09-21 15:28:50 -05:00
Ed Page 87fdf7660c fix(cli): Forward non-UTF8 arguments to external subcommands
I noticed this because clap v4 changed the default for external
subcommands from `String` to `OsString` with the assumption that this
would push people to "do the right thing" more often.
2022-09-21 14:35:21 -05:00
bors 23ab870c50 Auto merge of #11106 - x-hgg-x:issue-7992, r=epage
Add support for relative git submodule paths

Fixes #7992.

This is a continuation of #9592, tested on Linux and Windows.

> Git allows submodules to have relative URLs, but cargo does not handle this correctly, and simply fails to update submodules as described in issue https://github.com/rust-lang/cargo/issues/7992. This PR fixes that by passing in the parent git repo url to update_submodules.

The previous PR wasn't compatible on Windows, since it used [`std::path::Path`](https://doc.rust-lang.org/std/path/struct.Path.html) for merging the parent and relative submodule urls.

This PR uses [`url::Url`](https://docs.rs/url/latest/url/struct.Url.html) instead, which has the same behavior on all platforms. It also refers to the [git documentation](https://git-scm.com/docs/git-submodule#Documentation/git-submodule.txt-add-bltbranchgt-f--force--nameltnamegt--referenceltrepositorygt--depthltdepthgt--ltrepositorygtltpathgt) for the definition of a relative git submodule path.
2022-09-21 18:09:09 +00:00
bors bee9c896c0 Auto merge of #11098 - Emilgardis:early-fail, r=epage
make unknown features on `cargo add` more discoverable

When adding an unknown feature via `cargo add -F krate/feat`, it can be easy to miss the fact that the change failed.

This fixes that by showing the following output on fail

<img width="474" alt="image" src="https://user-images.githubusercontent.com/1502855/191100141-3603cc9a-d4b6-4d6a-bbc6-41b34144b3f0.png">
2022-09-21 17:25:19 +00:00
bors a74a8d0456 Auto merge of #11122 - weihanglo:issue-11101, r=epage
Unlink old final artifacts before compilation
2022-09-21 16:43:29 +00:00
bors 6a88dd8a81 Auto merge of #11116 - epage:refactor, r=weihanglo
refactor(cli): Prepare for clap v4

This is two minor refactors that better align us with the upcoming clap v4
- `clap::ErrorKind` has moved to `clap::error::ErrroKind` during 3.x and in 4.0 the old location no longer works
- `clap::App` was renamed to `clap::Command` and in v4 the lifetime will be removed which will remove the need for us to have an alias at all.  This does the rename so we can just use what clap has in v4.
2022-09-21 15:27:45 +00:00
Weihang Lo b47cacbacf
fix(artifact): delete old final artifacts before rebuild
Some linkers do not remove the executable, but truncate and modify it.
That results in the old hard-link being modified even after renamed.
We delete the old artifact here to prevent this behavior from confusing users.
See rust-lang/cargo#8348.
2022-09-21 16:09:12 +01:00
Weihang Lo bf1523b663
test: renamed uplifted artifact remains unmodified after rebuild 2022-09-21 16:02:42 +01:00
bors e320c3e545 Auto merge of #11119 - epage:error, r=ehuss
fix(cli): Error trailing args rather than ignore

This warning has been in for a sufficient time, requires a hack from clap to avoid all argument ID validation, and allows users to run the wrong command (imagine `cargo -- publish --dry-run`).

See also https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Cargo.20ignoring.20arguments.20with.20.60cargo.20--.20check.20--ignored.60
2022-09-21 14:00:15 +00:00
x-hgg-x 528a8b25af Add fixes from review 2022-09-21 13:08:41 +02:00
x-hgg-x 37fdd714c4 Use Cow<str> when normalizing parent url path 2022-09-21 13:08:41 +02:00
x-hgg-x c29f0b715f Simplify relative submodule handling 2022-09-21 13:08:41 +02:00
x-hgg-x 942f7f9c59 Add support for relative git submodule paths 2022-09-21 13:08:41 +02:00
Emil Gardström 1cc21b65d1
make unknown features on `cargo add` more discoverable 2022-09-21 08:07:16 +02:00
Ed Page 8f8a79a5a4 fix(cli): Error trailing args rather than ignore
This warning has been in for a sufficient time, requires a hack from
clap to avoid all argument ID validation, and allows users to run the
wrong command (imagine `cargo -- publish --dry-run`).

See also https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Cargo.20ignoring.20arguments.20with.20.60cargo.20--.20check.20--ignored.60
2022-09-20 16:54:01 -05:00
Ed Page b00b59dacb refactor(cli): Use new clap::ErrorKind location 2022-09-20 13:32:11 -05:00
Ed Page 0a78364fd1 refactor(cli): Align with clap 3.1 on terminology
clap 3.1 renamed `App` to `Command`.  When we upgrade to clap v4, the
lifetime will be removed and we can just use `clap::Command` instead of
a type alias.  This is prep for that.
2022-09-20 13:28:36 -05:00
bors 531ce1321d Auto merge of #11093 - mrexodia:patch-1, r=epage
Add a minor clarification

### What does this PR try to resolve?

It tries to clarify the overriding build scripts section. We spent over an hour with 3 people trying to get it to work and it was extremely difficult to figure out.

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

N/A

### Additional information

N/A
2022-09-20 17:51:36 +00:00
Duncan Ogilvie 6b2ff2b950 Add a minor clarification
Hopefully this will save the next person from wasting an hour+ on this.
2022-09-20 18:57:13 +02:00
bors 8dea81918b Auto merge of #11104 - weihanglo:changelog-mention-cves, r=ehuss
doc(changelog): mention CVE fixes
2022-09-19 21:46:00 +00:00
Emil Gardström d924a253c7
split table and action message prints
also makes gathering of features a function
2022-09-19 23:43:37 +02:00
Weihang Lo 11d3c5982b
doc(changelog): mention CVE fixes 2022-09-19 21:52:04 +01:00
bors 73ba3f35e0 Auto merge of #11107 - rust-lang:revert-11092-patch-1, r=weihanglo
Revert "Clarify when cargo detects changes"

Reverts rust-lang/cargo#11092

We had not fully confirmed that this language change matches the new behavior.
2022-09-18 06:38:16 +00:00
Ed Page 7df918eb87
Revert "Clarify when cargo detects changes" 2022-09-17 18:58:30 -05:00
bors 8c5509b0d6 Auto merge of #11103 - weihanglo:fix-links-changelog, r=epage
Fix links to workspace inheritance headings in workspace docs
2022-09-17 19:47:52 +00:00
Weihang Lo 6d0ccaddac
Fix links to fragments in workspace docs 2022-09-17 20:37:25 +01:00
bors 362ce33699 Auto merge of #11082 - epage:workspace, r=weihanglo
docs(ref): Clarify workspace settings

### What does this PR try to resolve?

In reviewing the status of #10625, I was reminded
- that we are having growing pains with the workspace documentation
- that `workspace.resolver` isn't documented

So I re-organized the workspace docs to have a high level intro / behavior description and then to focus on being a field reference, much like `manifest.md`.   I could see splitting it specifically into tutorial/reference like the overriding dependencies document does it.

When adding `workspace.resolver`, I remembered in the nested workspace discussion there were other workspace related sections that are not present.  We now link out to `profile`, `patch`, and `replace`.  In doing this, I realized that `patch` and `replace` do not specify their workspace behavior, so I do that.

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

Look at it commit by commit to get more digestible chunks.  Unfortunately, the first commit didn't split up so easily.

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.
-->
<!-- homu-ignore:end -->
2022-09-16 15:35:10 +00:00
bors ef7ab8bb62 Auto merge of #11095 - weihanglo:update-comment-resolveversion, r=epage
Update comment about ResolveVersion default version

### What does this PR try to resolve?

Point out that the current `ResolveVersion` defaults to `V3`

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

- Introduced in 1.47.0 https://github.com/rust-lang/cargo/blob/rust-1.47.0/src/cargo/core/resolver/resolve.rs#L60-L73
- As default in 1.53.0 https://github.com/rust-lang/cargo/blob/rust-1.53.0/src/cargo/core/resolver/resolve.rs#L412

<!-- homu-ignore:end -->
2022-09-16 12:26:07 +00:00
Weihang Lo d94ce9fc90
Don't mention current ResolveVersion in comment 2022-09-15 23:16:08 +01:00
bors 547e6d2448 Auto merge of #11091 - weihanglo:ignore-test-on-release-mode-master, r=epage
[master] Run `reach_max_unpack_size` test only on debug build

`cargo test --release` fails on test `reach_max_unpack_size` as the binary to exercise is optimized. The alternative approach is removing `cfg!(debug_assertions)` from this line.
<9ef926dafc/src/cargo/sources/registry/mod.rs (L842)>

#11089
2022-09-15 22:15:10 +00:00
Weihang Lo c38ca2d26d
Link to `ResolveVersion::default` 2022-09-15 21:11:05 +01:00
Weihang Lo 293431da1e
Update comment about ResolveVersion default version 2022-09-15 20:55:47 +01:00
Weihang Lo 22ac249db2
Run `reach_max_unpack_size` test only on debug build 2022-09-15 19:02:26 +01:00
bors aaadab6db3 Auto merge of #11092 - TheButlah:patch-1, r=epage
Clarify when cargo detects changes

### What does this PR try to resolve?

Its not clear if "any file" means "any rust file" or "any file, including non rust files". I think the confusion stemmed from the focus on it belonging to the rust package. So it was unclear if any file in the directory counts as belonging to the package, or if the package only contains rust source files, and therefore a `.proto` or `.fbs` file in the same directory as the Cargo.toml would not trigger a rebuild.

I amended the wording to focus on directories rather than packages.

### How should we test and review this PR?
Please let me know which change it should be, and I will update my PR accordingly. Also, please let me know if my edit is accurate, or if it is misleading!
2022-09-15 15:50:18 +00:00
Ryan Butler 53a106450d
Update build-scripts.md 2022-09-14 13:41:46 -04:00
Ryan Butler 0d81c2b94c
Clarify when cargo detects changes 2022-09-14 13:35:45 -04:00
bors 9ef926dafc Auto merge of #11089 - pietroalbini:pa-cves-nightly, r=weihanglo
[master] Fix for CVE-2022-36113 and CVE-2022-36114

This PR includes the fixes for CVE-2022-36113 and CVE-2022-36114 targeting the master branch. See [the advisory](https://blog.rust-lang.org/2022/09/14/cargo-cves.html) for more information about the vulnerabilities.
2022-09-14 15:15:46 +00:00
Pietro Albini 0bf436d0d2
fix formatting 2022-09-14 16:14:11 +02:00
Weihang Lo d87d57dbbd
CVE-2022-36114: add tests 2022-09-14 10:54:49 +02:00