Commit graph

10907 commits

Author SHA1 Message Date
Tobias Decking 0f96c71792 Improve the floating point parser in dec2flt.
* Remove all remaining traces of unsafe.
* Put `parse_8digits` inside a loop.
* Rework parsing of inf/NaN values.
2023-04-10 00:47:08 +02:00
bors 1c39afb375 Auto merge of #109684 - fee1-dead-contrib:rv_const_range, r=Mark-Simulacrum
Revert #104100, Allow using `Range` as an `Iterator` in const contexts.

This fixes #109632.
2023-04-09 15:42:27 +00:00
bors 7201301df6 Auto merge of #109500 - petrochenkov:modchainld, r=oli-obk
resolve: Preserve reexport chains in `ModChild`ren

This may be potentially useful for
- avoiding uses of `hir::ItemKind::Use` (which usually lead to correctness issues)
- preserving documentation comments on all reexports, including those from other crates
- preserving and checking stability/deprecation info on reexports
- all kinds of diagnostics

The second commit then migrates some hacky logic from rustdoc to `module_reexports` to make it simpler and more correct.
Ideally rustdoc should use `module_reexports` immediately at the top level, so `hir::ItemKind::Use`s are never used.
The second commit also fixes issues with https://github.com/rust-lang/rust/pull/109330 and therefore
Fixes https://github.com/rust-lang/rust/issues/109631
Fixes https://github.com/rust-lang/rust/issues/109614
Fixes https://github.com/rust-lang/rust/issues/109424
2023-04-09 13:05:56 +00:00
bors 7cd6f55323 Auto merge of #110101 - JohnTitor:rollup-ol20aw7, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #110058 (Remove `box_syntax` usage)
 - #110059 (ignore_git → omit_git_hash)
 - #110060 (Document that `&T` and `&mut T` are `Sync` if `T` is)
 - #110074 (Make the "codegen" profile of `config.toml` download and build llvm from source.)
 - #110086 (Add `max_line_length` to `.editorconfig`, matching rustfmt)
 - #110096 (Tweak tuple indexing suggestion)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-09 05:00:24 +00:00
Yuki Okushi 1e4361a23f
Rollup merge of #110060 - WaffleLapkin:sync_refs, r=jyn514
Document that `&T` and `&mut T` are `Sync` if `T` is

Proof: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=fec8dc9ec36e873bf2962a2367d67045
2023-04-09 12:35:54 +09:00
Michael Goulet 920c51c526 Enforce that PointerLike requires a pointer-like ABI 2023-04-08 21:11:16 +00:00
Vadim Petrochenkov 612ddd2196 std: Mark two reexports that should be inlined as doc(inline) 2023-04-08 13:29:16 +03:00
bors 9e124c4f7a Auto merge of #110076 - Nilstrieb:rollup-22yp01c, r=Nilstrieb
Rollup of 5 pull requests

Successful merges:

 - #110030 (rustdoc: clean up JS)
 - #110037 (rustdoc: add test and bug fix for theme defaults)
 - #110065 (Fix wrong type in docs: i16 -> u16)
 - #110068 (Temporarily remove myself from reviewers list)
 - #110075 (Fix a typo in `config.example.toml`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-08 09:06:34 +00:00
Deadbeef 0cd49018d1 Revert "Make the Step implementations const."
This reverts commit 7bc67ef6e0.
2023-04-08 08:18:29 +00:00
Deadbeef 04a5d61161 Revert "Mark DoubleEndedIterator as #[const_trait] using rustc_do_not_const_check, implement const Iterator and DoubleEndedIterator for Range."
This reverts commit 8a9d6bf4fd.
2023-04-08 08:18:29 +00:00
bors c49c4fba11 Auto merge of #109995 - enkron:u/enkron/substitute-hardcoded-port-num-in-listen-on-fn, r=the8472
chore(tcp): change a hardcoded port number in a doctest to `port` var

The `listen_on` function in the example has a `port` option but doesn't use it
2023-04-08 06:54:40 +00:00
Sergei Belokon 081e222d99 fix(tcp): remove redundant format! macro call 2023-04-08 08:20:05 +10:00
Jörn Bethune 7e9e91c3d3 Fix wrong type in docs: i16 -> u16
@rustbot label +A-docs

r? docs
2023-04-07 23:49:20 +02:00
Maybe Waffle 5f50c0f7ac Document that &T and &mut T are Sync if T is 2023-04-07 18:36:48 +00:00
Tomasz Miąsko 67b4614180 Inline try_from and try_into
To avoid link time dependency between core and compiler-builtins, when
using opt-level that implicitly enables -Zshare-generics.

While compiler-builtins should be compiled with -Zshare-generics
disabled, the -Zbuild-std does not ensure this at the moment.
2023-04-07 14:59:10 +02:00
bors b6f6104a1f Auto merge of #110019 - jplatte:jplatte/stabilize-is-some-and, r=Amanieu
Stabilize is_some_and

This stabilizes the following public API:

```rust
impl<T> Option<T> {
    pub fn is_some_and(self, f: impl FnOnce(T) -> bool) -> bool;
}

impl<T, E> Result<T, E> {
    pub fn is_ok_and(self, f: impl FnOnce(T) -> bool) -> bool;
    pub fn is_err_and(self, f: impl FnOnce(E) -> bool) -> bool;
}
```

Closes #93050 (tracking issue).

`@rustbot` label +T-libs-api -T-libs
2023-04-07 08:09:20 +00:00
bors 97879ce24b Auto merge of #109990 - gwy15:remove-bufwriter-useless-mut-pointer, r=jyn514
Remove an unnecessary `mut` in `BufWriter::into_parts`.

`ptr::read` takes `*const T` so `&mut` is not necessary.
2023-04-07 05:49:34 +00:00
Matthias Krüger 17ed06aad2
Rollup merge of #109960 - thomcc:symlink-junction-buffer-overrun, r=ChrisDenton
Fix buffer overrun in bootstrap and (test-only) symlink_junction

I don't think these can be hit in practice, due to their inputs being valid paths. It's also not security-sensitive code, but just... bad vibes.

I think this is still not really the right way to do this (in terms of path correctness), but is no worse than it was.

r? `@ChrisDenton`
2023-04-07 00:00:25 +02:00
Matthias Krüger b7e6973287
Rollup merge of #109806 - Zoxc:gnu-tls, r=pnkfelix
Workaround #109797 on windows-gnu

The addition of `#[inline]` here in https://github.com/rust-lang/rust/pull/108089 caused an unrelated linking issue (https://github.com/rust-lang/rust/issues/109797). This PR removes this attribute again on Windows to avoid regressions.
2023-04-07 00:00:23 +02:00
Jonas Platte 443928f7e3
Stabilize is_some_and 2023-04-06 23:14:23 +02:00
Sergei Belokon 502cb6f4b9 chore(tcp): change the hardcoded port number to port var
The `listen_on` function in the example has a `port` option but doesn't
use it
2023-04-06 18:32:01 +10:00
管唯宇 9169107c1c Remove an unnecessary mut in BufWriter::into_parts.
`ptr::read` takes `*const T` so `&mut` is not necessary.
2023-04-06 11:48:16 +08:00
Konrad Borowski 279f35ce50 Derive String's PartialEq implementation 2023-04-05 20:58:21 +02:00
Thom Chiovoloni 6861750e66
Fix buffer overrun in (test-only) symlink_junction 2023-04-05 00:37:30 -07:00
bors f98a271814 Auto merge of #94786 - joshlf:patch-5, r=dtolnay
Document NonZeroXxx layout guarantees

Document that `NonZeroXxx` has the same layout and bit validity as `Xxx` with the exception of `0`.
2023-04-05 01:09:59 +00:00
Yuki Okushi ed5e2ddeed
Rollup merge of #109883 - skaunov:patch-1, r=thomcc
Add links to <cell.rs>

`UnsafeCell` page could benefit too from having links to these most popular structs in the module.
2023-04-04 05:52:34 +09:00
bors 1767585509 Auto merge of #109756 - cr1901:msp-shift, r=Mark-Simulacrum
Update compiler-builtins to 0.1.91 to bring in msp430 shift primitive…

… fixes.

This fixes unsoundness on MSP430 where `compiler-builtins` and LLVM didn't agree on the width of the shift amount argument of the shifting primitives (4 bytes vs 2 bytes). See https://github.com/rust-lang/compiler-builtins/pull/522 for more details.
2023-04-03 13:09:08 +00:00
bors f13ccefb5b Auto merge of #108448 - ishitatsuyuki:binary-heap, r=Mark-Simulacrum
binary_heap: Optimize Extend implementation.

This PR makes the `Extend` implementation for `BinaryHeap` no longer rely on specialization, so that it always use the bulk rebuild optimization that was previously only available for the `Vec` specialization.
2023-04-03 10:30:20 +00:00
Matthias Krüger f2f5efce9c
Rollup merge of #109722 - hermitcore:read, r=Mark-Simulacrum
Implement read_buf for RustHermit

In principle, this PR extends rust-lang/rust#108326 for RustyHermit.
2023-04-03 08:58:53 +02:00
Sergey Kaunov abc61d23de
Add links to <cell.rs>
`UnsafeCell` page could benefit too from having links to these most popular structs in the module.
2023-04-03 09:18:14 +03:00
bors 11cd4ff34d Auto merge of #109852 - Nilstrieb:rollup-g3mgxxw, r=Nilstrieb
Rollup of 4 pull requests

Successful merges:

 - #109839 (Improve grammar of Iterator.partition_in_place)
 - #109840 (Fix typo in std/src/os/fd/owned.rs)
 - #109844 (a couple clippy::complexity fixes)
 - #109846 (more clippy::complexity fixes (iter_kv_map, map_flatten, nonminimal_bool))

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-04-02 09:39:41 +00:00
Nilstrieb 099f3469a9
Rollup merge of #109840 - taiki-e:typo, r=ChrisDenton
Fix typo in std/src/os/fd/owned.rs
2023-04-02 10:08:34 +02:00
Nilstrieb a38bdd4439
Rollup merge of #109839 - sartak:iter-grammar, r=scottmcm
Improve grammar of Iterator.partition_in_place

This is my first PR against Rust, please let me know if there's anything I should be providing here! I didn't find any instructions specific to documentation grammar in the [std-dev guide](https://std-dev-guide.rust-lang.org/documentation/summary.html).
2023-04-02 10:08:33 +02:00
bors 637d7fdb23 Auto merge of #109701 - Amanieu:binaryheap_retain, r=ChrisDenton
Stabilize `binary_heap_retain`

FCP finished in tracking issue: #71503
2023-04-02 07:04:01 +00:00
bors 0599b6b931 Auto merge of #109483 - joboet:optimize_lazycell, r=Mark-Simulacrum
Optimize `LazyCell` size

`LazyCell` can only store either the initializing function or the data it produces, so it does not need to reserve the space for both. Similar to #107329, but uses an `enum` instead of a `union`.
2023-04-01 20:11:49 +00:00
Taiki Endo 455a9601da Fix typo in std/src/os/fd/owned.rs 2023-04-02 02:14:37 +09:00
Shawn M Moore ec71feb984 Improve grammar of Iterator.partition_in_place
b9535c0b7d Auto merge of #109801 - aliemjay:test-implied-normalization, r=petrochenkov
2023-04-01 13:01:00 -04:00
Guillaume Gomez 6c93c63771
Rollup merge of #109443 - GuillaumeGomez:doc-primitive-hard-error, r=notriddle
Move `doc(primitive)` future incompat warning to `invalid_doc_attributes`

Fixes #88070.

It's been a while since this was turned into a "future incompatible lint" so I think we can now turn it into a hard error without problem.

r? `@jyn514`
2023-03-31 22:32:49 +02:00
bors 22a7a19f93 Auto merge of #98112 - saethlin:mir-alignment-checks, r=oli-obk
Insert alignment checks for pointer dereferences when debug assertions are enabled

Closes https://github.com/rust-lang/rust/issues/54915

- [x] Jake tells me this sounds like a place to use `MirPatch`, but I can't figure out how to insert a new basic block with a new terminator in the middle of an existing basic block, using `MirPatch`. (if nobody else backs up this point I'm checking this as "not actually a good idea" because the code looks pretty clean to me after rearranging it a bit)
- [x] Using `CastKind::PointerExposeAddress` is definitely wrong, we don't want to expose. Calling a function to get the pointer address seems quite excessive. ~I'll see if I can add a new `CastKind`.~ `CastKind::Transmute` to the rescue!
- [x] Implement a more helpful panic message like slice bounds checking.

r? `@oli-obk`
2023-03-31 08:50:35 +00:00
John Kåre Alsaker 6c941362c9 Workaround #109797 on windows-gnu 2023-03-31 09:37:39 +02:00
Matthias Krüger ec276c7e67
Rollup merge of #109793 - lukas-code:negative-impl-comment, r=scottmcm
add comment to `impl !Error for &str`

I saw this impl in the [standard library docs](https://doc.rust-lang.org/nightly/core/error/trait.Error.html#impl-Error-for-%26str) and wondered why it's needed. This commit adds a comment to explain its existence.
2023-03-31 08:03:15 +02:00
Matthias Krüger 0708fbf5cb
Rollup merge of #109784 - beetrees:riscv32-time64, r=cuviper
Refactor glibc time64 support, riscv32 always has 64-bit `time_t`

Refactor existing support for 64-bit `time_t` on 32-bit glibc platforms, as riscv32 `time_t` is 64-bit by default. Split out of #109773.
2023-03-31 08:03:15 +02:00
Matthias Krüger 41369b734d
Rollup merge of #109598 - veera-sivarajan:improve-wording, r=thomcc
Improve documentation for str::replace() and str::replacen()

Currently, to know what the function will return when the pattern doesn't match, the docs require the reader to understand the implementation detail and mentally evaluate or run the example code. It is not immediately clear.

This PR makes it more explicit so the reader can quickly find the information.
2023-03-31 08:03:14 +02:00
Guillaume Gomez 364e961417 Replace doc(primitive) with rustc_doc_primitive 2023-03-30 22:56:52 +02:00
Lukas Markeffsky bdb0c7f427 add comment to impl !Error for &str 2023-03-30 22:19:28 +02:00
beetrees 8d1bf505ff
Refactor glibc time64 support, riscv32 always has 64-bit time_t 2023-03-30 19:43:47 +01:00
joboet af080bf04b
fix typo and adjust comment
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-03-30 14:49:43 +02:00
joboet 97d49fcf60
core: use pointer::write to cleanup LazyCell initialization 2023-03-30 14:49:43 +02:00
joboet c7f9739bad
core: improve code documentation for LazyCell 2023-03-30 14:49:43 +02:00
joboet f015e6fe49
core: optimize LazyCell size 2023-03-30 14:49:42 +02:00