about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2023-04-09Auto merge of #109500 - petrochenkov:modchainld, r=oli-obkbors-0/+2
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-09Use `Display` in top-level example for `PanicInfo`Lukas Markeffsky-6/+2
2023-04-09Fix typo in todo! macro docstringPatrik Kormosi-1/+1
2023-04-09Auto merge of #110101 - JohnTitor:rollup-ol20aw7, r=JohnTitorbors-0/+2
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-09Rollup merge of #110060 - WaffleLapkin:sync_refs, r=jyn514Yuki Okushi-0/+2
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-08Enforce that PointerLike requires a pointer-like ABIMichael Goulet-1/+1
2023-04-08Add 64-bit `time_t` support on 32-bit glibc Linux to `set_times`beetrees-2/+39
2023-04-08sync::mpsc: synchronize receiver disconnect with initializationPetros Angelatos-0/+12
Receiver disconnection relies on the incorrect assumption that `head.index != tail.index` implies that the channel is initialized (i.e `head.block` and `tail.block` point to allocated blocks). However, it can happen that `head.index != tail.index` and `head.block == null` at the same time which leads to a segfault when a channel is dropped in that state. This can happen because initialization is performed in two steps. First, the tail block is allocated and the `tail.block` is set. If that is successful `head.block` is set to the same pointer. Importantly, initialization is skipped if `tail.block` is not null. Therefore we can have the following situation: 1. Thread A starts to send the first value of the channel, observes that `tail.block` is null and begins initialization. It sets `tail.block` to point to a newly allocated block and then gets preempted. `head.block` is still null at this point. 2. Thread B starts to send the second value of the channel, observes that `tail.block` *is not* null and proceeds with writing its value in the allocated tail block and sets `tail.index` to 1. 3. Thread B drops the receiver of the channel which observes that `head.index != tail.index` (0 and 1 respectively), therefore there must be messages to drop. It starts traversing the linked list from `head.block` which is still a null pointer, leading to a segfault. This PR fixes this problem by waiting for initialization to complete when `head.index != tail.index` and the `head.block` is still null. A similar check exists in `start_recv` for similar reasons. Fixes #110001 Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
2023-04-08std: Mark two reexports that should be inlined as `doc(inline)`Vadim Petrochenkov-0/+2
2023-04-08Auto merge of #110076 - Nilstrieb:rollup-22yp01c, r=Nilstriebbors-1/+1
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-08Revert "Make the `Step` implementations const."Deadbeef-17/+7
This reverts commit 7bc67ef6e02d69023c6fb04c2258beab54ac22b8.
2023-04-08Revert "Mark DoubleEndedIterator as #[const_trait] using ↵Deadbeef-69/+9
rustc_do_not_const_check, implement const Iterator and DoubleEndedIterator for Range." This reverts commit 8a9d6bf4fd540b2a2882193cbd6232b86e5dcd7e.
2023-04-08Auto merge of #109995 - ↵bors-1/+1
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-07The `wrapping_neg` example for unsigned types shouldn't use `i8`Scott McMurray-5/+4
2023-04-08fix(tcp): remove redundant `format!` macro callSergei Belokon-1/+1
2023-04-07Fix wrong type in docs: i16 -> u16Jörn Bethune-1/+1
@rustbot label +A-docs r? docs
2023-04-07Document that `&T` and `&mut T` are `Sync` if `T` isMaybe Waffle-0/+2
2023-04-08Define UNWIND_DATA_REG for loongarch64zhaixiaojuan-0/+3
2023-04-07Don't claim LocalKey::with prevents a reference to be sent across threadsGiacomo Stevanato-2/+2
2023-04-07Avoid some manual slice length calculationScott McMurray-12/+4
No need for us to write the multiplication when `size_of_val` does exactly what we need.
2023-04-07Auto merge of #110019 - jplatte:jplatte/stabilize-is-some-and, r=Amanieubors-9/+3
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-07Auto merge of #109990 - gwy15:remove-bufwriter-useless-mut-pointer, r=jyn514bors-1/+1
Remove an unnecessary `mut` in `BufWriter::into_parts`. `ptr::read` takes `*const T` so `&mut` is not necessary.
2023-04-07Inline try_from and try_intoTomasz Miąsko-0/+2
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-07Rollup merge of #109960 - thomcc:symlink-junction-buffer-overrun, r=ChrisDentonMatthias Krüger-9/+25
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-07Rollup merge of #109806 - Zoxc:gnu-tls, r=pnkfelixMatthias Krüger-1/+3
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-06Stabilize is_some_andJonas Platte-9/+3
2023-04-06chore(tcp): change the hardcoded port number to `port` varSergei Belokon-1/+1
The `listen_on` function in the example has a `port` option but doesn't use it
2023-04-06Remove an unnecessary `mut` in `BufWriter::into_parts`.管唯宇-1/+1
`ptr::read` takes `*const T` so `&mut` is not necessary.
2023-04-05Derive String's PartialEq implementationKonrad Borowski-9/+1
2023-04-05Refactor core::char::EscapeDefault and co. structuresMichal Nazarewicz-206/+271
Change core::char::{EscapeUnicode, EscapeDefault and EscapeDebug} structures from using a state machine to computing escaped sequence upfront and during iteration just going through the characters. This is arguably simpler since it’s easier to think about having a buffer and start..end range to iterate over rather than thinking about a state machine. This also harmonises implementation of aforementioned iterators and core::ascii::EscapeDefault struct. This is done by introducing a new helper EscapeIterInner struct which holds the buffer and offers simple methods for iterating over range. As a side effect, this probably optimises Display implementation for those types since rather than calling write_char repeatedly, write_str is invoked once. On 64-bit platforms, it also reduces size of some of the structs: | Struct | Before | After | |----------------------------+--------+-------+ | core::char::EscapeUnicode | 16 | 12 | | core::char::EscapeDefault | 16 | 12 | | core::char::EscapeDebug | 16 | 16 | My ulterior motive and reason why I started looking into this is addition of as_str method to the iterators. With this change this will became trivial. It’s also going to be trivial to implement DoubleEndedIterator if that’s ever desired.
2023-04-05Fix buffer overrun in (test-only) symlink_junctionThom Chiovoloni-9/+25
2023-04-05Auto merge of #94786 - joshlf:patch-5, r=dtolnaybors-0/+7
Document NonZeroXxx layout guarantees Document that `NonZeroXxx` has the same layout and bit validity as `Xxx` with the exception of `0`.
2023-04-04Add links from `core::cmp` derives to their traitsclubby789-4/+7
2023-04-04library/unwind: Add definitions for loongarch64zhaixiaojuan-0/+3
2023-04-04library/std: Add support for loongarch64zhaixiaojuan-0/+3
2023-04-04Rollup merge of #109883 - skaunov:patch-1, r=thomccYuki Okushi-1/+1
Add links to <cell.rs> `UnsafeCell` page could benefit too from having links to these most popular structs in the module.
2023-04-03avoid zero-copy ops for File->Pipe and File->Socket in io::copyThe 8472-16/+46
2023-04-03test that modifications to the source don't become visible after io::copyThe 8472-0/+42
2023-04-03Preserve potential mood for equal or NUL signfleetingbytes-5/+3
Original `var_os` description said that it _may_ return an error if the value contains `=` or NUL. Let's make no promises on the `None` return value in these situation either, keep it in the [potential mood](https://en.wikipedia.org/wiki/Grammatical_mood#Potential).
2023-04-03Remove redundant empty linefleetingbytes-1/+0
one is enough
2023-04-03remove self-reference in var_os docfleetingbytes-1/+0
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
2023-04-03add situation where var_os returns Nonefleetingbytes-1/+7
Re-introduced some of the former errors as situations where `None` is returned.
2023-04-03Update env.rsfleetingbytes-10/+0
Remove `Errors` section from `var_os` documentation
2023-04-03Auto merge of #109756 - cr1901:msp-shift, r=Mark-Simulacrumbors-1/+1
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-03Auto merge of #108448 - ishitatsuyuki:binary-heap, r=Mark-Simulacrumbors-51/+19
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-03Rollup merge of #109722 - hermitcore:read, r=Mark-SimulacrumMatthias Krüger-7/+24
Implement read_buf for RustHermit In principle, this PR extends rust-lang/rust#108326 for RustyHermit.
2023-04-03Add links to <cell.rs>Sergey Kaunov-1/+1
`UnsafeCell` page could benefit too from having links to these most popular structs in the module.
2023-04-02Auto merge of #109852 - Nilstrieb:rollup-g3mgxxw, r=Nilstriebbors-3/+3
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-02Rollup merge of #109840 - taiki-e:typo, r=ChrisDentonNilstrieb-1/+1
Fix typo in std/src/os/fd/owned.rs
2023-04-02Rollup merge of #109839 - sartak:iter-grammar, r=scottmcmNilstrieb-2/+2
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).