]> git.proxmox.com Git - cargo.git/log
cargo.git
2 years agoFix debug panic on download with redirect body.
Eric Huss [Fri, 5 Nov 2021 23:06:32 +0000 (16:06 -0700)]
Fix debug panic on download with redirect body.

2 years agoAuto merge of #10040 - ehuss:update-curl, r=alexcrichton
bors [Fri, 5 Nov 2021 04:51:10 +0000 (04:51 +0000)]
Auto merge of #10040 - ehuss:update-curl, r=alexcrichton

Update curl.

Update curl to bring in the fixes for OpenSSL 3 support.

Fixes #10013

2 years agoUpdate curl.
Eric Huss [Fri, 5 Nov 2021 04:14:19 +0000 (21:14 -0700)]
Update curl.

2 years agoAuto merge of #10037 - willcrichton:example-analyzer, r=alexcrichton
bors [Thu, 4 Nov 2021 19:30:42 +0000 (19:30 +0000)]
Auto merge of #10037 - willcrichton:example-analyzer, r=alexcrichton

Fix --scrape-examples-target-crate using package name (with dashes) instead of crate name (with underscores)

This PR fixes #10035.

2 years agoFix --scrape-examples-target-crate using package name (with dashes) instead of crate...
Will Crichton [Thu, 4 Nov 2021 18:23:40 +0000 (11:23 -0700)]
Fix --scrape-examples-target-crate using package name (with dashes) instead of crate name (with underscores), closes #10035

2 years agoAuto merge of #10018 - Some-Dood:chore/use-hashmap-from, r=alexcrichton
bors [Fri, 29 Oct 2021 14:45:06 +0000 (14:45 +0000)]
Auto merge of #10018 - Some-Dood:chore/use-hashmap-from, r=alexcrichton

Chore: prefer `HashMap::from` rather than collecting `Vec` of tuples

Hello there! Since Cargo upgraded to the 2021 Edition recently (which implies a `rust-version` of `1.56` or greater), I figured now may be a good time to use the new [`HashMap::from` shortcut](https://doc.rust-lang.org/stable/std/collections/struct.HashMap.html#impl-From%3C%5B(K%2C%20V)%3B%20N%5D%3E) of rust-lang/rust#84111. There should be no change in behavior here, but it does make the code a little bit neater! đźŽ‰

2 years agoAuto merge of #10017 - willcrichton:example-analyzer, r=alexcrichton
bors [Fri, 29 Oct 2021 14:07:40 +0000 (14:07 +0000)]
Auto merge of #10017 - willcrichton:example-analyzer, r=alexcrichton

Change --scrape-examples flag to -Z rustdoc-scrape-examples

I'm working on getting the scrape examples feature working on docs.rs. However, docs.rs uses `cargo rustdoc` instead of `cargo doc`, and right now the `--scrape-examples` flag is only allowed for `cargo doc`. So this PR changes it to a `-Z` flag that can be passed to either command.

2 years agoChore: prefer `HashMap::from` over collecting `Vec` of tuples
Basti Ortiz [Fri, 29 Oct 2021 08:26:36 +0000 (16:26 +0800)]
Chore: prefer `HashMap::from` over collecting `Vec` of tuples

2 years agoChange --scrape-examples flag to -Z rustdoc-scrape-examples
Will Crichton [Fri, 29 Oct 2021 07:15:19 +0000 (00:15 -0700)]
Change --scrape-examples flag to -Z rustdoc-scrape-examples

2 years agoAuto merge of #9525 - willcrichton:example-analyzer, r=alexcrichton
bors [Thu, 28 Oct 2021 16:58:42 +0000 (16:58 +0000)]
Auto merge of #9525 - willcrichton:example-analyzer, r=alexcrichton

Scrape code examples from examples/ directory for Rustdoc

Adds support for the functionality described in rust-lang/rfcs#3123

Matching changes to rustdoc are here: https://github.com/rust-lang/rust/pull/85833

2 years agoFix repeated warning with two calls to to_package_id_specs
Will Crichton [Thu, 28 Oct 2021 16:01:47 +0000 (09:01 -0700)]
Fix repeated warning with two calls to to_package_id_specs

2 years agoFormatting
Will Crichton [Thu, 28 Oct 2021 07:38:16 +0000 (00:38 -0700)]
Formatting

2 years agoChange scraping to apply to all workspace packages instead of just
Will Crichton [Thu, 28 Oct 2021 07:35:34 +0000 (00:35 -0700)]
Change scraping to apply to all workspace packages instead of just
root units. Only attach Docscrape unit dependencies to workspace Doc
units. Add test for scraping examples with complex reverse dependencies.

2 years agoRemove unnecessary clones, document out_dir
Will Crichton [Wed, 27 Oct 2021 18:51:13 +0000 (11:51 -0700)]
Remove unnecessary clones, document out_dir

2 years agoFix several bugs when checking wasmtime repo:
Will Crichton [Wed, 27 Oct 2021 18:42:13 +0000 (11:42 -0700)]
Fix several bugs when checking wasmtime repo:
* Docscrape unit not having dev-dependencies included
* Sources for reverse-dependencies generated to the wrong directory
* Incorrect features being selected for Docscrape units
* Panics from Docscrape-dependent packages not being available

2 years agoAuto merge of #10002 - TaKO8Ki:fix-clippy-warnings, r=ehuss
bors [Sun, 24 Oct 2021 17:51:41 +0000 (17:51 +0000)]
Auto merge of #10002 - TaKO8Ki:fix-clippy-warnings, r=ehuss

Fix a clippy warning

This pull request fixes a clippy warning.

2 years agofix a clippy warning
Takayuki Maeda [Sun, 24 Oct 2021 09:27:46 +0000 (18:27 +0900)]
fix a clippy warning

2 years agoAuto merge of #10000 - alexcrichton:upgrade-edition, r=Eh2406
bors [Sat, 23 Oct 2021 18:08:27 +0000 (18:08 +0000)]
Auto merge of #10000 - alexcrichton:upgrade-edition, r=Eh2406

Upgrade Cargo to the 2021 edition

While I was poking around in the manifests I also went ahead and removed the `authors` entries since at least the one for Cargo itself is quite outdated and Cargo otherwise doesn't use these any more.

2 years agoAuto merge of #9991 - Byron:fix-test-failure-due-to-echo-resolution, r=joshtriplett
bors [Sat, 23 Oct 2021 08:18:01 +0000 (08:18 +0000)]
Auto merge of #9991 - Byron:fix-test-failure-due-to-echo-resolution, r=joshtriplett

Don't canonicalize executable path

Otherwise symbolic links may also accidentally be resolved which may lead to unexpected results in the case of 'coreutils', a binary that depends on the executable name being a symbolic link.

This means a path like /bin/echo being canonicalized to /bin/coreutils will loose all information about the desired functionality.

For example, test failures will occur if 'echo' is resolved that way and it's not trivial to find the cause of it in the provided error messages.  For example`doc_workspace_open_different_library_and_package_names` did fail for me on MacOS, Nix packages in PATH, but works with this patch.

With this patch, there is still the possibility that a path gets canonicalized for its relative path components, but still results in changing the name of the binary. I could imagine to check for binary name changes and panic if `coreutils` or `busybox` is encountered, which are known to fail without a symlink telling them which program to emulate.

2 years agoDo not canonicalize the exe-candidate at all
Sebastian Thiel [Sat, 23 Oct 2021 00:53:31 +0000 (08:53 +0800)]
Do not canonicalize the exe-candidate at all

And here is why: https://github.com/rust-lang/cargo/pull/9991#issuecomment-949727679

2 years agoFix CI testing
Alex Crichton [Fri, 22 Oct 2021 20:30:46 +0000 (13:30 -0700)]
Fix CI testing

2 years agoUpdate stable rust in the docs CI builder
Alex Crichton [Fri, 22 Oct 2021 17:33:46 +0000 (10:33 -0700)]
Update stable rust in the docs CI builder

2 years agoRemove `authors` directives from Cargo crates
Alex Crichton [Fri, 22 Oct 2021 17:27:20 +0000 (10:27 -0700)]
Remove `authors` directives from Cargo crates

Most of these are pretty dated and Cargo defaults nowadays to not
emitting an `authors` field so this commit also removes them from the
manifests.

2 years agoUpgrade Cargo to the 2021 edition
Alex Crichton [Fri, 22 Oct 2021 17:24:49 +0000 (10:24 -0700)]
Upgrade Cargo to the 2021 edition

This didn't actually result in any code changes yet, for now this simply
flips the edition flag for all of our crates and documentation.

2 years agoAuto merge of #9998 - ehuss:version-bump, r=alexcrichton
bors [Fri, 22 Oct 2021 16:05:08 +0000 (16:05 +0000)]
Auto merge of #9998 - ehuss:version-bump, r=alexcrichton

Bump to 0.59.0, update changelog

2 years agoUpdate changelog for 1.57
Eric Huss [Fri, 22 Oct 2021 15:18:25 +0000 (08:18 -0700)]
Update changelog for 1.57

2 years agoBump to 0.59.0
Eric Huss [Fri, 22 Oct 2021 14:53:17 +0000 (07:53 -0700)]
Bump to 0.59.0

2 years agoAssure the binary name won't change after canonicalization, and keep looking if it...
Sebastian Thiel [Thu, 21 Oct 2021 10:19:04 +0000 (18:19 +0800)]
Assure the binary name won't change after canonicalization, and keep looking if it does.

2 years agoOnly canonicalize executable path if it has relative directories
Sebastian Thiel [Thu, 21 Oct 2021 09:03:58 +0000 (17:03 +0800)]
Only canonicalize executable path if it has relative directories

Otherwise symbolic links may also accidentally be resolved which may
lead to unexpected results in the case of 'coreutils', a binary
that depends on the executable name being a symbolic link.

This means a path like /bin/echo being canonicalized to /bin/coreutils
will loose all information about the desired functionality.

Test failures will occur if 'echo' is resolved that way and it's
not trivial to find the cause of it in the provided error messages.

2 years agoAuto merge of #9953 - Aaron1011:nicer-incompat-report, r=ehuss
bors [Tue, 19 Oct 2021 02:16:48 +0000 (02:16 +0000)]
Auto merge of #9953 - Aaron1011:nicer-incompat-report, r=ehuss

Make future-incompat-report output more user-friendly

When the user enables `--future-incompat-report`, we now display
a high-level summary of the problem, as well as several suggestions
for fixing the affected crates.

The command `cargo report future-incompatibilities` now takes
a `--crate` option, which can be used to display a report
(including the actual lint messages) for a single crate.
When this option is not used, we display the report for all
crates.

Sample output from the `actix` crate:

`> RUSTFLAGS="-Z future-incompat-test" ~/repos/cargo/target/debug/cargo build -Z future-incompat-report
`

```
    Finished dev [unoptimized + debuginfo] target(s) in 2.09s
warning: the following packages contain code that will be rejected by a future version of Rust: actix v0.11.1 (/home/aaron/repos/actix/actix), ahash v0.7.4, arc-swap v0.4.4, autocfg v1.0.0, crossbeam-utils v0.8.5, futures-macro v0.3.17, futures-util v0.3.17, lazy_static v1.4.0, libc v0.2.103, lock_api v0.4.5, log v0.4.8, mio v0.7.13, parking_lot_core v0.8.5, signal-hook-registry v1.2.0, smallvec v1.7.0, syn v1.0.77, tokio v1.12.0, tokio-util v0.6.8, unicode-xid v0.2.0, version_check v0.9.3
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 2`

```

`> RUSTFLAGS="-Z future-incompat-test" ~/repos/cargo/target/debug/cargo build -Z future-incompat-report --future-incompat-report -Z unstable-options`

```
    Finished dev [unoptimized + debuginfo] target(s) in 2.12s
warning: the following packages contain code that will be rejected by a future version of Rust: actix v0.11.1 (/home/aaron/repos/actix/actix), ahash v0.7.4, arc-swap v0.4.4, autocfg v1.0.0, crossbeam-utils v0.8.5, futures-macro v0.3.17, futures-util v0.3.17, lazy_static v1.4.0, libc v0.2.103, lock_api v0.4.5, log v0.4.8, mio v0.7.13, parking_lot_core v0.8.5, signal-hook-registry v1.2.0, smallvec v1.7.0, syn v1.0.77, tokio v1.12.0, tokio-util v0.6.8, unicode-xid v0.2.0, version_check v0.9.3
note:
To solve this problem, you can try the following approaches:

- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.

ahash v0.7.4 has the following newer versions available: 0.7.5
arc-swap v0.4.4 has the following newer versions available: 0.4.8, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0
autocfg v1.0.0 has the following newer versions available: 1.0.1
log v0.4.8 has the following newer versions available: 0.4.11, 0.4.13, 0.4.14
signal-hook-registry v1.2.0 has the following newer versions available: 1.2.1, 1.2.2, 1.3.0, 1.4.0
syn v1.0.77 has the following newer versions available: 1.0.78, 1.0.79, 1.0.80
unicode-xid v0.2.0 has the following newer versions available: 0.2.1, 0.2.2

- If the issue is not solved by updating the dependencies, a fix has to be
  implemented by those dependencies. You can help with that by notifying the
  maintainers of this problem (e.g. by creating a bug report) or by proposing a
  fix to the maintainers (e.g. by creating a pull request):

  - actix:0.11.1
    - Repository: https://github.com/actix/actix
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "actix:0.11.1"

  - ahash:0.7.4
    - Repository: https://github.com/tkaitchuck/ahash
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "ahash:0.7.4"

  - arc-swap:0.4.4
    - Repository: https://github.com/vorner/arc-swap
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "arc-swap:0.4.4"

  - autocfg:1.0.0
    - Repository: https://github.com/cuviper/autocfg
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "autocfg:1.0.0"

  - crossbeam-utils:0.8.5
    - Repository: https://github.com/crossbeam-rs/crossbeam
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "crossbeam-utils:0.8.5"

  - futures-macro:0.3.17
    - Repository: https://github.com/rust-lang/futures-rs
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "futures-macro:0.3.17"

  - futures-util:0.3.17
    - Repository: https://github.com/rust-lang/futures-rs
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "futures-util:0.3.17"

  - lazy_static:1.4.0
    - Repository: https://github.com/rust-lang-nursery/lazy-static.rs
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "lazy_static:1.4.0"

  - libc:0.2.103
    - Repository: https://github.com/rust-lang/libc
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "libc:0.2.103"

  - lock_api:0.4.5
    - Repository: https://github.com/Amanieu/parking_lot
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "lock_api:0.4.5"

  - log:0.4.8
    - Repository: https://github.com/rust-lang/log
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "log:0.4.8"

  - mio:0.7.13
    - Repository: https://github.com/tokio-rs/mio
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "mio:0.7.13"

  - parking_lot_core:0.8.5
    - Repository: https://github.com/Amanieu/parking_lot
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "parking_lot_core:0.8.5"

  - signal-hook-registry:1.2.0
    - Repository: https://github.com/vorner/signal-hook
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "signal-hook-registry:1.2.0"

  - smallvec:1.7.0
    - Repository: https://github.com/servo/rust-smallvec
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "smallvec:1.7.0"

  - syn:1.0.77
    - Repository: https://github.com/dtolnay/syn
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "syn:1.0.77"

  - tokio:1.12.0
    - Repository: https://github.com/tokio-rs/tokio
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "tokio:1.12.0"

  - tokio-util:0.6.8
    - Repository: https://github.com/tokio-rs/tokio
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "tokio-util:0.6.8"

  - unicode-xid:0.2.0
    - Repository: https://github.com/unicode-rs/unicode-xid
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "unicode-xid:0.2.0"

  - version_check:0.9.3
    - Repository: https://github.com/SergioBenitez/version_check
    - Detailed warning command: `cargo report future-incompatibilities --id 3 --crate "version_check:0.9.3"

- If waiting for an upstream fix is not an option, you can use the `[patch]`
  section in `Cargo.toml` to use your own version of the dependency. For more
  information, see:
  https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section

note: this report can be shown with `cargo report future-incompatibilities -Z future-incompat-report --id 3`
```

`> RUSTFLAGS="-Z future-incompat-test" ~/repos/cargo/target/debug/cargo report future-incompatibilities -Z future-incompat-report --color never | head -n 100`

```
The following warnings were discovered during the build. These warnings are an
indication that the packages contain code that will become an error in a
future release of Rust. These warnings typically cover changes to close
soundness problems, unintended or undocumented behavior, or critical problems
that cannot be fixed in a backwards-compatible fashion, and are not expected
to be in wide use.

Each warning should contain a link for more information on what the warning
means and how to resolve it.

- Some affected dependencies have newer versions available.
You may want to consider updating them to a newer version to see if the issue has been fixed.

ahash v0.7.4 has the following newer versions available: 0.7.5
arc-swap v0.4.4 has the following newer versions available: 0.4.8, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.3.2, 1.4.0
autocfg v1.0.0 has the following newer versions available: 1.0.1
log v0.4.8 has the following newer versions available: 0.4.11, 0.4.13, 0.4.14
signal-hook-registry v1.2.0 has the following newer versions available: 1.2.1, 1.2.2, 1.3.0, 1.4.0
syn v1.0.77 has the following newer versions available: 1.0.78, 1.0.79, 1.0.80
unicode-xid v0.2.0 has the following newer versions available: 0.2.1, 0.2.2

The package `actix v0.11.1 (/home/aaron/repos/actix/actix)` currently triggers the following future incompatibility lints:
> warning: use of deprecated struct `utils::Condition`: Please use tokio::sync::oneshot::Sender instead.
>   --> actix/src/utils.rs:25:9
>    |
> 25 | impl<T> Condition<T>
>    |         ^^^^^^^^^
>    |
> note: the lint level is defined here
>   --> actix/src/lib.rs:30:10
>    |
> 30 | #![allow(deprecated)]
>    |          ^^^^^^^^^^
>
> warning: use of deprecated struct `utils::Condition`: Please use tokio::sync::oneshot::Sender instead.
>   --> actix/src/utils.rs:42:21
>    |
> 42 | impl<T> Default for Condition<T>
>    |                     ^^^^^^^^^
>
> warning: use of deprecated struct `utils::Condition`: Please use tokio::sync::oneshot::Sender instead.
>   --> actix/src/utils.rs:47:9
>    |
> 47 |         Condition {
>    |         ^^^^^^^^^
>
> warning: use of deprecated struct `utils::Condition`: Please use tokio::sync::oneshot::Sender instead.
>    --> actix/src/lib.rs:120:28
>     |
> 120 |     pub use crate::utils::{Condition, IntervalFunc, TimerFunc};
>     |                            ^^^^^^^^^
>
> warning: use of deprecated associated function `std::sync::atomic::AtomicUsize::compare_and_swap`: Use `compare_exchange` or `compare_exchange_weak` instead
>    --> actix/src/address/channel.rs:512:49
>     |
> 512 |             let actual = self.inner.num_senders.compare_and_swap(curr, next, SeqCst);
>     |                                                 ^^^^^^^^^^^^^^^^
>
> warning: use of deprecated associated function `std::sync::atomic::AtomicUsize::compare_and_swap`: Use `compare_exchange` or `compare_exchange_weak` instead
>    --> actix/src/address/channel.rs:636:49
>     |
> 636 |             let actual = self.inner.num_senders.compare_and_swap(curr, next, SeqCst);
>     |                                                 ^^^^^^^^^^^^^^^^
>
> warning: use of deprecated associated function `std::sync::atomic::AtomicUsize::compare_and_swap`: Use `compare_exchange` or `compare_exchange_weak` instead
>    --> actix/src/address/channel.rs:697:49
>     |
> 697 |             let actual = self.inner.num_senders.compare_and_swap(curr, next, SeqCst);
>     |                                                 ^^^^^^^^^^^^^^^^
>
> warning: use of deprecated field `utils::Condition::waiters`: Please use tokio::sync::oneshot::Sender instead.
>   --> actix/src/utils.rs:31:9
>    |
> 31 |         self.waiters.push(tx);
>    |         ^^^^^^^^^^^^
>
> warning: use of deprecated field `utils::Condition::waiters`: Please use tokio::sync::oneshot::Sender instead.
>   --> actix/src/utils.rs:36:23
>    |
> 36 |         for waiter in self.waiters {
>    |                       ^^^^^^^^^^^^
>
> warning: use of deprecated field `utils::Condition::waiters`: Please use tokio::sync::oneshot::Sender instead.
>   --> actix/src/utils.rs:48:13
>    |
> 48 |             waiters: Vec::new(),
>    |             ^^^^^^^^^^^^^^^^^^^
>
> warning: unused variable: `ctx`
>   --> actix/src/actor.rs:78:27
>    |
> 78 |     fn started(&mut self, ctx: &mut Self::Context) {}
>    |                           ^^^ help: if this is intentional, prefix it with an underscore: `_ctx`
>    |
> note: the lint level is defined here
>   --> actix/src/actor.rs:72:9
>    |
> 72 | #[allow(unused_variables)]
>    |         ^^^^^^^^^^^^^^^^
```

2 years agoAuto merge of #9979 - ehuss:git-fetch-force, r=alexcrichton
bors [Mon, 18 Oct 2021 22:00:14 +0000 (22:00 +0000)]
Auto merge of #9979 - ehuss:git-fetch-force, r=alexcrichton

Fix fetching git repos after a force push.

Users have been reporting that the index has not been updating for them.  This was caused by the update to libgit2 1.3 (from 1.1) which has changed some behavior around force pushes.  The index was squashed on 2021-09-24, and if a user had the index fetched from before that point, and they used nightly-2021-10-14 or newer, then the fetch would succeed, but the `refs/remotes/origin/HEAD` would not get updated.  Cargo uses the `origin/HEAD` ref to know what to look at, and thus was looking at old data.

The solution here is to use `+` on the refspec to force libgit2 to do a forced update (a fast-forward). I think this may have been introduced in libgit2 1.2 via https://github.com/libgit2/libgit2/pull/5854, though that is just a guess.

Fixes #9976

2 years agoFix fetching git repos after a force push.
Eric Huss [Mon, 18 Oct 2021 21:08:33 +0000 (14:08 -0700)]
Fix fetching git repos after a force push.

2 years agoRun fmt
Aaron Hill [Mon, 18 Oct 2021 17:06:32 +0000 (12:06 -0500)]
Run fmt

2 years agoAdjust comments
Aaron Hill [Mon, 18 Oct 2021 17:06:23 +0000 (12:06 -0500)]
Adjust comments

2 years agoDisplay more information in report
Aaron Hill [Mon, 18 Oct 2021 17:01:07 +0000 (12:01 -0500)]
Display more information in report

2 years agoAdjust suggestions
Aaron Hill [Mon, 18 Oct 2021 16:42:52 +0000 (11:42 -0500)]
Adjust suggestions

2 years agoAdjust message and move code to future_incompat module
Aaron Hill [Sat, 16 Oct 2021 17:10:02 +0000 (12:10 -0500)]
Adjust message and move code to future_incompat module

2 years agoAdd test / documentation for scrape-examples cycle-avoidance, add map for doc unit...
Will Crichton [Thu, 14 Oct 2021 23:06:26 +0000 (16:06 -0700)]
Add test / documentation for scrape-examples cycle-avoidance, add map for doc unit -> metadata to Context

2 years agoAuto merge of #9916 - chansuke:issue-9895, r=ehuss
bors [Thu, 14 Oct 2021 03:22:12 +0000 (03:22 +0000)]
Auto merge of #9916 - chansuke:issue-9895, r=ehuss

Add rustc-link-args to doctest build

Fix #9895

2 years agoAdd rustc-link-args to doctest build
chansuke [Thu, 16 Sep 2021 13:18:35 +0000 (22:18 +0900)]
Add rustc-link-args to doctest build

2 years agoAdd comments and todos
Will Crichton [Thu, 14 Oct 2021 00:20:16 +0000 (17:20 -0700)]
Add comments and todos

2 years agoUpdate rustdoc tests with -Cmetadata flag
Will Crichton [Wed, 13 Oct 2021 02:33:23 +0000 (19:33 -0700)]
Update rustdoc tests with -Cmetadata flag

2 years agoRemove references to "lib" argument
Will Crichton [Wed, 13 Oct 2021 02:24:26 +0000 (19:24 -0700)]
Remove references to "lib" argument

2 years agoAdd documentation and a test
Will Crichton [Wed, 13 Oct 2021 02:11:07 +0000 (19:11 -0700)]
Add documentation and a test

2 years agoFix issues compiling build scripts
Will Crichton [Wed, 13 Oct 2021 00:57:20 +0000 (17:57 -0700)]
Fix issues compiling build scripts

2 years agoDisplay update message in report
Aaron Hill [Tue, 12 Oct 2021 21:48:56 +0000 (16:48 -0500)]
Display update message in report

2 years agoAuto merge of #9955 - ehuss:benchsuite, r=Eh2406
bors [Tue, 12 Oct 2021 21:59:48 +0000 (21:59 +0000)]
Auto merge of #9955 - ehuss:benchsuite, r=Eh2406

Add the start of a basic benchmarking suite.

This adds the start of a basic benchmarking suite for cargo.  This is fairly rough, but I figure it will change and evolve over time based on what we decide to add and how we use it.

There is some documentation in the `benches/README.md` file which gives an overview of what is here and how to use it.

Closes #9935

2 years agoUse double-quotes for package spec
Aaron Hill [Fri, 8 Oct 2021 20:44:22 +0000 (15:44 -0500)]
Use double-quotes for package spec

2 years agoRun fmt
Aaron Hill [Fri, 8 Oct 2021 20:38:27 +0000 (15:38 -0500)]
Run fmt

2 years agoCombined newer versions into single list
Aaron Hill [Fri, 8 Oct 2021 20:28:35 +0000 (15:28 -0500)]
Combined newer versions into single list

2 years agoChange package spec
Aaron Hill [Fri, 8 Oct 2021 20:19:18 +0000 (15:19 -0500)]
Change package spec

2 years agoRename to per_package
Aaron Hill [Fri, 8 Oct 2021 20:09:05 +0000 (15:09 -0500)]
Rename to per_package

2 years agoRename arg and adjust tests
Aaron Hill [Tue, 5 Oct 2021 00:20:23 +0000 (19:20 -0500)]
Rename arg and adjust tests

2 years agoMake future-incompat-report output more user-friendly
Aaron Hill [Fri, 27 Aug 2021 18:16:17 +0000 (13:16 -0500)]
Make future-incompat-report output more user-friendly

When the user enables `--future-incompat-report`, we now display
a high-level summary of the problem, as well as several suggestions
for fixing the affected crates.

The command `cargo report future-incompatibilities` now takes
a `--crate` option, which can be used to display a report
(including the actual lint messages) for a single crate.
When this option is not used, we display the report for all
crates.

2 years agoFormatting
Will Crichton [Tue, 12 Oct 2021 21:25:36 +0000 (14:25 -0700)]
Formatting

2 years agoRemove more unused code
Will Crichton [Tue, 12 Oct 2021 21:22:17 +0000 (14:22 -0700)]
Remove more unused code

2 years agoAdd the start of a basic benchmarking suite.
Eric Huss [Sat, 2 Oct 2021 23:39:41 +0000 (16:39 -0700)]
Add the start of a basic benchmarking suite.

2 years agoRemove unused code
Will Crichton [Tue, 12 Oct 2021 20:19:58 +0000 (13:19 -0700)]
Remove unused code

2 years agoChange scraping strategy to embed in existing unit graph, add CompileMode::Docscrape
Will Crichton [Tue, 12 Oct 2021 20:17:21 +0000 (13:17 -0700)]
Change scraping strategy to embed in existing unit graph, add CompileMode::Docscrape

2 years agoAuto merge of #9970 - ehuss:issue-template-forms, r=alexcrichton
bors [Tue, 12 Oct 2021 15:11:01 +0000 (15:11 +0000)]
Auto merge of #9970 - ehuss:issue-template-forms, r=alexcrichton

Use forms for issue templates.

This switches the GitHub issue templates to use the new forms functionality.  This makes it so that the user doesn't need to fuss with editing the placeholder text, and instead can just start writing text.

I'm mostly just curious how this will work out. If people have trouble with it, or there are complaints, it can be reverted pretty easily.

2 years agoAuto merge of #9967 - flip1995:rust_version_meta, r=alexcrichton
bors [Tue, 12 Oct 2021 14:40:34 +0000 (14:40 +0000)]
Auto merge of #9967 - flip1995:rust_version_meta, r=alexcrichton

Add rust_metadata to SerializedPackage

After the rust_version field was stabilized in #9732 this adds the
rust_version as output to the `cargo metadata` command, so tools like
Clippy can read and use it as well.

We will probably need this for rust-lang/rust-clippy#7765

2 years agoAdd rust_metadata to SerializedPackage
flip1995 [Fri, 8 Oct 2021 17:00:39 +0000 (19:00 +0200)]
Add rust_metadata to SerializedPackage

After the rust_version field was stabilized in #9732 this adds the
rust_version as output to the `cargo metadata` command, so tools like
Clippy can read and use it as well.

2 years agoUse forms for issue templates.
Eric Huss [Mon, 11 Oct 2021 20:31:58 +0000 (13:31 -0700)]
Use forms for issue templates.

2 years agoAuto merge of #9968 - ehuss:verbose-version, r=alexcrichton,Eh2406
bors [Mon, 11 Oct 2021 20:17:07 +0000 (20:17 +0000)]
Auto merge of #9968 - ehuss:verbose-version, r=alexcrichton,Eh2406

Add some more information to verbose version.

This adds a little bit of extra information to the verbose version command.

cc #6275 and #6161

Some examples of what it might look like:

```
cargo 1.57.0
release: 1.57.0
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.79.1-DEV (sys:0.4.49+curl-7.79.1 vendored ssl:OpenSSL/1.1.1k)
ssl: OpenSSL 1.1.1k  25 Mar 2021
```

```
cargo 1.57.0
release: 1.57.0
host: x86_64-pc-windows-msvc
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.79.1-DEV (sys:0.4.49+curl-7.79.1 vendored ssl:Schannel)
```

```
cargo 1.57.0
release: 1.57.0
host: x86_64-apple-darwin
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.64.1 (sys:0.4.49+curl-7.79.1 system ssl:(SecureTransport) LibreSSL/2.8.3)
ssl: OpenSSL 1.1.1l  24 Aug 2021
```

2 years agoAdd --verbose to bug report template.
Eric Huss [Mon, 11 Oct 2021 18:58:27 +0000 (11:58 -0700)]
Add --verbose to bug report template.

2 years agoAdd os to verbose version string.
Eric Huss [Mon, 11 Oct 2021 18:22:48 +0000 (11:22 -0700)]
Add os to verbose version string.

2 years agoAdd some more information to verbose version.
Eric Huss [Fri, 8 Oct 2021 19:19:24 +0000 (12:19 -0700)]
Add some more information to verbose version.

2 years agoRemove references to json
Will Crichton [Tue, 21 Sep 2021 23:00:10 +0000 (16:00 -0700)]
Remove references to json

2 years agoRevert change to lift doc units
Will Crichton [Tue, 21 Sep 2021 22:50:23 +0000 (15:50 -0700)]
Revert change to lift doc units

2 years agoChange metadata strategy to extract hash from nested compilation
Will Crichton [Tue, 21 Sep 2021 22:45:18 +0000 (15:45 -0700)]
Change metadata strategy to extract hash from nested compilation

2 years agoPass metadata flag to rustdoc, ensure that Doc and Check units have same metadata...
Will Crichton [Tue, 21 Sep 2021 18:40:01 +0000 (11:40 -0700)]
Pass metadata flag to rustdoc, ensure that Doc and Check units have same metadata hash

2 years agoAdd tracking issue and unstable documentation
Will Crichton [Tue, 14 Sep 2021 17:17:24 +0000 (10:17 -0700)]
Add tracking issue and unstable documentation

2 years agoFix documentation
Will Crichton [Fri, 27 Aug 2021 03:41:43 +0000 (20:41 -0700)]
Fix documentation

2 years agoAdd comments
Will Crichton [Fri, 27 Aug 2021 02:42:22 +0000 (19:42 -0700)]
Add comments

2 years agoAllow scraping examples from library
Will Crichton [Thu, 26 Aug 2021 03:16:30 +0000 (20:16 -0700)]
Allow scraping examples from library

2 years agoFix breakage
Will Crichton [Wed, 25 Aug 2021 23:40:45 +0000 (16:40 -0700)]
Fix breakage

2 years agoFix test
Will Crichton [Tue, 15 Jun 2021 22:20:44 +0000 (15:20 -0700)]
Fix test

2 years agoRemove unnecessary collect
Will Crichton [Thu, 3 Jun 2021 02:11:20 +0000 (19:11 -0700)]
Remove unnecessary collect

2 years agoAdd unstable notice for --scrape-examples
Will Crichton [Thu, 3 Jun 2021 01:50:19 +0000 (18:50 -0700)]
Add unstable notice for --scrape-examples

2 years agoChange cargo strategy to go through rustdoc instead of doctest
Will Crichton [Thu, 3 Jun 2021 01:43:27 +0000 (18:43 -0700)]
Change cargo strategy to go through rustdoc instead of doctest

2 years agoFix for issue #9198
Will Crichton [Thu, 3 Jun 2021 01:43:02 +0000 (18:43 -0700)]
Fix for issue #9198

2 years agoAdd workspace root
Will Crichton [Wed, 2 Jun 2021 02:10:28 +0000 (19:10 -0700)]
Add workspace root

2 years agoFactor scraping and rendering into separate calls to rustdoc
Will Crichton [Tue, 1 Jun 2021 21:02:45 +0000 (14:02 -0700)]
Factor scraping and rendering into separate calls to rustdoc

2 years agoShare all examples across each unit in worksapce
Will Crichton [Wed, 12 May 2021 22:00:56 +0000 (15:00 -0700)]
Share all examples across each unit in worksapce

2 years agoAdd repository URL
Will Crichton [Tue, 11 May 2021 15:55:44 +0000 (08:55 -0700)]
Add repository URL

2 years agoInitial support for scrape-examples
Will Crichton [Tue, 11 May 2021 14:32:10 +0000 (07:32 -0700)]
Initial support for scrape-examples

2 years agoAuto merge of #9938 - weihanglo:issue-9857, r=ehuss
bors [Thu, 7 Oct 2021 20:06:39 +0000 (20:06 +0000)]
Auto merge of #9938 - weihanglo:issue-9857, r=ehuss

Skip all `cargo fix` that tends to write to registry cache.

Skip all `cargo fix` that tends to write to registry cache.

This is a temporary hack for #9857. The real fix may need to touch rustc.

2 years agoAuto merge of #9943 - ehuss:stabilize-named-profiles, r=alexcrichton
bors [Thu, 7 Oct 2021 17:42:56 +0000 (17:42 +0000)]
Auto merge of #9943 - ehuss:stabilize-named-profiles, r=alexcrichton

Stabilize named profiles

This stabilizes the named profiles feature. As an overview of what this does, it allows specifying custom named profiles, such as:

```toml
[profile.release-lto]
inherits = "release"
lto = true
```

And enables the use of the `--profile` CLI option to choose a profile by name.

Another key change here is that cargo now only uses a single profile per command. Previously, some commands such as `cargo test` would use a mix of profiles based on which package and target were being built.

### Summary of new behavior

* Profiles can now have arbitrary names. New profiles require the `inherits` key.
* The `--profile` flag is now available on all build commands.
* The `CompileMode` is no longer considered for choosing the profile, only one profile will be used. Previously, building a test, benchmark, or doctest would use the test or bench profile, and all dependencies would use the dev/release profiles. This change is done to arguably make it easier to understand, and to possibly give more desired and intuitive behavior.
* The `test` profile now inherits settings from the `dev` profile (and `bench` from `release`).

### Deviations from the original RFC and implementation

* The original RFC indicated that `--all-targets` without `--profile` would retain the old behavior where it would use different profiles for different targets. However, the implementation uses a single profile, to avoid confusion and to keep things simple.
* The `dir-name` key is not exposed to the user. The implementation is retained to handle mapping of built-in profile names (test/dev→debug, bench→release). This can be exposed in the future if necessary.

### Notes about this PR

* Fixed an issue where the duplicate package override check would randomly return matches for inherited profiles like `test`.
* I left some of the old, vestigial code behind to possibly make it easier to revert this PR if necessary. If this does land, I think it can be eventually removed (code using `Feature::named_profiles` and various things using `named_profiles_enabled`).
* Added `target` to reserved list, just because.
* Adds a warning if `--release` is combined with `--profile` in `cargo rustc`, `check`, or `fix`. The `--release` flag was being ignored.

### Hazards and concerns

* This has had very little real-world testing.
* Custom profile directories may conflict with other things in the `target` directory. We have reserved profile names that currently conflict (such as `doc` or `package`). However, they can still collide with target names. This also presents a hazard if Cargo ever wants to add new things to that top directory. We decided to proceed with this because:
    * We currently have no plans to add new built-in profiles.
    * We have reserved several profile names (including anything starting with "cargo"), and the profile name syntax is deliberately limited (so cargo is still free to add `.` prefixed hidden directories).
    * A user creating a profile that collides with a target name resides in the "don't do that" territory. Also, that shouldn't be catastrophic, as the directories are still somewhat organized differently.
* Artifacts may no longer be shared in some circumstances. This can lead to substantially increased `target` directory sizes (and build times), particularly if the `test` profile is not the same as the `dev` profile. Previously, dependencies would use the `dev` profile for both. If the user wants to retain the old behavior, they can use an override like `[profile.test.package."*"]` and set the same settings as `dev`.
* This may break existing workflows. It is possible, though unlikely, that changes to the profile settings will cause changes to how things build in such a way to break behavior.
    * Another example is using something like `cargo build` to prime a cache that is used for `cargo test`, and there is a custom `test` profile, the cache will no longer be primed.
* The legacy behavior with `cargo rustc`, `cargo check`, and `cargo fix` may be confusing. We may in the future consider something like a `--mode` flag to formalize that behavior.
* The `PROFILE` environment variable in build scripts may cause confusion or cause problems since it only sets `release` or `debug`. Some people may be using that to determine if `--release` should be used for a recursive `cargo` invocation. Currently I noted in the documentation that it shouldn't be used. However, I think it could be reasonable to maybe add a separate environment variable (`PROFILE_NAME`?) that exposes the actual profile used. We felt that changing the existing value could cause too much breakage (and the mapping of debug→dev is a little awkward).

Closes #6988

2 years agoAuto merge of #9963 - ehuss:update-git2, r=alexcrichton
bors [Thu, 7 Oct 2021 01:21:50 +0000 (01:21 +0000)]
Auto merge of #9963 - ehuss:update-git2, r=alexcrichton

Update git2

This is just a regular update, updating from libgit2 1.1.0 to 1.3.0.

2 years agoUpdate git2
Eric Huss [Wed, 6 Oct 2021 23:04:41 +0000 (16:04 -0700)]
Update git2

2 years agoAuto merge of #9847 - weihanglo:issue-9840, r=Eh2406
bors [Tue, 5 Oct 2021 18:16:42 +0000 (18:16 +0000)]
Auto merge of #9847 - weihanglo:issue-9840, r=Eh2406

Distinguish lockfile version req from normal dep in resolver error message

Resolves #9840

This PR adds a new variant `OptVersionReq::Locked` as #9840 described.
The new variant represents as a locked version requirement that contains
an exact locked version and the original version requirement.

Previously we use exact version req to synthesize locked version req.
Now we make those need a truly locked to be `OptVersionReq::Locked`,
including:

- `[patch]`: previous used exact version req to emulate locked version,
  and it only need to lock dep version but not source ID, so we make
  an extra method `Dependency::lock_version` for it.
- Dependencies from lock files: No need to change the call site.

2 years agoLock `[replace]` source as well
Weihang Lo [Tue, 5 Oct 2021 17:16:00 +0000 (01:16 +0800)]
Lock `[replace]` source as well

2 years agoAuto merge of #9954 - gilescope:lev_tighten, r=ehuss
bors [Sat, 2 Oct 2021 15:52:22 +0000 (15:52 +0000)]
Auto merge of #9954 - gilescope:lev_tighten, r=ehuss

nit: Allocated slightly bigger vec than needed

I think this is slightly more correct as the rest of the algorithm is focusing on chars not bytes, so this is more consistent.

2 years agocargo fmt
Giles Cope [Sat, 2 Oct 2021 09:06:36 +0000 (10:06 +0100)]
cargo fmt

2 years agoA little more correct.
Giles Cope [Sat, 2 Oct 2021 08:58:11 +0000 (09:58 +0100)]
A little more correct.

2 years agoAuto merge of #9951 - relrelb:completion, r=alexcrichton
bors [Fri, 1 Oct 2021 16:59:58 +0000 (16:59 +0000)]
Auto merge of #9951 - relrelb:completion, r=alexcrichton

Add shell completion for shorthand commands

Currently `cargo` has shell completion for most (if not all) builtin commands such as `build`, `run`, `check` etc.
However, it doesn't have shell completion for the short forms of these commands, such as `b`, `r`, `c` etc.

This PR adds both bash and zsh completions for command shorthands.

Fixes #9086.

2 years agoAdd shell completion for shorthand commands
relrelb [Fri, 1 Oct 2021 08:14:45 +0000 (11:14 +0300)]
Add shell completion for shorthand commands

Currently `cargo` has shell completion for most (if not all) builtin
commands such as `build`, `run`, `check` etc.
However, it doesn't have shell completion for the short forms of these
commands, such as `b`, `r`, `c` etc.

This commit adds both bash and zsh completions for command shorthands.

Fixes #9086.

2 years agoAuto merge of #9945 - ehuss:update-precise-metadata, r=alexcrichton
bors [Mon, 27 Sep 2021 13:44:18 +0000 (13:44 +0000)]
Auto merge of #9945 - ehuss:update-precise-metadata, r=alexcrichton

Allow `cargo update --precise` with metadata.

`cargo update --precise` would require that the version matches *exactly*, including build metadata.  Usually the build metadata is ignored (like in dependency declarations), but in this circumstance it isn't.  This can be awkward in some cases where it can be more convenient to type just the version number without the build metadata.

This changes it so that if the metadata isn't provided, then it will be ignored when matching.  Otherwise, it will be honored. This is slightly different from a version requirement like `=1.2.3+foo` which ignores the metadata completely.

This also adds a slightly better error message if you don't type in valid syntax for a version number (previously it would just emit the `no matching package` error).

2 years agoAuto merge of #9866 - nipunn1313:pkg_in_repo2, r=ehuss
bors [Sun, 26 Sep 2021 19:35:27 +0000 (19:35 +0000)]
Auto merge of #9866 - nipunn1313:pkg_in_repo2, r=ehuss

Support path_in_vcs as part of cargo_vcs_metadata

Depends on #9865 - this PR will look simpler once that one lands. I can't target my PR to the base branch of #9865 as an external contributor (since it's in my fork). For now just review the latest commit of this one.

This is a backward compatible change that is an alternative to #9837

2 years agoSupport path_in_vcs as part of cargo_vcs_metadata
Nipunn Koorapati [Thu, 2 Sep 2021 06:12:39 +0000 (02:12 -0400)]
Support path_in_vcs as part of cargo_vcs_metadata