18593 Commits

Author SHA1 Message Date
bors
9736f3204a Auto merge of #14539 - ehuss:update-release-docs, r=weihanglo
Update docs for how cargo is published

This updates the docs for publishing crates in this repo after the changes from https://github.com/rust-lang/cargo/pull/14202.
2024-09-11 21:08:31 +00:00
Eric Huss
b9b187376a Update docs for how cargo is published 2024-09-11 13:53:04 -07:00
bors
e7ca9bec80 Auto merge of #14493 - shannmu:dynamic_switch, r=epage
feat: Add native comlpetion with CompleteEnv under the nightly

### What does this PR try to resolve?

Related issue https://github.com/rust-lang/cargo/issues/6645
Tracking issue https://github.com/rust-lang/cargo/issues/14520
This PR is the first step to move cargo shell completions to native completions by using `clap_complete` crate. It makes users could complete cargo subcommand and flags.

By using `clap_complete` crate, we could extend the supported shells to Bash, Zsh, Elvish, Fish, and PowerShell. However, at the current stage, the support for PowerShell in `clap_complete` is not fully developed.
See https://github.com/clap-rs/clap/issues/3166 to get more context about what features `clap_complete` has supported.

### How to test and review this PR?

1. Build a test environment, including the necessary short completion scripts, and the `complete` function to start an interactive shell with the help of a pty device and obtain completion results.
2. Simply test the completion results of subcommands in bash, zsh, fish, elvish.
2024-09-10 13:59:53 +00:00
shannmu
7b0b97789c ci: Install zsh, fish and elvish on ubuntu-lastest for the test and test_gitoxide jobs 2024-09-10 16:03:30 +08:00
shannmu
84caa8301a feat: Add native completions with CompleteEnv and under the nightly features 2024-09-10 15:08:19 +08:00
bors
bd5f32bb1c Auto merge of #14505 - epage:new, r=weihanglo
fix(new): Add to workspace relative to manifest, not current-dir

### What does this PR try to resolve?

We were correctly doing this for cases like `cargo new foo` or
`cargo new deeper/than/this/directory/foo` but not `cargo new ../foo`.

This came up when discussing #14501

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

### Additional information
2024-09-09 22:17:11 +00:00
bors
0b390cd484 Auto merge of #14499 - felixmoebius:rustc-crate-type-parsing, r=weihanglo
Fix parsing of comma separated values in --crate-type flag

### What does this PR try to resolve?

According to the documentation the `--crate-type` flag accepts a comma separated list of crate types. However, these are never actually split into individual items and passed verbatim to rustc.

Since cargo fails to associate cases such as 'staticlib,cdylib' to a specific crate type internally, it has to invoke rustc to determine the output file types for this unknown crate type, which returns only the first file type of the first crate type in the list. Consequently cargo will be looking only for a single '.a' artifact on Linux to be copied to the target directory.

Fix this by splitting the list of provided crate types into individual items before further processing them.

Fixes #14498

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

Updated corresponding test cases

### Additional information
2024-09-09 18:46:29 +00:00
bors
b958d79acd Auto merge of #14504 - eopb:push-xknxowwslrpt, r=epage
Include public/private dependency status in `cargo metadata`

fixes #14502

> [!TIP]
> This change can be reviewed commit-by-commit.
> Descriptions on individual commits are available to justify some decisions

`@rustbot` label Command-metadata Z-public-dependency
2024-09-09 16:22:26 +00:00
shannmu
f25806c472 test: Add test codebase for shell completions 2024-09-09 23:39:21 +08:00
bors
d0cb869167 Auto merge of #14519 - cuishuang:master, r=epage
Remove unnecessary symbols
2024-09-09 13:30:48 +00:00
cuishuang
2351a93055 Remove unnecessary symbols
Signed-off-by: cuishuang <imcusg@gmail.com>
2024-09-09 16:08:00 +08:00
bors
1149535a6f Auto merge of #14515 - nekomachi-touge:cargo-isssue-14463, r=weihanglo
docs: bin source can be `src/main.rs` and/or in `src/bin/`

### What does this PR try to resolve?
This commit clarifies the doc by stating we can place a binary source as `src/main.rs` and/or in `src/bin/`.
Wording is suggested by Ed Page (`@epage).`

### How should we test and review this PR?
(It seems the only way is to check the chenge visually...)

### Additional information
Closes #14463.
2024-09-08 04:08:25 +00:00
Masato Gosui
059c7e4531
docs: bin source can be src/main.rs and/or in src/bin/
This commit clarifies the doc by stating we can place a binary source as `src/main.rs` and/or in `src/bin/`.
Wording is suggested by Ed Page (@epage).

Closes #14463.
2024-09-08 08:03:16 +09:00
Ethan Brierley
37834942bb
docs: include new public flag in metadata schema 2024-09-07 07:28:28 +01:00
Ethan Brierley
fe9600675e
feat: include public/private dependency status in cargo metadata output 2024-09-07 07:28:28 +01:00
Ethan Brierley
ac7d8c17ff
refactor: intorduce Dependency::serialized replacing Serialize impl
This change introduces a new method, `Dependency::serialized` which replaces the direct `Serialize` implementation on `Dependency`.

This matches the pattern used by `Package` with its `Package::serialized`, and will enable us to influence the serialization format with additional arguments.

I replaced borrowed types in `SerializedDependency` with owned variants to satisfy the borrow checker.
This matches `SerializedPackage` and shouldn't be an issue since `Dependency` is cheap to copy.
2024-09-07 07:28:28 +01:00
Ethan Brierley
6829bf7ae0
test: public dependencies don't show up in cargo-metadata 2024-09-07 07:28:28 +01:00
bors
2ddc46a2a5 Auto merge of #14507 - epage:public-on-stable, r=weihanglo
fix(toml): Don't require MSRV bump for pub/priv

### What does this PR try to resolve?

In #13308, we decided to make the feature gate for public/private dependencies non-blocking.
Generally, people opt-in to a feature that is non-blocking through `-Z` but some nightly users want an "always on" mode for this, so we offered both in #13340.
In #13340, we made both feature gates work but we did not make them non-blocking for stable, only nightly.

This change makes the feature gate non-blocking on stable.

Unfortunately, this means that 1.83 will be the MSRV for people using public dependencies.  Good thing the feature is indefinitely blocked in rustc as that gives us more time.

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

### Additional information
2024-09-07 01:41:42 +00:00
Ed Page
1c8509b219 fix(toml): Don't require MSRV bump for pub/priv
In #13308, we decided to make the feature gate for public/private
dependencies non-blocking.
Generally, people opt-in to a feature that is non-blocking through `-Z`
but some nightly users want an "always on" mode for this, so we offered
both in #13340.
In #13340, we made both feature gates work but we did not make them
non-blocking for stable, only nightly.

This change makes the feature gate non-blocking on stable.
2024-09-06 14:49:43 -05:00
bors
dcb4ef9a10 Auto merge of #14448 - stupendoussuperpowers:bail, r=epage
bail before packaging on same version

Fixes #3662. Cleaned up commits from #14338.
2024-09-06 19:40:40 +00:00
bors
64c4b6d320 Auto merge of #14427 - dpaoliello:add, r=epage
Implement path-bases (RFC 3529) 2/n: `cargo [add|remove|update]` support

RFC: https://github.com/rust-lang/rfcs/pull/3529
Tracking Issue: https://github.com/rust-lang/cargo/issues/14355

This PR adds the `--base` option to `cargo add` to allow adding a path dependency with a path base.
2024-09-06 18:58:56 +00:00
sanchitlegalai
6ede1e2b27 fix(publish): Bail on existing version 2024-09-06 13:25:55 -05:00
Ed Page
0a84f1fff6 refactor(registry): Expose the registry source for reuse 2024-09-06 13:24:29 -05:00
sanchitlegalai
e0a1918cf2 test(publish): Show publishing existing version 2024-09-06 13:24:29 -05:00
Daniel Paoliello
8de55540f0 Implement path-bases (RFC 3529) 2/n: cargo add support
RFC: https://github.com/rust-lang/rfcs/pull/3529
Tracking Issue: https://github.com/rust-lang/cargo/issues/14355

This PR adds the `--base` option to `cargo add` to allow adding a path dependency with a path base.
2024-09-06 10:01:49 -07:00
Daniel Paoliello
e86545014c Fix lookup_path_base to take workspace_root as &Path instead of &PathBuf 2024-09-06 10:01:49 -07:00
bors
be1bbda84b Auto merge of #14433 - tweag:multi-package-publishing-rebased, r=epage
Publish workspace

Adds support for simultaneously publishing multiple (possibly inter-dependent) packages in a workspace, gated by the `-Zpackage-workspace` flag.

Questions to be worked out through stabilization:
- Are we ok stabilizing this and #10948 at the same time?  Currently, they are behind the same flag
- What is the desired behavior for the publish timeout? This PR uploads the crates in batches (depending on the dependency graph), and we only timeout if nothing in the batch is available within the timeout, deferring the rest to the next wait-for-publish. So for example, if you have packages `a`, `b`, `c` then we'll wait up to 60 seconds and if only `a` and `b` were ready in that time, we'll then wait another 60 seconds for `c`.
- What is the desired behavior when some packages in a workspace have `publish = false`? This PR raises an error whenever any of the selected packages has `publish = false`, so it will error on `cargo publish --workspace` in a workspace with an unpublishable package. An alternative interface would implicitly exclude unpublishable packages in this case, but still error out if you explicitly select an unpublishable package with `-p package-name` (see #14356). This PR's behavior is the most conservative one as it can change from an error to implicit excludes later.

This is part of #1169
2024-09-06 15:07:42 +00:00
Ed Page
f8467c641c fix(new): Add to workspace relative to manifest, not current-dir
We were correctly doing this for cases like `cargo new foo` or
`cargo new deeper/than/this/directory/foo` but not `cargo new ../foo`.

This came up when discussing #14501
2024-09-06 09:45:19 -05:00
Ed Page
6a3255c386 refactor(new): Ensure we always talk about the xame manifest 2024-09-06 09:44:00 -05:00
Ed Page
c015a0061a test(new): Verify ../path behavior with workspaces 2024-09-06 09:30:53 -05:00
Joe Neeman
a016e5f5c2 Multi-package publishing
Co-authored-by: Tor Hovland <55164+torhovland@users.noreply.github.com>
Co-authored-by: Ed Page <eopage@gmail.com>
2024-09-06 19:05:27 +07:00
Joe Neeman
431d84a6bf Factor out poll_one_package 2024-09-06 19:05:27 +07:00
Joe Neeman
3121a7175d Don't bind Operation::Read 2024-09-06 19:05:27 +07:00
Joe Neeman
faee9a7e91 Use the shared infer_registry function for publishing 2024-09-06 19:05:27 +07:00
Joe Neeman
de8b64ee59 Add publish workspace tests
Co-authored-by: Tor Hovland <55164+torhovland@users.noreply.github.com>
2024-09-06 19:05:27 +07:00
bors
b687045b12 Auto merge of #14503 - tweag:cargo-semver-version, r=weihanglo
Bump ci's version of cargo-semver-version

I just started seeing CI failures like this:
```
error: rustdoc format v33 for file /home/jneeman/tweag/cargo/target/semver-checks/local-cargo-0_83_0/target/semver-checks/target/doc/cargo.json is not supported
```
I think the issue is that the new rust version needs a new cargo-semver-checks, so this PR bumps the version of cargo-semver-checks in CI.
2024-09-06 08:11:22 +00:00
Joe Neeman
90fef7a6aa Bump cargo-semver-checks in ci 2024-09-06 10:16:04 +07:00
bors
8995f54d77 Auto merge of #14496 - tweag:cargo-package-doc, r=epage
Document -Zpackage-workspace

Adds some unstable documentation on the `-Zpackage-workspace` feature, as requested in [#10948](https://github.com/rust-lang/cargo/issues/10948#issuecomment-2330402126). This documentation assumes that #14433 gets merged.
2024-09-05 13:55:15 +00:00
Felix Moebius
fb672fa2a9 Fix parsing of comma separated values in --crate-type flag
According to the documentation the --crate-type flag accepts a comma
separated list of crate types. However, these are never actually
split into individual items and passed verbatim to rustc.

Since cargo fails to associate cases such as 'staticlib,cdylib' to
a specific crate type internally, it has to invoke rustc to determine
the output file types for this unknown crate type, which returns only
the first file type of the first crate type in the list. Consequently
cargo will be looking only for a single '.a' artifact on Linux to be
copied to the target directory.

Fix this by splitting the list of provided crate types into individual
items before further processing them.
2024-09-05 09:58:08 +02:00
Joe Neeman
e262c48d1e Document -Zpackage-workspace 2024-09-05 13:45:16 +07:00
bors
978b4fefe7 Auto merge of #14451 - jschwe:fix_gnullvm_implib, r=weihanglo
uplift windows gnullvm import libraries

Same changes as #8141, but for gnullvm.
gnullvm does not seem to be tested in CI, so tests were not adjusted.

### What does this PR try to resolve?

The `implib` for [gnullvm](https://doc.rust-lang.org/rustc/platform-support/pc-windows-gnullvm.html) targets should end up at the same location as for `gnu` targets.

### Background

I'm not a windows developer, so I may be wrong, but I believe the implib artifacts for gnullvm should be needed in the same way as for the normal windows-gnu target. In my downstream code, I need to know the location of the implib artifact, and would prefer for the location to be the same for both gnullvm and normal gnu.
2024-09-05 06:24:19 +00:00
bors
cb37786157 Auto merge of #14495 - weihanglo:version-bump, r=epage
Bump to 0.84.0; update changelog
2024-09-05 02:48:45 +00:00
Weihang Lo
dcbc524836
doc: update changelog for 1.83.0 2024-09-05 10:37:19 +08:00
Weihang Lo
40302052a3
doc: update changelog for 1.82.0 2024-09-05 10:37:19 +08:00
Weihang Lo
8a93ea488f
doc: update changelog for 1.81.0 2024-09-05 10:37:18 +08:00
Weihang Lo
0c94d6558a
Bump to 0.84.0 2024-09-05 10:12:53 +08:00
bors
40b6638df6 Auto merge of #13765 - dohse:fix-13702, r=epage
Fix cargo add behaving different when translating package name

Fixes #13702
Fixes #10680

TODOs

- [x] ~Fuzzy match registry dependencies in `cargo remove` as well~
     `cargo remove` does not need fuzzy matching, because there is no unexpected behavior for the user
- [x] ~Don't duplicate name permutation generation~
     Unsure whether this is worth it
- [ ] Shall we reject cases where multiple different permutations match?
- [x] Add comments that explain the behavior
2024-09-04 00:17:46 +00:00
bors
9627da3328 Auto merge of #14475 - rust-lang:renovate/core-foundation-0.x, r=epage
chore(deps): update rust crate core-foundation to 0.10.0

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [core-foundation](https://togithub.com/servo/core-foundation-rs) | workspace.dependencies | minor | `0.9.4` -> `0.10.0` |

---

### Release Notes

<details>
<summary>servo/core-foundation-rs (core-foundation)</summary>

### [`v0.10.0`](https://togithub.com/servo/core-foundation-rs/compare/core-foundation-v0.9.4...core-foundation-v0.10.0)

[Compare Source](https://togithub.com/servo/core-foundation-rs/compare/core-foundation-v0.9.4...core-foundation-v0.10.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 5am on the first day of the month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/rust-lang/cargo).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41Ni4wIiwidXBkYXRlZEluVmVyIjoiMzguNTYuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->
2024-09-03 17:55:40 +00:00
bors
fda48a0036 Auto merge of #14471 - epage:msrv, r=ehuss
feat(resolve): Report MSRV compatible version instead of incomptible

### What does this PR try to resolve?

This expands on #14461 to where only MSRV-compatible versions are
"actionable".  MSRV-incompatible versions are therefore unstyled.

We report the MSRV needed so people can choose to unblock by updating
their MSRV.  I had wondered if we should report the the absolute latest
MSRV-incompatible version or the one with the next higher MSRV from
where the user is at.  Both are reasonable use cases, so I erred with
absolute latest version.

```console
$ cargo update --workspace -v
```
![image](https://github.com/user-attachments/assets/27e40dda-287b-4223-a377-0233205307a2)

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

I changed the label from `latest` to `available` to not have to keep coming up with relevant terms for each case.

### Additional information

This is the final step before asking for new feedback on #13908
2024-09-03 15:57:24 +00:00
bors
2807645c79 Auto merge of #14488 - tweag:package-filter-current, r=epage
Don't automatically include the current crate when packaging

This replicates some of the changes in #10677 while packaging. It was split off from #14433
2024-09-03 11:38:53 +00:00