about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2021-10-04Fix suggestion to borrow when casting from pointer to referenceFabian Wolff-14/+80
2021-10-04Add test for duplicated doc aliasesGuillaume Gomez-0/+33
2021-10-04Add a check for duplicated doc aliases in unused lintGuillaume Gomez-7/+38
2021-10-04Implement equatable if let linthkalbasi-253/+572
2021-10-04Auto merge of #7761 - giraffate:fix_ice_in_inplicit_hasher, r=Manishearthbors-18/+41
Fix ICE in `implicit_hasher` close #7712 changelog: Fix ICE in [`implicit_hasher`]
2021-10-04Optimize `saturating_add_signed`Benoît du Garreau-3/+6
2021-10-04Make `proc_macro_derive_resolution_fallback` a future-breakage lintAaron Hill-0/+73
When `cargo report future-incompatibilities` is stabilized (see #71249), this will cause dependencies that trigger this lint to be included in the report.
2021-10-04Fix ICE in `implicit_hasher`Takayuki Nakata-18/+41
2021-10-04Auto merge of #88834 - the8472:char-count, r=joshtriplettbors-7/+39
optimize str::from_utf8() validation when slice contains multibyte chars and str.chars().count() in all cases The change shows small but consistent improvements across several x86 target feature levels. I also tried to optimize counting with `slice.as_chunks` but that yielded more inconsistent results, bigger improvements for some optimization levels, lesser ones in others. ``` old, -O2, x86-64 test str::str_char_count_emoji ... bench: 1,924 ns/iter (+/- 26) test str::str_char_count_lorem ... bench: 879 ns/iter (+/- 12) test str::str_char_count_lorem_short ... bench: 5 ns/iter (+/- 0) new, -O2, x86-64 test str::str_char_count_emoji ... bench: 1,878 ns/iter (+/- 21) test str::str_char_count_lorem ... bench: 851 ns/iter (+/- 11) test str::str_char_count_lorem_short ... bench: 4 ns/iter (+/- 0) old, -O2, x86-64-v2 test str::str_char_count_emoji ... bench: 1,477 ns/iter (+/- 46) test str::str_char_count_lorem ... bench: 675 ns/iter (+/- 15) test str::str_char_count_lorem_short ... bench: 5 ns/iter (+/- 0) new, -O2, x86-64-v2 test str::str_char_count_emoji ... bench: 1,323 ns/iter (+/- 39) test str::str_char_count_lorem ... bench: 593 ns/iter (+/- 18) test str::str_char_count_lorem_short ... bench: 4 ns/iter (+/- 0) old, -O2, x86-64-v3 test str::str_char_count_emoji ... bench: 748 ns/iter (+/- 7) test str::str_char_count_lorem ... bench: 348 ns/iter (+/- 2) test str::str_char_count_lorem_short ... bench: 5 ns/iter (+/- 0) new, -O2, x86-64-v3 test str::str_char_count_emoji ... bench: 650 ns/iter (+/- 4) test str::str_char_count_lorem ... bench: 301 ns/iter (+/- 1) test str::str_char_count_lorem_short ... bench: 5 ns/iter (+/- 0) ``` and for the multibyte-char string validation: ``` old, -O2, x86-64 test str::str_validate_emoji ... bench: 4,606 ns/iter (+/- 64) new, -O2, x86-64 test str::str_validate_emoji ... bench: 3,837 ns/iter (+/- 60) ```
2021-10-04Don't rebuild GUI test crates every time you run test src/test/rustdoc-guiGuillaume Gomez-1/+1
2021-10-04Auto merge of #89489 - FabianWolff:issue-89485, r=oli-obkbors-8/+52
Fix unsound optimization with explicit variant discriminants Fixes #89485.
2021-10-04Stabilize try_reserveKornel-42/+14
2021-10-04Add doc aliases to `std::thread::available_parallelism`Yoshua Wuyts-0/+2
2021-10-04librustdoc: Use correct heading levels.Mukund Lakshman-118/+147
- Avoid multiple <h1>s on a page. - The <h#> tags should follow a semantic hierarchy. - Cap at h6 (no h7)
2021-10-04Auto merge of #89512 - Manishearth:rollup-meh9x7r, r=Manishearthbors-135/+251
Rollup of 14 pull requests Successful merges: - #86434 (Add `Ipv6Addr::is_benchmarking`) - #86828 (const fn for option copied, take & replace) - #87679 (BTree: refine some comments) - #87910 (Mark unsafe methods NonZero*::unchecked_(add|mul) as const.) - #88286 (Remove unnecessary unsafe block in `process_unix`) - #88305 (Manual Debug for Unix ExitCode ExitStatus ExitStatusError) - #88353 (Partially stabilize `array_methods`) - #88370 (Add missing `# Panics` section to `Vec` method) - #88481 (Remove some feature gates) - #89138 (Fix link in Ipv6Addr::to_ipv4 docs) - #89401 (Add truncate note to Vec::resize) - #89467 (Fix typos in rustdoc/lints) - #89472 (Only register `WSACleanup` if `WSAStartup` is actually ever called) - #89505 (Add regression test for spurious const error with NLL) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-10-04Move generic error message to separate brancheskadmin-52/+111
This decomposes an error message in generic constants into more specific branches, for better readability.
2021-10-04Stabilize `const_panic`Jacob Pratt-229/+100
2021-10-03Rollup merge of #89505 - Aaron1011:nll-const-test, r=Mark-SimulacrumManish Goregaokar-0/+20
Add regression test for spurious const error with NLL Fixes #55825
2021-10-03Rollup merge of #89472 - nagisa:nagisa/wsa-cleanup, r=dtolnayManish Goregaokar-6/+21
Only register `WSACleanup` if `WSAStartup` is actually ever called See https://github.com/rust-lang/rust/pull/85595 Fixes #85441
2021-10-03Rollup merge of #89467 - tniessen:rustdoc-unecessary, r=jyn514Manish Goregaokar-3/+3
Fix typos in rustdoc/lints This PR merely fixes a few typos in a recently introduced change :) Refs: https://github.com/rust-lang/rust/pull/85223
2021-10-03Rollup merge of #89401 - owengage:master, r=joshtriplettManish Goregaokar-0/+1
Add truncate note to Vec::resize A very minor addition to the `Vec::resize` documentation to point out the `truncate` method. When I was searching for something matching `truncate` I managed to miss it, along with some colleagues. We later found it by chance. We did find `resize` however, so I was hoping to point it out in the documentation.
2021-10-03Rollup merge of #89138 - newpavlov:patch-2, r=dtolnayManish Goregaokar-1/+1
Fix link in Ipv6Addr::to_ipv4 docs
2021-10-03Rollup merge of #88481 - bjorn3:remove_feature_gates, r=cjgillotManish Goregaokar-65/+31
Remove some feature gates The first commit removes various feature gates that are unused. The second commit replaces some `Fn` implementations with `Iterator` implementations, which is much cleaner IMO. The third commit replaces an unboxed_closures feature gate with min_specialization. For some reason the unboxed_closures feature gate suppresses the min_specialization feature gate from triggering on an `TrustedStep` impl. The last comment just turns a regular comment into a doc comment as drive by cleanup. I can move it to a separate PR if preferred.
2021-10-03Rollup merge of #88370 - Seppel3210:master, r=dtolnayManish Goregaokar-1/+6
Add missing `# Panics` section to `Vec` method namely `Vec::extend_from_within`
2021-10-03Rollup merge of #88353 - jhpratt:stabilize-array-as-ref, r=joshtriplettManish Goregaokar-3/+3
Partially stabilize `array_methods` This stabilizes `<[T; N]>::as_slice` and `<[T; N]>::as_mut_slice`, which is forms part of the `array_methods` feature: #76118. This also makes `<[T; N]>::as_slice` const due to its trivial nature.
2021-10-03Rollup merge of #88305 - ijackson:exitstatus-debug, r=dtolnayManish Goregaokar-3/+21
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-03Rollup merge of #88286 - LeSeulArtichaut:unnecessary-unsafe-block-std, r=dtolnayManish Goregaokar-2/+1
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-03Rollup merge of #87910 - iago-lito:mark_unsafe_nonzero_arithmetics_as_const, ↵Manish Goregaokar-2/+2
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-03Rollup merge of #87679 - ssomers:btree_comments, r=joshtriplettManish Goregaokar-10/+8
BTree: refine some comments
2021-10-03Rollup merge of #86828 - lambinoo:67441-const-fn-copied-take-replace, ↵Manish Goregaokar-7/+30
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-03Rollup merge of #86434 - CDirkx:ipv6-benchmarking, r=joshtriplettManish Goregaokar-32/+103
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-04:arrow_up: rust-analyzerLaurențiu Nicola-17/+18
2021-10-04Auto merge of #89165 - jkugelman:read-to-end-overallocation, r=joshtriplettbors-41/+37
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-03Use a test value that doesn't depend on the handling of even/odd roundingJosh Triplett-1/+1
2021-10-03Don't suggest replacing region with 'static in NLLAaron Hill-214/+25
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-03Make write_rustdoc_diff a more generic functionNicholas-Baron-8/+21
2021-10-03Extract a portion of diff writing code to separate functionNicholas-Baron-38/+50
2021-10-03Add regression test for spurious const error with NLLAaron Hill-0/+20
Fixes #55825
2021-10-03Auto merge of #88175 - camsteffen:let-desugar-span, r=Manishearthbors-14/+11
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-03Auto merge of #88175 - camsteffen:let-desugar-span, r=Manishearthbors-24/+28
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-03Fix Lower/UpperExp formatting for integers and precision zeroFabian Wolff-2/+2
2021-10-03Disable `SimplifyBranchSame` optimization for nowFabian Wolff-0/+6
2021-10-03Revert suggested use of `unwrap_or`Benoît du Garreau-2/+10
2021-10-03Apply suggestionsAlphyr-12/+6
Co-authored-by: kennytm <kennytm@gmail.com>
2021-10-03Fix implementation of `clean::Path::whole_name()`Noah Lev-1/+5
I think that before this commit, the path `::std::vec::Vec` would have rendered as `{{root}}::std::vec::Vec`. Now, it should render correctly as `::std::vec::Vec`.
2021-10-03Fix a place that used the old `Path` representationNoah Lev-2/+1
2021-10-03Update commentsFabian Wolff-8/+18
2021-10-03Fix ICE with buffered lint referring to AST node deleted by everybody_loopsFabian Wolff-6/+38
2021-10-03Auto merge of #89486 - rusticstuff:docker_letsencrypt_ca_update, ↵bors-0/+41
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-03Rename `strip_path` to `strip_path_generics`Noah Lev-2/+3
The new name is more descriptive of what the function does.