Commit graph

155880 commits

Author SHA1 Message Date
Manish Goregaokar
e4d257e1d3
Rollup merge of #88305 - ijackson:exitstatus-debug, r=dtolnay
Manual Debug for Unix ExitCode ExitStatus ExitStatusError

These structs have misleading names.  An ExitStatus[Error] is actually a Unix wait status; an ExitCode is actually an exit status.  These misleading names appear in the `Debug` output.

The `Display` impls on Unix have been improved, but the `Debug` impls are still misleading, as reported in #74832.

Fix this by pretending that these internal structs are called `unix_exit_status` and `unix_wait_status` as applicable.  (We can't actually rename the structs because of the way that the cross-platform machinery works: the names are cross-platform.)

After this change, this program
```
#![feature(exit_status_error)]
fn main(){
    let x = std::process::Command::new("false").status().unwrap();
    dbg!(x.exit_ok());
    eprintln!("x={:?}",x);
}
```
produces this output
```
[src/main.rs:4] x.exit_ok() = Err(
    ExitStatusError(
        unix_wait_status(
            256,
        ),
    ),
)
x=ExitStatus(unix_wait_status(256))
```

Closes #74832
2021-10-03 23:13:18 -07:00
Manish Goregaokar
f2ec71fe74
Rollup merge of #88286 - LeSeulArtichaut:unnecessary-unsafe-block-std, r=dtolnay
Remove unnecessary unsafe block in `process_unix`

Because it's nested under this unsafe fn!

This block isn't detected as unnecessary because of a bug in the compiler: #88260.
2021-10-03 23:13:18 -07:00
Manish Goregaokar
e500f1c1e9
Rollup merge of #87910 - iago-lito:mark_unsafe_nonzero_arithmetics_as_const, r=joshtriplett
Mark unsafe methods NonZero*::unchecked_(add|mul) as const.

Now that https://github.com/rust-lang/rfcs/pull/3016 has landed, these two unstable `std` function can be marked `const`, according to this detail of #84186.
2021-10-03 23:13:17 -07:00
Manish Goregaokar
0f9e960241
Rollup merge of #87679 - ssomers:btree_comments, r=joshtriplett
BTree: refine some comments
2021-10-03 23:13:16 -07:00
Manish Goregaokar
287af0403a
Rollup merge of #86828 - lambinoo:67441-const-fn-copied-take-replace, r=joshtriplett
const fn for option copied, take & replace

Tracking issue: [#67441](https://github.com/rust-lang/rust/issues/67441)

Adding const fn for the copied, take and replace method of Option. Also adding necessary unit test.

It's my first contribution so I am pretty sure I don't know what I'm doing but there's a first for everything!
2021-10-03 23:13:16 -07:00
Manish Goregaokar
22714ed4e3
Rollup merge of #86434 - CDirkx:ipv6-benchmarking, r=joshtriplett
Add `Ipv6Addr::is_benchmarking`

This PR adds the unstable method `Ipv6Addr::is_benchmarking`. This method is added for parity with `Ipv4Addr::is_benchmarking`, and I intend to use it in a future rework of `Ipv6Addr::is_global` (edit: #86634) to more accurately follow the [IANA Special Address Registry](https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml) (like is done in `Ipv4Addr::is_global`).

With `Ipv6Addr::is_benchmarking` and `Ipv4Addr::is_benchmarking` now both existing, `IpAddr::is_benchmarking` is also added.
2021-10-03 23:13:15 -07:00
Laurențiu Nicola
55a3c8636d ⬆️ rust-analyzer 2021-10-04 08:37:24 +03:00
bors
d25de31a0e Auto merge of #89165 - jkugelman:read-to-end-overallocation, r=joshtriplett
Fix read_to_end to not grow an exact size buffer

If you know how much data to expect and use `Vec::with_capacity` to pre-allocate a buffer of that capacity, `Read::read_to_end` will still double its capacity. It needs some space to perform a read, even though that read ends up returning `0`.

It's a bummer to carefully pre-allocate 1GB to read a 1GB file into memory and end up using 2GB.

This fixes that behavior by special casing a full buffer and reading into a small "probe" buffer instead. If that read returns `0` then it's confirmed that the buffer was the perfect size. If it doesn't, the probe buffer is appended to the normal buffer and the read loop continues.

Fixing this allows several workarounds in the standard library to be removed:

- `Take` no longer needs to override `Read::read_to_end`.
- The `reservation_size` callback that allowed `Take` to inhibit the previous over-allocation behavior isn't needed.
- `fs::read` doesn't need to reserve an extra byte in `initial_buffer_size`.

Curiously, there was a unit test that specifically checked that `Read::read_to_end` *does* over-allocate. I removed that test, too.
2021-10-04 04:44:56 +00:00
Josh Triplett
199b33f0d7
Use a test value that doesn't depend on the handling of even/odd rounding 2021-10-03 20:15:12 -07:00
Aaron Hill
fdd8a0dde5
Don't suggest replacing region with 'static in NLL
Fixes #73159

This is similar to #69350 - if the user didn't initially
write out a 'static lifetime, adding 'static in response to
a lifetime error is usually the wrong thing to do.
2021-10-03 21:53:48 -05:00
Nicholas-Baron
3760c91252 Make write_rustdoc_diff a more generic function 2021-10-03 17:07:43 -07:00
Nicholas-Baron
2a57a46249 Extract a portion of diff writing code to separate function 2021-10-03 16:53:45 -07:00
Aaron Hill
5b6604825e
Add regression test for spurious const error with NLL
Fixes #55825
2021-10-03 16:55:06 -05:00
bors
87bb18e7c2 Auto merge of #88175 - camsteffen:let-desugar-span, r=Manishearth
Add expansion to while desugar spans

In the same vein as #88163, this reverts a change in Clippy behavior as a result of #80357 (and reverts some `#[allow]`s): This changes `clippy::blocks_in_if_conditions` to not fire on `while` loops. Though we might actually want Clippy to lint those cases, we should introduce the change purposefully, with tests, and possibly under a different lint name.

The actual change here is to add a desugaring expansion to the spans when lowering a `while` loop.

r? `@Manishearth`
2021-10-03 21:44:10 +00:00
bors
e737694a4d Auto merge of #88175 - camsteffen:let-desugar-span, r=Manishearth
Add expansion to while desugar spans

In the same vein as #88163, this reverts a change in Clippy behavior as a result of #80357 (and reverts some `#[allow]`s): This changes `clippy::blocks_in_if_conditions` to not fire on `while` loops. Though we might actually want Clippy to lint those cases, we should introduce the change purposefully, with tests, and possibly under a different lint name.

The actual change here is to add a desugaring expansion to the spans when lowering a `while` loop.

r? `@Manishearth`
2021-10-03 21:44:10 +00:00
Fabian Wolff
e3996ffcb6 Fix Lower/UpperExp formatting for integers and precision zero 2021-10-03 23:05:03 +02:00
Fabian Wolff
dd9b4763a4 Disable SimplifyBranchSame optimization for now 2021-10-03 22:58:24 +02:00
Benoît du Garreau
4846fd92c0 Revert suggested use of unwrap_or 2021-10-03 22:56:34 +02:00
Alphyr
70e55a8938
Apply suggestions
Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-03 22:44:07 +02:00
Fabian Wolff
20489eaca2 Update comments 2021-10-03 21:06:49 +02:00
Fabian Wolff
a28a78f247 Fix ICE with buffered lint referring to AST node deleted by everybody_loops 2021-10-03 21:04:36 +02:00
bors
9dbb26efe8 Auto merge of #89486 - rusticstuff:docker_letsencrypt_ca_update, r=Mark-Simulacrum
Update Let's Encrypt ROOT CA certificate in dist-(i686|x86_64)-linux docker images

The DST Root CA X3 used by Let's Encrypt has expired ([Let's Encrypt announcement](https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/)). This patch installs the new root certificate (ISRG Root X1) and disables the old one. Disabling the old one is necessary because otherwise curl still fails to download from servers with Let's Encrypt certs even though they are cross-signed.

Fixes #89484.
2021-10-03 19:03:23 +00:00
Mark Rousskov
1c2ad79f9d Add two inline annotations for hot functions
These two functions are essentially no-ops (and compile to just a load and
return), but show up in process_obligations profiles with a high call count --
so worthwhile to try and inline them away.
2021-10-03 12:43:43 -04:00
bors
08759c691e Auto merge of #88086 - ssomers:btree_clone_testing, r=dtolnay
BTree: toughen panicky test of clone()

Test did not cover the second half of `clone_subtree` and why this clones key & value first.
2021-10-03 16:22:37 +00:00
Fabian Wolff
e34fd54611 Deny where clauses on auto traits 2021-10-03 18:06:21 +02:00
bjorn3
9f4cb862ca Replace Fn impls with RPIT impls in rustc_index
This is cleaner and removes an unstable feature usage
2021-10-03 17:50:53 +02:00
Orson Peters
6dd6e7c002 Added tracking issue numbers for int_abs_diff. 2021-10-03 17:44:07 +02:00
Camille GILLOT
b2ed9c4007 Add some inlining. 2021-10-03 16:08:57 +02:00
Camille GILLOT
48ae6ec4f3 Update ui-fulldeps. 2021-10-03 16:08:56 +02:00
Camille GILLOT
fedd7785fe Access StableHashingContext in rustc_query_system. 2021-10-03 16:08:55 +02:00
Camille GILLOT
471cb5c149 Fully remove rustc_middle::ich. 2021-10-03 16:08:55 +02:00
Camille GILLOT
02025d86ac Remove re-export. 2021-10-03 16:08:54 +02:00
Camille GILLOT
c355b2e5cd Move ICH to rustc_query_system. 2021-10-03 16:08:53 +02:00
Camille GILLOT
2d38c53767 Remove StableHashProvider. 2021-10-03 16:08:52 +02:00
Camille GILLOT
8961616e60 Move rustc_middle::middle::cstore to rustc_session. 2021-10-03 16:08:51 +02:00
Camille GILLOT
b66dfaaa64 Move some HashStable impls. 2021-10-03 16:08:50 +02:00
Fabian Wolff
529c35331b Fix unsound optimization with explicit variant discriminants 2021-10-03 16:04:38 +02:00
bors
5051904d66 Auto merge of #87870 - WaffleLapkin:pub_split_at_unchecked, r=dtolnay
Make `<[T]>::split_at_unchecked` and `<[T]>::split_at_mut_unchecked` public

The methods were originally added in https://github.com/rust-lang/rust/pull/75936 (30dc32b10e), but for some reason as private. Nevertheless, the methods have documentation and even a [tracking issue](https://github.com/rust-lang/rust/issues/76014).

It's very weird to have a tracking issue for private methods and these methods may be useful outside of the standard library. As such, this PR makes the methods public.
2021-10-03 13:41:52 +00:00
Fabian Wolff
9626f2bd84 Fix extra non_snake_case warning for shorthand field bindings 2021-10-03 14:33:14 +02:00
Stefan Schindler
e599e2df49 Move from grid layout to table based layout because of browser limits that overlay row entries after a UA specific amount of rows 2021-10-03 08:20:08 -04:00
Stefan Schindler
677fb6b1db Show how many tests are running in parallel 2021-10-03 08:20:08 -04:00
Stefan Schindler
a0cc9bb0f6 Add a test to detect overlapping entries in overview tables
Detects https://github.com/rust-lang/rust/issues/88545
2021-10-03 08:20:08 -04:00
Fabian Wolff
cf19131cb3 Try to recover from a => -> = or -> typo in a match arm 2021-10-03 14:14:35 +02:00
Matthias Kaak
d6a7e74c81 Combined 4 commits into 1
Fixed numerus of error message

Removed superfluous argument

Using pluralize!() instead of code duplication

Adjusted a test
2021-10-03 11:53:12 +00:00
bors
4479cb82e5 Auto merge of #89459 - tspiteri:idiv-overflow-bitand, r=kennytm
Use bitand when checking for signed integer division overflow

For `self == Self::MIN && rhs == -1`, LLVM does not realize that this is the same check made by `self / rhs`, so the code generated may have some unnecessary duplication. For `(self == Self::MIN) & (rhs == -1)`, LLVM realizes it is the same check.
2021-10-03 10:34:57 +00:00
bors
63b04f7d7f Auto merge of #7755 - HKalbasi:master, r=xFrednet
exclude enum from derivable impls

fix #7753

changelog: Exclude enum from ``[`derivable_impls`]``
2021-10-03 10:30:16 +00:00
HKalbasi
0ebc656a9a
Change not enum to is struct 2021-10-03 13:01:57 +03:30
Hans Kratz
32e19fbecb Update Let's Encrypt ROOT CA certificate in dist-(i686|x86_64)-linux docker images 2021-10-03 10:58:37 +02:00
bors
33c34fb2d7 Auto merge of #7709 - Qwaz:drop_non_send, r=xFrednet
Implement `non_send_field_in_send_ty` lint

changelog: Implement [`non_send_fields_in_send_ty`] lint

Fixes #7703
2021-10-03 08:43:32 +00:00
hkalbasi
ea8e65f0da exclude enum from derivable impls 2021-10-03 11:58:27 +03:30