Commit graph

11837 commits

Author SHA1 Message Date
bors be4bb61d04 Auto merge of #10341 - hi-rustin:rustin-patch-doc-deps, r=ehuss
Compute non custom build and non transitive deps for doc

### What does this PR try to resolve?

close https://github.com/rust-lang/cargo/issues/10318 and close https://github.com/rust-lang/cargo/issues/9198
### How should we test and review this PR?

Compute non custom build and non transitive deps for doc.
Add test for it.
2022-02-03 17:53:13 +00:00
hi-rustin bd45ac81ba Inline non_custom_build_and_non_transitive_deps
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-02-03 23:32:37 +08:00
bors 25fcb135d0 Auto merge of #10349 - epage:install, r=ehuss
fix(install): Keep v1 file formatting the same

Inspired by #10345, I looked for other cases where
`toml_edit::easy::to_string` is used (which outputs inline tables) to
see if we should switch to `to_string_pretty`.  The crates v1 file was
the only case I found.

As a side effect, we can no longer elide the empty `dev-dependencies`
table in published manifests.  This was the behavior before `toml_edit`,
so not much of a loss.
2022-02-01 01:32:48 +00:00
bors a59d202ed7 Auto merge of #10348 - epage:vendor, r=alexcrichton
fix(vendor): Use tables for sample config

Fixes #10345
2022-01-31 19:16:05 +00:00
bors 74ec39f082 Auto merge of #10347 - a1phyr:patch-1, r=weihanglo
Add bash completion for `cargo clippy`

### What does this PR try to resolve?

Having shell completion on `cargo clippy` is useful
2022-01-31 18:35:04 +00:00
bors ea259a07f5 Auto merge of #10337 - WaffleLapkin:merge_futures_with_all_features, r=alexcrichton
Do not ignore `--features` when `--all-features` is present

This allows to specify dependency features when using `--all-features`, for example:
```shell
$ cargo run --example example --all-features --features="tracing/log"
```
You can test this in this repository: https://github.com/WaffleLapkin/cargo_all_some_features, it contains an example with ``required-features = [..., "tracing/log"]`` that is impossible to run with `--all-features` without this patch.

An attempt to fix #10333
2022-01-31 17:52:10 +00:00
bors 641a51525e Auto merge of #10350 - epage:edit, r=alexcrichton
test: Fix compatibilty with new toml_edit

`toml_edit` fixed a bug in 0.13.4 that this test was relying on that is
meant to help with rust-lang/cargo#10349.  This basically restores us
back to the pre-toml_edit behavior for published manifests.

I included the `Cargo.toml` change to ensure any existing lock files on people's machines get updated so the test won't mysteriously start failing for them when doing a `pull`.
2022-01-31 17:06:50 +00:00
Ed Page 0f75237617 test: Fix compatibilty with new toml_edit
`toml_edit` fixed a bug in 0.13.4 that this test was relying on that is
meant to help with rust-lang/cargo#10349.  This basically restores us
back to the pre-toml_edit behavior for published manifests.
2022-01-31 10:57:38 -06:00
Ed Page 24defcbc14 fix(install): Keep v1 file formatting the same
Inspired by #10345, I looked for other cases where
`toml_edit::easy::to_string` is used (which outputs inline tables) to
see if we should switch to `to_string_pretty`.  The crates v1 file was
the only case I found.

As a side effect, we can no longer elide the empty `dev-dependencies`
table in published manifests.  This was the behavior before `toml_edit`,
so not much of a loss.
2022-01-31 10:42:05 -06:00
Ed Page fb9d11b8fc fix(vendor): Use tables for sample config
Fixes #10345
2022-01-31 09:57:56 -06:00
Alphyr f864bc3070
Add bash completion for cargo clippy 2022-01-31 09:31:15 +01:00
bors b2496f0590 Auto merge of #10274 - aviramha:extra-link-args, r=ehuss
extra-link-arg-etc: support all link types (credit @davidhewitt)

This commit adds support for the remaining link types to `-Zextra-link-arg-etc`:
`
rustc-link-arg-tests
rustc-link-arg-benches
rustc-link-arg-examples
`
This would be useful in PyO3, where users writing Python extension modules (which do link against libpython) want to run cargo tests for extension module. As executables, these tests need to link against libpython.

This is a follow up of https://github.com/rust-lang/cargo/pull/9416 by `@davidhewitt`
2022-01-30 16:29:27 +00:00
Maybe Waffle b7e5186701 Add test for --all-features --features dep/feat 2022-01-30 13:33:08 +03:00
bors f639ea3b96 Auto merge of #10340 - hi-rustin:rustin-patch-clippy, r=ehuss
Make clippy happy

Remove needless borrow.
2022-01-29 19:46:40 +00:00
hi-rustin 81c2cd5a95 Compute non custom build and non transitive deps for doc
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-01-30 00:06:27 +08:00
hi-rustin 8b8e9180e3 Make clippy happy
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-01-29 22:15:03 +08:00
Maybe Waffle 3d74ad8e3c Do not ignore --features when --all-features is present
This allows to specify dependency features when using `--all-features`,
for example:
```shell
$ cargo run --package a --example example --all-features --features="tracing/log"
```
2022-01-28 02:49:42 +03:00
Aviram Hassan 541c908ef6
extra-link-arg-etc: support all link types (credit @davidhewitt) 2022-01-27 21:57:57 +02:00
bors 890647485c Auto merge of #10338 - ehuss:doc-semver-link, r=alexcrichton
Update publishing link for semver rules.

This updates the publishing guide to point to the chapter on SemVer rules which is more complete and up-to-date than RFC 1105.
2022-01-27 19:43:54 +00:00
Eric Huss 01cbccefde Update publishing link for semver rules. 2022-01-27 11:34:59 -08:00
bors 51379053ef Auto merge of #10335 - weihanglo:issue-10283, r=alexcrichton
Normalize --path when install bin outside current workspace
2022-01-27 15:55:17 +00:00
bors 06739821da Auto merge of #10336 - weihanglo:bump-clap, r=ehuss
Bump clap to v3.0.13
2022-01-27 15:17:25 +00:00
Weihang Lo 11c50416c2
Assert optional args with square brackets [arg...] 2022-01-27 19:28:51 +08:00
Weihang Lo 13a09beccf
Bump clap to 3.0.13 2022-01-27 19:27:52 +08:00
Weihang Lo 76301ebab9
Test: install bin with --path outside current workspace 2022-01-27 18:31:02 +08:00
Weihang Lo 44f650f260
Normalize --path to install bin outside current workspace
For `Workspace::find_root`, `cargo_util::path::PathAncestors` won't do
path normalization while walking back the ancestors. The responsibility
lies in the caller. Thus, `cargo install` should normalize its `--path`
argument before passing in `SourceId::for_path` and `Workspace::new`.

`Config::reload_rooted_at` is not affected because cargo always starts
searching and merging configs from where it is invoked.
2022-01-27 18:31:02 +08:00
Weihang Lo d323ad672c
Test: install with path outside current workspace
Make up this test case to reflect the current incorrect behavior.
2022-01-27 18:31:01 +08:00
bors 1c034752de Auto merge of #10329 - ehuss:sync-toml-edit, r=alexcrichton
Sync toml_edit versions

I missed in the review of #10086 that the toml_edit versions weren't in sync everywhere.
2022-01-25 22:36:53 +00:00
Eric Huss 54e7f684a8 Sync toml_edit versions 2022-01-25 14:33:32 -08:00
bors 018acfdddd Auto merge of #10176 - jonhoo:config-cli-simple, r=ehuss
Check --config for dotted keys only

This addresses the remaining unresolved issue for `config-cli` (#7722).
2022-01-25 17:53:34 +00:00
Jon Gjengset 02e071c630 Use implicit captured format args 2022-01-25 09:37:05 -08:00
bors 5145bd212b Auto merge of #10327 - hi-rustin:rustin-patch-host, r=ehuss
Remove deprecated --host arg for search and publish cmds

### What does this PR try to resolve?

close https://github.com/rust-lang/cargo/issues/10304

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

Remove deprecated --host arg for search and publish cmds.
2022-01-25 17:14:56 +00:00
bors f8942151e7 Auto merge of #10326 - matklad:out-dir-for-intermediates, r=alexcrichton
doc: it's valid to use OUT_DIR for intermediate artifacts

Eg, storing `.o` files in OUT_DIR is ok! See
https://github.com/rust-lang/cargo/issues/9661#issuecomment-1021029381
for some discussion.
2022-01-25 16:37:11 +00:00
bors b5e2e397d9 Auto merge of #10323 - ehuss:local-git-info, r=alexcrichton
Use local git info for version.

#10178 caused an unintended change where cargo is being built twice in rust-lang/rust's CI.  It is being built once as a CLI, and a second time for RLS.  The cause is the `CFG_COMMIT_HASH` environment variable changes between those two builds (it is set for the tool being built).

The solution here is to grab the git information from cargo's own build script. This is guaranteed to always be in the `src/tools/cargo` directory for both tools.

This should help save a minute or two in the dist builders.
2022-01-25 15:50:45 +00:00
hi-rustin d8ef89867c Remove deprecated --host arg for search and publish cmds
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-01-25 22:34:12 +08:00
Aleksey Kladov 0468cd6db4 doc: it's valid to use OUT_DIR for intermediate artifacts
Eg, storing `.o` files in OUT_DIR is ok! See
https://github.com/rust-lang/cargo/issues/9661#issuecomment-1021029381
for some discussion.
2022-01-25 13:22:48 +03:00
bors 9978fd72c8 Auto merge of #10324 - ehuss:fix-doc-undocumented-dep, r=alexcrichton
Fix documenting with undocumented dependencies.

#10201 introduced a bug where dependencies that have `doc=false` weren't being built at all when running `cargo doc` if the project did not have any binaries.  That means the rmeta file was missing, and the `--extern` flag was not being passed to rustdoc.

The solution is to ensure the `rmeta` file gets generated, but only skip generating the `CompileMode::Doc` unit for undocumented dependencies.

This unblocks the bootstrap bump.
2022-01-25 04:48:08 +00:00
Eric Huss fdeb38b903 Fix documenting with undocumented dependencies. 2022-01-24 17:10:05 -08:00
Eric Huss 295ea6d940 Use local git info for version. 2022-01-24 15:28:04 -08:00
Jon Gjengset 51917b450d Enforce no decorators in --config values 2022-01-24 12:05:12 -08:00
Jon Gjengset c4f4e20f24 Better example in error 2022-01-24 10:08:19 -08:00
Jon Gjengset ea6d9f106c Avoid re-parsing config-cli toml 2022-01-20 13:28:29 -08:00
Jon Gjengset f962ec1f44 Merge remote-tracking branch 'upstream/master' into config-cli-simple 2022-01-20 12:31:35 -08:00
bors 58790d3b5e Auto merge of #10305 - weihanglo:issue-10268, r=alexcrichton
do not compile test for bins flagged as `test = false`

### What does this PR try to resolve?

Fixes #10268

#6683 introduced a behavior that compiles all bin targets, but for bins with `test = false` they shouldn't be compiled with `--test` as testbins.

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

In the first commit of this PR, I refines the test `test_filtered_excludes_compiling_examples` to reflect the current wrong behavior (test passed). The following two commits correct the behavior and the test accordingly. The last few commits encapsulate scattered target selection logic into functions on `CompileFilter`.
2022-01-20 15:07:43 +00:00
Weihang Lo 2f5b3033f2
Update doc for CompileFilter 2022-01-20 13:02:17 +08:00
Weihang Lo ecbaec1a9f
Use new_all_targets in cargo-fix when no target selection exists 2022-01-20 13:02:17 +08:00
Weihang Lo 0a73f8b9fd
Extract logic of single bin target filter to single_bin 2022-01-20 13:02:17 +08:00
Weihang Lo 5aa985c42a
Extract logic of lib target only filter to lib_only 2022-01-20 13:02:05 +08:00
Weihang Lo 9138c35d8c
Extract logic of all test target filter to all_test_targets 2022-01-20 13:01:54 +08:00
bors bb96b3a3e8 Auto merge of #10086 - epage:toml, r=ehuss
Port cargo from toml-rs to toml_edit

Benefits:
- A TOML 1.0 compliant parser
- Unblock future work
  - Have `cargo init` add the current crate to the workspace, rather
    than error
  - #5586: Upstream `cargo-add`

TODO
- [x] Analyze performance and address regressions
- [x] Identify and resolve incompatibiies
- [x] Resolve remaining test failures, see
      https://github.com/ordian/toml_edit/labels/cargo
- [x] ~~Switch the code from https://github.com/rust-lang/cargo/pull/10176 to only parse once~~ (this PR is being merged first)
2022-01-20 03:56:18 +00:00