8727 Commits

Author SHA1 Message Date
Eric Huss
285dc3182a Update documentation for custom target dependencies. 2019-11-22 10:22:26 -08:00
bors
579174c03b Auto merge of #7593 - LukasKalbertodt:master, r=Eh2406
Document private items for binary crates by default

I suggested this change in default behavior [a long time ago](https://github.com/rust-lang/cargo/issues/1520#issuecomment-135215284) and [a year ago again](https://github.com/rust-lang/cargo/issues/1520#issuecomment-420616261). Both time, everyone seemed to agree that this is a good idea, so I thought I could just implement it.

This PR already changed the default behavior, but there are a few things we should talk about/I should do before merging:

- [x] ~~Do we *really* want this changed default behavior? If not, *why* not?~~ -> [yip](https://github.com/rust-lang/cargo/pull/7593#issuecomment-556482199)
- [x] Is changing this default behavior OK regarding backwards compatibility? -> [apparently](https://github.com/rust-lang/cargo/pull/7593#issuecomment-556482199)
- [x] ~~We should also probably add a `--document-only-public-items` flag or something like that if we change the default behavior. Otherwise users have no way to not document private items for binary crates. Right?~~ -> [We can do it later](https://github.com/rust-lang/cargo/pull/7593#issuecomment-557152039)
- [x] I should probably add some tests for this new behavior -> I did
- [ ] I don't like that I added `rustdoc_document_private_items` to `CompileOptions`, but this was the sanest way I could think of without rewriting a whole lot. Is this OK or how else would one do it? The flag would belong to `DocOptions`. But `compile` does not have access to that. Any ideas? Btw: If we also add `--document-only-private-items`, I would change the type from `bool` to `Option<bool>`.
2019-11-21 21:29:31 +00:00
Lukas Kalbertodt
00b21c8b46
Add tests for documenting private items by default in binary crates 2019-11-21 22:14:42 +01:00
bors
5252abbfef Auto merge of #7616 - ehuss:registry-naming-restrictions, r=Eh2406
Extend documentation on security concerns of crate names in a registry.
2019-11-21 20:04:29 +00:00
Eric Huss
4c7534e548 Extend documentation on security concerns of crate names in a registry. 2019-11-21 10:56:13 -08:00
bors
fb4415090f Auto merge of #7560 - ehuss:stabilize-install-upgrade, r=alexcrichton
Stabilize install-upgrade.

Tracking issue: #6797

This stabilizes the install-upgrade feature, which causes `cargo install` to reinstall a package if it appears to be out of date, or exit cleanly if it is up-to-date.

There are no changes from `-Zinstall-upgrade`. See [the old unstable docs](6a7f505a18/src/doc/src/reference/unstable.md (install-upgrade)) for a refresher on the details of what it does.

This also stabilizes the following changes:
- `--version` no longer allows an implicit version requirement like `1.2`.  It must be either contain all 3 components (like `1.2.3`) or use a requirement operator (like `^1.2`).  This has been a warning for a very long time, and is now changed to a hard error.
- Added `--no-track` to disable install tracking.

**Motivation**

I just personally prefer this behavior, and it has been requested a few times in the past. I've been using it locally, and haven't run into any issues. If this goes into 1.41, then it will release on Jan 30, about 10 months since it was added in #6798.

**Concerns**

Regarding some of the concerns I had:

- Is it tracking the correct set of information?

  I'm satisfied with the current set. It also tracks, but does not use, the version of rustc and the version specified in the `--version` flag, in case we ever want to use that in the future. It is also designed to be backwards and forwards compatible, so more information can be added in the future. I think the current set strikes a good balance of tracking the really important things, without causing unnecessary rebuilds.

- Method to upgrade all outdated packages?

  This can always be added as a new flag or command in the future, and shouldn't block stabilization.

- Should `--no-track` be kept? Does it work correctly?

  I kept it. It's not too hard to support, and nobody said anything (other than maybe using a less confusing name).

- Should this be the default? Should there be a way to use the old behavior?

  I like it as the default, and don't see a real need for the old behavior. I think we could always bring back the old behavior with a flag in the future, but I would like to avoid it for simplicity. There is also the workaround of `which foo || cargo install foo`.

Closes #6797.
Closes #6727.
Closes #6485.
Closes #2082.
2019-11-21 15:59:06 +00:00
bors
dba478b4f0 Auto merge of #7579 - alexcrichton:lockfile-fmt, r=ehuss
Turn the new lock file format on by default

This commit enables the support added in #7070 by default. This means
that gradually over time all `Cargo.lock` files will be migrated to the
new format. Cargo shipped with Rust 1.38.0 supports this new lock file
format, so any project using Rust 1.38.0 or above will converge quickly
onto the new lock file format and continue working.

The main benefit of the new format is to be more friendly to git merge
conflicts. Information is deduplicated throughout the lock file to avoid
verbose `depedencies` lists and the `checksum` data is all listed inline
with `[[package]]`. This has been deployed with rust-lang/rust for some
time now and it subjectively at least seems to have greatly reduced the
amount of bouncing that happens for touching `Cargo.lock`.
2019-11-19 18:50:48 +00:00
bors
ad618cf5eb Auto merge of #7609 - RalfJung:im-rc, r=alexcrichton
bump im-rc version

This bumps im-rc to a version that includes (transitively) the soundness fix in https://github.com/bodil/sized-chunks/pull/3.

* [im-rc changelog](https://github.com/bodil/im-rs/blob/master/CHANGELOG.md#1400---2019-11-19)
2019-11-19 15:34:04 +00:00
bors
0557335525 Auto merge of #7602 - chris-morgan:ignore-flock-if-unsupported-windows, r=alexcrichton
Ignore file lock errors if unsupported, on Windows

Not all file systems support file locking; WSL’s network file system doesn’t seem to, and I don’t think other network file systems will, either (though I haven’t checked them). ERROR_INVALID_FUNCTION is Windows’ equivalent to Unix’s ENOTSUP and Linux’s ENOSYS which are checked just above.

Fixes #7511.
2019-11-19 15:16:17 +00:00
bors
776ba5fc0b Auto merge of #7607 - ehuss:fwdansi-hack, r=alexcrichton
Add hack for fwdansi change.

This is a hack to fix a test failing on CI.

The issue is that fwdansi 1.1 was published with a change on how it processes reset codes. I have filed https://github.com/kennytm/fwdansi/issues/2 with some details on some of the issues.

This is just a workaround to get the test to pass.  I'm not too happy with it, but other choices seemed less than ideal.  Am happy to consider them, though:

- Remove fwdansi, and give up supporting color on Win 7/8, old 10.
- Change `Shell` so that it knows whether or not the console supports ANSI, and only use fwdansi when necessary.  This means Win 10 would stop using fwdansi, but 7/8 would continue to use it. It is a little awkward – I think it would have to call wincolor::set_virtual_terminal_processing and see if it succeeds.
- Wait for a change to fwdansi to make resets more transparent.

I am very tempted by the first choice.  rustc's color output has been broken on win 7/8 for a long time, and only a very small number of people have complained.  I have spent way too much time dealing with something I think nobody really uses.

cc @kennytm
2019-11-19 14:57:22 +00:00
Ralf Jung
dc0959717c bump im-rc version 2019-11-19 15:36:46 +01:00
Eric Huss
8149c7fbbf Add hack for fwdansi change. 2019-11-18 17:25:47 -08:00
Alex Crichton
c37a46ced4 Handle a case where cargo new oscillates 2019-11-18 07:27:18 -08:00
Chris Morgan
60aa78e184 Ignore file lock errors if unsupported, on Windows
Not all file systems support file locking; WSL’s network file system
doesn’t seem to, and I don’t think other network file systems will,
either (though I haven’t checked them). ERROR_INVALID_FUNCTION is
Windows’ equivalent to Unix’s ENOTSUP and Linux’s ENOSYS which are
checked just above.

Fixes #7511.
2019-11-18 20:20:03 +11:00
bors
e55600b1dd Auto merge of #7595 - ehuss:doc-json, r=Eh2406
Document Cargo's JSON output.

This adds some documentation explaining Cargo's `--message-format=json` output.
2019-11-16 00:11:41 +00:00
Eric Huss
a280f8a52f Document Cargo's JSON output. 2019-11-15 13:03:47 -08:00
bors
4aa17ede79 Auto merge of #7588 - TransmissionsDev:master, r=alexcrichton
Remove "cargo login" from user input when asking for login token.

Hey all!

This is my first time contributing to open source, but I realized that I could help some people out and make a quick change. 😄

When running cargo login, I was told to `please visit https://crates.io/me and paste the API Token below`. However, me on autopilot accidentally pasted the whole `cargo login $APITOKEN` string on the website into `cargo login` and it took me almost 30 minutes to figure out why I couldn't publish a package.

I thought it would be useful to automatically remove `cargo login` from the token, just in case someone makes the brain dead mistake like me.

Hope I can get some good feedback on this, have a great one! ❤️
2019-11-15 16:48:41 +00:00
bors
3738e1db45 Auto merge of #7574 - igor-makarov:clippy-fixes, r=Eh2406
Fix all Clippy suggestions (but not add it to CI 🙃)

This PR adds a `clippy` job to the Azure Pipelines CI.

In addition to adding the job, I made sure to fix all the lints in all the packages.

I'm new to Rust, so please check my code modifications extra carefully 😂
2019-11-15 15:01:50 +00:00
Lukas Kalbertodt
e7ee237ce0
Add --document-private-items for binary crates by default 2019-11-15 15:29:58 +01:00
Igor Makarov
1432651900 Remove clippy from pipelines - @Eh2406 asked that the commit will be kept
This reverts commit 4a1207caaa6ff574f63da0f0c4c797fc3ea2cf22.
2019-11-15 10:52:47 +02:00
t11s
648b39e981
Run code through rustfmt 2019-11-14 19:13:19 -08:00
t11s
290db51231
Update registry.rs 2019-11-14 10:04:55 -08:00
bors
d0a41bed08 Auto merge of #7132 - ehuss:metadata-kind, r=alexcrichton
Add kind/platform info to `cargo metadata`

This adds an array `"dep_kinds"` to the resolve nodes of the `cargo metadata` output. It looks something like this:

```javascript
"resolve": {
  "nodes": [
    "id": "cargo 0.39.0 (path+file:///Users/eric/Proj/rust/cargo2)",
    "deps": [
      {
        "name": "bufstream",
        "pkg": "bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
        "dep_kinds": [
          {
            "kind": "dev",
            "target": null
          }
        ]
      },
      {
        "name": "winapi",
        "pkg": "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
        "dep_kinds": [
          {
            "kind": null,
            "target": "cfg(windows)"
          }
        ]
      }
    ]
  ]
}
```

This allows one to filter the graph based on the dependency kind and platform.

I'm not completely confident that this is the right course, but I can't think of a better design. In particular, it seems a little strange to include all platforms, but features get filtered. This is probably not a problem in practice (one can use `--all-features` to ensure all features are shown for the top-level packages). Filtering out based on platform is very difficult, because you cannot determine from the resolve alone which nodes will be host vs target. That requires the entire Unit graph. We may expose the Unit graph in the future, but this seems like a useful and simple step.

This is a draft because I wanted to discuss this before moving forward. I'd like to add some more tests.

cc #4632. This doesn't filter based on target, but does expose the target names. As mentioned above, I don't think filtering is possible.
cc #5583. This adds more information.
Closes #3984.
Closes #4631 (I think).

cc @sfackler who filed some of these issues.
2019-11-14 15:09:43 +00:00
t11s
4ec6aac5cf
Remove ";" 2019-11-13 19:52:52 -08:00
t11s
99a577871e
Add some safety rails :D 2019-11-13 19:49:49 -08:00
bors
962b8de7ce Auto merge of #7585 - rust-lang:dependabot/cargo/core-foundation-0.7.0, r=alexcrichton
Update core-foundation requirement from 0.6.0 to 0.7.0

Updates the requirements on [core-foundation](https://github.com/servo/core-foundation-rs) to permit the latest version.
<details>
<summary>Commits</summary>

- [`0a3ac83`](0a3ac83c1b) Auto merge of [#349](https://github-redirect.dependabot.com/servo/core-foundation-rs/issues/349) - wez:timertypes, r=jdm
- [`a119788`](a11978895e) even more version bumps
- [`6574b12`](6574b12d4a) more version bumps!
- [`0718126`](071812648a) Auto merge of [#350](https://github-redirect.dependabot.com/servo/core-foundation-rs/issues/350) - lqf96:fix-deprecated-usage, r=jdm
- [`83b6f5d`](83b6f5d20a) Use zero-initialized array in CFURL::to_path
- [`3126f15`](3126f15fd6) adjust test
- [`d3a097f`](d3a097f2a4) Use dyn for dynamic dispatch
- [`e438fc5`](e438fc54b9) Use ? instead of try macro
- [`727837f`](727837f12e) Use MaybeUninit instead of mem::uninitialized
- [`e7f687e`](e7f687e3d4) moar version bumps
- Additional commits viewable in [compare view](https://github.com/servo/core-foundation-rs/compare/core-foundation-v0.6.2...core-foundation-v0.7.0)
</details>
<br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

</details>
2019-11-13 15:04:18 +00:00
dependabot-preview[bot]
7762e73f73
Update core-foundation requirement from 0.6.0 to 0.7.0
Updates the requirements on [core-foundation](https://github.com/servo/core-foundation-rs) to permit the latest version.
- [Release notes](https://github.com/servo/core-foundation-rs/releases)
- [Commits](https://github.com/servo/core-foundation-rs/compare/core-foundation-v0.6.2...core-foundation-v0.7.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-13 05:12:59 +00:00
Alex Crichton
013c1afb9a Add support for new lockfile formats on new projects
This commit adds support to Cargo and refactors the lockfile versioning
slightly. The goal here is that Cargo continually has two thresholds of
lockfile formats to create:

* One is used for new lock files at all times
* The other is used to update old lock files

The logic for these two thresholds is appropriately updated throughout
Cargo, and then this commit also preserves the previous update where new
lock files will get the new format, but old lockfiles will continue to
retain the old format by default.
2019-11-12 07:19:27 -08:00
Alex Crichton
366ae3f7ba Turn the new lock file format on by default
This commit enables the support added in #7070 by default. This means
that gradually over time all `Cargo.lock` files will be migrated to the
new format. Cargo shipped with Rust 1.38.0 supports this new lock file
format, so any project using Rust 1.38.0 or above will converge quickly
onto the new lock file format and continue working.

The main benefit of the new format is to be more friendly to git merge
conflicts. Information is deduplicated throughout the lock file to avoid
verbose `depedencies` lists and the `checksum` data is all listed inline
with `[[package]]`. This has been deployed with rust-lang/rust for some
time now and it subjectively at least seems to have greatly reduced the
amount of bouncing that happens for touching `Cargo.lock`.
2019-11-12 07:00:18 -08:00
Igor Makarov
2a49ac94d0 suppress clippy lint inefficient_to_string - according to reviewers' preference 2019-11-12 10:57:13 +02:00
Igor Makarov
1c5861c8b4 implement clippy suggestion to remove redundant clone 2019-11-12 10:56:27 +02:00
Igor Makarov
e8a8f76432 suppress clippy lint block_in_if_condition_stmt in the testsuite because fixing it upsets rustfmt 2019-11-12 10:56:07 +02:00
Igor Makarov
60f88a4b7a implement clippy suggestion not to use assert_eq on () 2019-11-12 10:55:11 +02:00
Igor Makarov
6d21f9e08c silence several clippy lints in tests 2019-11-12 10:54:59 +02:00
Igor Makarov
b590183d87 suppress clippy lint needless_doctest_main 2019-11-12 10:49:04 +02:00
Igor Makarov
b3fe6b7d27 implement clippy suggestion to remove redundant to_string 2019-11-12 10:21:21 +02:00
Igor Makarov
37ec84d09a implement clippy suggestion to remove needless return 2019-11-12 10:21:21 +02:00
Igor Makarov
e1501f17ab refactor method to avoid calling unwrap() explicitly 2019-11-12 10:21:21 +02:00
Igor Makarov
b7e17785a8 implement clippy suggestion to use or_else instead of or to avoid unintended side effects 2019-11-12 10:20:14 +02:00
Igor Makarov
b31bf0444a implement clippy suggestion to remove needless return 2019-11-12 10:20:14 +02:00
Igor Makarov
230d353367 implement clippy suggestion to use if as an expression 2019-11-12 10:20:14 +02:00
Igor Makarov
018e8dea6e implement clippy suggestion to use or_insert_with 2019-11-12 10:20:14 +02:00
Igor Makarov
b98673fc42 remove suppression of clippy lint too_many_arguments 2019-11-12 10:20:14 +02:00
Igor Makarov
4a1207caaa add clippy to the pipelines 2019-11-12 10:20:14 +02:00
bors
8280633db6 Auto merge of #7580 - alexcrichton:less-unwrap, r=ehuss
Don't panic when parsing `/proc/stat`

Use more robust error handling than `.unwrap()`!

Closes #7577
2019-11-11 23:17:05 +00:00
Eric Huss
f7b29716ed Stabilize install-upgrade. 2019-11-11 14:47:48 -08:00
bors
1292915a99 Auto merge of #7575 - orium:fix-unused-warnings, r=alexcrichton
Fix unused configuration key warning for a few keys under `build`.

Recently cargo started to warn about configuration keys that he doesn't know about.  However, there are a few keys under `build` that were used in a dynamic way (`rustc`, `rustdoc`, and `rustc_wrapper`) by `Config::maybe_get_tool()`.

Since these keys are not known to exist when `Config` is deserialized, cargo was emitting unused warnings.

This commit makes those config keys explicit.  Note that by doing so there is a small breaking change: before it was possible to have `build.rustc_wrapper` in the configuration file (even though the documented key uses kebak-case), and now that key will be ignored.  (Good thing we have warnings for unrecognized keys!)
2019-11-11 22:42:50 +00:00
bors
f6122844f8 Auto merge of #7576 - orium:add-back-support-for-browser-envvar, r=alexcrichton
Add back support for `BROWSER` envvar in `cargo doc --open`.

Fixes #6064.
Fixes #5965.
2019-11-11 22:24:12 +00:00
Diogo Sousa
23a2efe7fb Add back support for BROWSER envvar in cargo doc --open.
Fixes #6064.
Fixes #5965.
2019-11-11 19:32:47 +00:00
bors
dd3466881e Auto merge of #7570 - twe4ked:already-existing-git-ignore-comment, r=alexcrichton
Only include "already existing ..." comment in gitignore on conflict

I found the comment a bit confusing when I've used `cargo init` when I haven't had any conflicts. I thought it was meaning that my existing entries would be all commented out so I thought there was a bug of some kind.

This PR changes the comment to only be included when there are conflicting entries in the existing file.
2019-11-11 18:37:02 +00:00