Commit graph

11586 commits

Author SHA1 Message Date
hi-rustin a0dffe0f43 Make clippy happy
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-11-21 11:40:31 +08:00
bors 7a947ae523 Auto merge of #10043 - jyn514:hard-error, r=ehuss
Give a hard error if `-Zrustdoc-scrape-examples` is missing a flag

It's the same as if the option wasn't passed, and it makes it difficult to
figure out why rustdoc isn't generating examples.

Fixes https://github.com/rust-lang/cargo/issues/10042 (cc `@willcrichton)`
2021-11-20 18:23:22 +00:00
bors 5907635259 Auto merge of #10097 - Eh2406:silly, r=alexcrichton
silly fix, pointer to the empty slice

Just a silly thing. I don't know when this was fixed. NLL? But we no longer need a real Vec to produce a pointer to the empty slice.
2021-11-18 23:00:05 +00:00
Jacob Finkelman 2f7009f52a silly fix 2021-11-18 22:46:28 +00:00
bors ad50d0d266 Auto merge of #10082 - basile-henry:basile/alias-shadow-external-warning, r=ehuss
Warn when alias shadows external subcommand

As per #10049, we start by emitting a warning when an alias shadows an
existing external subcommand. After a transition period (duration not
specified), we will make this a hard error.

Should the warning mention that this will become a hard error?
2021-11-17 18:36:37 +00:00
bors adf601d41c Auto merge of #10072 - russweas:master, r=alexcrichton
Implement escaping to allow clean -p to delete all files when directory contains glob characters

Closes #10068.

Runs `glob::Pattern::escape` on path input to `rm_rf_glob()`. This fixes a bug in which `cargo clean -p` fails to delete a number of files from `target/` if the path to target contains glob characters.
2021-11-17 16:00:17 +00:00
bors d2d4b06e55 Auto merge of #10092 - ChrisDenton:tmp-match-err, r=alexcrichton
Match any error when failing to find executables

For Windows targets, Rust now uses [a custom resolver](https://github.com/rust-lang/rust/pull/87704) to find `process::Command` programs. This has caused some error messages to change.

To allow the PR to be merged, some tests have been adjusted to match any error.

cc `@ehuss`
2021-11-17 15:16:29 +00:00
bors aed972396c Auto merge of #10090 - weihanglo:issue-9014, r=alexcrichton
Enhance error message for target auto-discovery

resolves #9014
resolves #9117

Enhance for following scenarios:

1. Target without `path` specified and cannot be found.
2. Target without `path` specified and cannot be found, but a file
   exists at the commonly wrong path, e.g. `example/a.rs`, `bench/b.rs`.
3. Found multiple candidate files and cannot infer which to use.

For the suggestion in [the thread in #9116], I can't see any feasible way to list potential candidates without addditional I/O checking file existences. This PR is the best effort I can think of at this time. Feel free to comment. Thanks!

[the thread in #9116]: https://github.com/rust-lang/cargo/pull/9116#discussion_r575712762
2021-11-17 14:31:16 +00:00
Chris Denton 93bcd97fc1
Match any error when failing to find executables
For Windows targets, Rust now uses a custom resolver to find `process::Command` programs. This has caused some error messages to change.

To allow it to be merged, some tests have been adjusted to match any error.
2021-11-17 11:09:52 +00:00
Weihang Lo 2698bc6a42
Test for target auto-discovery error enhancement 2021-11-17 18:14:27 +08:00
Weihang Lo 74390a4ad7
Enhance error message for target auto-discovery
Enhance for following scenarios:

1. Target without `path` specified and cannot be found.
2. Target without `path` specified and cannot be found, but a file
   exists at the commonly wrong path, e.g. `example/a.rs`, `bench/b.rs`.
3. Found multiple candidate files and cannot infer which to use.
2021-11-17 18:14:14 +08:00
Basile Henry 0b4e2ca330 Add test for alias shadowing external subcommand
This is currently still permitted, so we only test that the warning is properly issued
2021-11-17 09:23:06 +01:00
Basile Henry cba8503e3a Add details in warning for alias shadowing external subcommands 2021-11-17 09:22:08 +01:00
Russ Weas effc72042b Implement glob escaping for clean -p
Implement glob escaping for clean -p

Add pattern escape for glob matching cargo clean files

Implement correct solution for #10068

Removed superfluous formatting changes

Update rm_rf_glob()'s error handling

Remove dir_glob reference for non-glob function

Added test

Satisfy clippy

Add MSVC support for test
2021-11-16 16:55:23 -06:00
bors e475fe4a17 Auto merge of #10073 - russweas:patch-1, r=alexcrichton
Include note about bug while building on macOS in mdbook

See https://github.com/rust-lang/rust/issues/90342. I can watch the thread and push another PR to delete this note once this bug is resolved.
2021-11-15 20:47:26 +00:00
Russ Weas d98590ab98
Update working-on-cargo.md 2021-11-15 12:42:37 -06:00
bors 83bd9f6a1d Auto merge of #10080 - hi-rustin:rustin-patch-quiet, r=alexcrichton
Improve the help text of the --quiet args for all commands

close https://github.com/rust-lang/cargo/issues/8928
2021-11-15 15:13:28 +00:00
bors d2cc298079 Auto merge of #10024 - dswij:9960, r=ehuss
`future-incompat-report` checks both stdout and stderr for color support

Closes #9960
2021-11-15 14:32:52 +00:00
Dharma Saputra Wijaya 622b43aaec future-incompat-report checks both stdout and stderr for color support 2021-11-15 10:29:45 +08:00
Basile Henry 3a5bb75467
Update tests/testsuite/cargo_alias_config.rs 2021-11-14 20:22:13 +00:00
Basile Henry 2ead2d9e3d
Update tests/testsuite/cargo_alias_config.rs 2021-11-14 20:22:05 +00:00
Basile Henry 9f768bbcd8 Update test for warning for alias shadowing an external subcommand 2021-11-14 20:38:40 +01:00
Basile Henry 5bfd345e1d Warn when alias shadows external subcommand
As per #10049, we start by emitting a warning when an alias shadows an
existing external subcommand. After a transition period (duration not
specified), we will make this a hard error.
2021-11-14 19:04:25 +01:00
bors 3a3a071cc8 Auto merge of #10081 - hi-rustin:rustin-patch-clippy, r=ehuss
Remove needless borrow to make clippy happy

Make clippy happy.
2021-11-14 16:06:04 +00:00
hi-rustin e83704ac9a Remove needless borrow to make clippy happy
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-11-14 22:48:37 +08:00
hi-rustin 17c0ea7417 Improve the help text of the --quiet args for all commands
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2021-11-14 20:41:00 +08:00
bors 458d3459cf Auto merge of #10076 - shepmaster:patch-3, r=Eh2406
Describe the background color of the timing graph

r? `@Eh2406`
2021-11-12 21:13:24 +00:00
bors 6f76db6f1a Auto merge of #10077 - not-fl3:profile_checking_doc_comments, r=Eh2406
Make ProfileChecking comments a doc comments

A little PR that makes rustdoc render comments for ProfileChecking struct.

Before:
![image](https://user-images.githubusercontent.com/910977/141529033-34bca263-abb1-4a1d-8e13-3c42edc2189e.png)

After:
![image](https://user-images.githubusercontent.com/910977/141529011-756ac54f-c0b2-4c03-bdb6-c9434e00afe5.png)
2021-11-12 20:34:08 +00:00
Fedor Logachev 4dc7d08a9a Make ProfileChecking comments a doc comments 2021-11-12 14:11:38 -06:00
Jake Goulding 8743bbcadc
Describe the background color of the timing graph 2021-11-12 14:39:23 -05:00
Russ Weas a144513057
Include note about bug while building on macOS in mdbook 2021-11-11 23:02:56 -06:00
bors e11cd814f8 Auto merge of #10011 - hkratz:disable-failing-test, r=joshtriplett
Fix test: hash value depends on endianness and bitness.

The test fails on 32-bit systems and on big-endian systems since Rust 1.44.

Fixes #10004.
2021-11-10 19:20:39 +00:00
bors 2e2a16e983 Auto merge of #10048 - ehuss:curl-progress-panic, r=alexcrichton
Fix debug panic on download with redirect body.

With a debug build of cargo, downloading crates can panic if the download host issues a redirect with a body. From what I can see, the curl progress function gets called with the original size of the redirect body (such as total=154 cur=154, indicating that it has read 154 bytes of the redirect message). Then it calls the progress function again with cur=0 to start again from the beginning.  The next line in this patch, `cur - dl.current.get()` would panic since it is a `u64` and a 0 value of `cur` is less than the old `current`.

This was never really an issue with crates.io because it emits a redirect body of 0 bytes.

I think it is fine to skip this block in that situation, as it is only for resetting the timeout counter.  Though, I guess it could use `saturating_sub` instead.
2021-11-08 15:13:38 +00:00
Hans Kratz aa00def843 fmt 2021-11-08 13:08:32 +01:00
Hans Kratz d4c524e461
Reword comment. 2021-11-08 12:11:13 +01:00
bors fa03f0e169 Auto merge of #10051 - gilescope:one-waffer-thin-alloc-less, r=Eh2406
no need to clone

one less clone,
match => if let
2021-11-07 01:59:27 +00:00
gilescope 142c49d79d
no need to clone I don't think here. 2021-11-06 21:56:12 +00:00
Eric Huss 3d20973ebd Fix debug panic on download with redirect body. 2021-11-05 16:06:32 -07:00
Joshua Nelson 8713cd7e69 Give a hard error if -Zrustdoc-scrape-examples is missing a flag
It's the same as if the flag wasn't passed, and it makes it difficult to
figure out why rustdoc isn't generating examples.
2021-11-05 09:07:15 -05:00
bors b4ab730ca6 Auto merge of #10040 - ehuss:update-curl, r=alexcrichton
Update curl.

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

Fixes #10013
2021-11-05 04:51:10 +00:00
Eric Huss 84283f0c3a Update curl. 2021-11-04 21:14:19 -07:00
bors e3f2953bcb 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.
2021-11-04 19:30:42 +00:00
Will Crichton 7ee3ffc7e6 Fix --scrape-examples-target-crate using package name (with dashes) instead of crate name (with underscores), closes #10035 2021-11-04 11:23:40 -07:00
bors 94ca096afb 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! 🎉
2021-10-29 14:45:06 +00:00
bors 4cc3f4f193 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.
2021-10-29 14:07:40 +00:00
Basti Ortiz 144d94178a
Chore: prefer HashMap::from over collecting Vec of tuples 2021-10-29 16:26:36 +08:00
Will Crichton 9fb78cf698 Change --scrape-examples flag to -Z rustdoc-scrape-examples 2021-10-29 00:15:19 -07:00
bors 0a98b1de5c 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
2021-10-28 16:58:42 +00:00
Will Crichton 33718c7eef Fix repeated warning with two calls to to_package_id_specs 2021-10-28 09:01:47 -07:00
Will Crichton 0a2382b6db Formatting 2021-10-28 00:38:16 -07:00