18717 Commits

Author SHA1 Message Date
bors
32f024f788 Auto merge of #14537 - Rustin170506:rustin-patch-suggest-cargo-info, r=epage
Suggest `cargo info` command in the `cargo search` result
2024-09-17 15:55:50 +00:00
Rustin170506
0ba7540858 Use the shell.note to print the note
Signed-off-by: Rustin170506 <29879298+Rustin170506@users.noreply.github.com>
2024-09-17 23:53:39 +08:00
Rustin170506
52f8487c79 Suggest cargo info command in the cargo search result 2024-09-17 23:51:57 +08:00
bors
10eaf3400b Auto merge of #14535 - shannmu:_cargo_target_triple, r=epage
feat: Add custom completer for completing target triple

### What does this PR try to resolve?
Tracking issue https://github.com/rust-lang/cargo/issues/14520

Add custom completer for `cargo build --target=<TAB>`
2024-09-17 15:24:50 +00:00
shanmu
7968f54648 feat: Add custom completer for completing target triple 2024-09-17 23:10:57 +08:00
shannmu
f47e2a5b43 feat: Add custom completer for completing test names 2024-09-17 12:40:14 +08:00
bors
75ab4e5119 Auto merge of #14536 - shannmu:_cargo_unstable_flags, r=epage
feat: Add custom completer for `cargo -Z <TAB>`

### What does this PR try to resolve?
Tracking issue https://github.com/rust-lang/cargo/issues/14520

Add custom completer for `cargo -Z <TAB>`
2024-09-16 15:04:18 +00:00
bors
654a433361 Auto merge of #14534 - shannmu:_cargo_installed_crates, r=epage
feat: Add custom completer for completing installed binaries

### What does this PR try to resolve?
Tracking issue https://github.com/rust-lang/cargo/issues/14520

Add custom completer for `cargo uninstall <TAB>`
2024-09-16 14:27:32 +00:00
bors
7984efa4d6 Auto merge of #14533 - shannmu:_bin_names, r=epage
feat: Add custom completer for completing bin names

### What does this PR try to resolve?
Tracking issue https://github.com/rust-lang/cargo/issues/14520

Add custom completer for `cargo build --bin=<TAB>`
2024-09-16 13:55:18 +00:00
shannmu
8b2f08cc88 feat: Add custom completer for cargo -Z <TAB> 2024-09-16 03:22:37 +08:00
bors
a9a418d1a2 Auto merge of #14547 - weihanglo:only-update-clap, r=ehuss
chore: revert change to Cargo.lock in f25806c

Some unrelated dependencies has been updated and blocked CI.

See rust-lang/rust#130377
2024-09-15 19:13:12 +00:00
shannmu
954581bdfb feat: Add custom completer for completing installed binaries 2024-09-16 02:51:16 +08:00
Weihang Lo
4689efefa7
chore: necessary lock updates for clap_complete 2024-09-15 14:45:02 -04:00
Weihang Lo
fcaafa45f2
chore: revert change to Cargo.lock in f25806c472fd36f1ab0a8ba8a6a003f78734dd60
Some unrelated dependencies have been updated and blocked CI.
See rust-lang/rust 130377
2024-09-15 14:44:59 -04:00
shannmu
93fc5646d9 feat: Add custom completer for completing bin names 2024-09-16 02:31:14 +08:00
bors
468f1500bd Auto merge of #14546 - ehuss:disable-shell-completions, r=weihanglo
Disable the shell_completions tests

The shell_completions tests have a few issues that are causing some problems. See https://github.com/rust-lang/cargo/issues/14545 for a description. This disables the tests until those can get resolved.
2024-09-14 19:24:54 +00:00
bors
d949021e91 Auto merge of #14530 - stormshield-guillaumed:vendor, r=weihanglo
fix(vendor): trust crate version only when coming from registries

### What does this PR try to resolve?

Fixes #8181
Relates to #11897 and #14525

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

As mentioned in the contribution guide, I made a first commit adding a test that passes with the actual behaviour. Then, I made a second commit with a fix and modified the test with the new expected  behaviour.

### Additional information

The fix doesn't take into account switching from a git dependency to crates.io, which is not handled correctly on master either, and would probably require the vendoring to serialize the source ID to detect source changes.

I specifically limited the trust of immutable version to crates.io, but it could be extended to other registries.
2024-09-14 18:56:06 +00:00
Eric Huss
47f4cdc093 Disable the shell_completions tests 2024-09-14 11:53:00 -07:00
Ed Page
2107a43cb7 refactor(update): Clarify what each checks intention is 2024-09-13 10:56:40 -04:00
bors
643a025b3c Auto merge of #14540 - RalfJung:docs-target, r=weihanglo
docs: Feature resolver version 2: clarify use of 'target'

IIUC, these two uses of the word `target` right next to each other in the docs actually have different meaning. That is kind of confusing, so add disambiguators and links to the glossary that should help clarify this.
2024-09-12 13:57:01 +00:00
Ralf Jung
38b6ae05e2
Cargo is a Proper Name
Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
2024-09-12 15:22:02 +02:00
Guillaume Dallenne
a53b81a49d
fix(vendor): trust crate version only when coming from registries 2024-09-12 09:10:30 +02:00
Guillaume Dallenne
5fa43ee1c5
test(vendor): add test case updating git dependency without version change 2024-09-12 09:03:49 +02:00
Ralf Jung
8a6c9aebe0 docs: Feature resolver version 2: clarify use of 'target' 2024-09-12 07:57:14 +02:00
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