11825 Commits

Author SHA1 Message Date
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
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
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
8b8e9180e3 Make clippy happy
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-01-29 22:15:03 +08: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
bors
7e89966d6c Auto merge of #10306 - eholk:git-default-branch, r=alexcrichton
Fix new::git_default_branch with different default

The test `new::git_default_branch` would fail if the current user had already configured a different default branch.

This patch changes the test to first write a `.gitconfig` file with the default branch set to master. This puts us in a state where we still have the old default, and then the subsequent change to the config file will make sure that config changes are still respected.
2022-01-19 17:09:36 +00:00
Eric Holk
1683cd5eec Refactor create_empty_config to create_default_config 2022-01-19 08:45:03 -08:00
Eric Holk
40c51392dd Fix new::git_default_branch with different default
The test new::git_default_branch would fail if the current user had
already configured a different default branch.

This patch changes the test to first write a .gitconfig file with the
default branch set to master. This puts us in a state where we still
have the old default, and then the subsequent change to the config file
will make sure that config changes are still respected.
2022-01-18 14:51:21 -08:00
Weihang Lo
bee3534f27
test: do not compile test for bins flagged as test = false 2022-01-19 03:36:53 +08:00
Weihang Lo
0a7a7bd5ef
do not compile test for bins flagged as test = false
Binaries without `test = false` are included by default, so no need to
explicitly compile all binaries.
2022-01-19 03:35:35 +08:00
Weihang Lo
f07dcd13a0
test: compile all bins when TESTNAME arg exists
This behavior is not correct should be fixed.
Update this test only for pointing out the current behavior.
2022-01-19 02:47:30 +08:00
bors
95bb3c92bf Auto merge of #10243 - hi-rustin:rustin-patch-collision, r=ehuss
Error when setting crate type of both dylib and cdylib in library

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

Error when setting crate type of both dylib and cdylib in library. Cargo can't support that at this time, since they both output the same filename.
2022-01-18 17:39:35 +00:00
bors
528ab12353 Auto merge of #10300 - ehuss:list-help, r=alexcrichton
Include `help` in `--list`

This adds the `help` subcommand to the `--list` output. It previously was not included because `help` is handled differently from built-in subcommands.
2022-01-18 16:34:43 +00:00
bors
c2950c83ef Auto merge of #10295 - ehuss:bash-report, r=alexcrichton
Add report subcommand to bash completion.

This adds the `cargo report` subcommand to the bash completion.
2022-01-18 15:59:45 +00:00
bors
03e24bcf67 Auto merge of #10296 - ehuss:downgrade-log, r=alexcrichton
Downgrade some log messages.

This lowers the log level of several "info" messages. I find that these can be quite noisy when using log messages, and I don't think need to be such a high log level.
2022-01-18 15:15:28 +00:00
Eric Huss
b655a8965c Include help in --list 2022-01-16 11:14:04 -08:00
bors
e778b3d90a Auto merge of #10298 - hi-rustin:rustin-patch-triagebot, r=ehuss
Enable shortcut for triage bot

### What does this PR try to resolve?

Enable shortcut for triage bot. See: https://github.com/rust-lang/cargo/pull/10167#issuecomment-1013815453
### How should we test and review this PR?

We need to test it after the merge. But there should be no problem with the robot. I refer to the rust configuration file.

### Additional information

I don't know if it is accepted to open it, if we don't want to open it please feel free to close my PR.
2022-01-16 17:02:31 +00:00