about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2022-08-23Make use of `[wrapping_]byte_{add,sub}`Maybe Waffle-2/+3
...replacing `.cast().wrapping_offset().cast()` & similar code.
2022-08-23Rollup merge of #100835 - devnexen:listener_followups, r=devnexenDylan DPC-4/+2
net listen backlog update, follow-up from #97963. FreeBSD and using system limit instead for others.
2022-08-23Move personality functions to stdAmanieu d'Antras-0/+630
These were previously in the panic_unwind crate with dummy stubs in the panic_abort crate. However it turns out that this is insufficient: we still need a proper personality function even with -C panic=abort to handle the following cases: 1) `extern "C-unwind"` still needs to catch foreign exceptions with -C panic=abort to turn them into aborts. This requires landing pads and a personality function. 2) ARM EHABI uses the personality function when creating backtraces. The dummy personality function in panic_abort was causing backtrace generation to get stuck in a loop since the personality function is responsible for advancing the unwind state to the next frame.
2022-08-23Auto merge of #100782 - thomcc:fix-android-sigaddset, r=Mark-Simulacrumbors-3/+23
Align android `sigaddset` impl with the reference impl from Bionic In https://github.com/rust-lang/rust/pull/100737 I noticed we were treating the sigset_t as an array of bytes, while referencing code from android (https://github.com/aosp-mirror/platform_bionic/blob/ad8dcd6023294b646e5a8288c0ed431b0845da49/libc/include/android/legacy_signal_inlines.h) which treats it as an array of unsigned long. That said, the behavior difference is so subtle here that it's not hard to see why nobody noticed. This fixes the implementation to be equivalent to the one in bionic.
2022-08-22Add `AsFd` implementations for stdio types on WASI.Dan Gohman-1/+22
This mirrors the implementations on Unix platforms, and also mirrors the existing `AsRawFd` impls.
2022-08-22Move error trait into coreJane Losare-Lusby-226/+104
2022-08-22Export Cancel from std::os::fortanix_sgx::usercalls::rawMohsen Zohrevandi-1/+3
This was missed in https://github.com/rust-lang/rust/pull/100642
2022-08-22net listen backlog update, follow-up from #97963.David CARLIER-4/+2
FreeBSD and using system limit instead for others.
2022-08-22Rollup merge of #100820 - WaffleLapkin:use_ptr_is_aligned_methods, r=scottmcmDylan DPC-2/+3
Use pointer `is_aligned*` methods This PR replaces some manual alignment checks with calls to `pointer::{is_aligned, is_aligned_to}` and removes a useless pointer cast. r? `@scottmcm` _split off from #100746_
2022-08-22Rollup merge of #100331 - lo48576:try-reserve-preserve-on-failure, r=thomccDylan DPC-2/+4
Guarantee `try_reserve` preserves the contents on error Update doc comments to make the guarantee explicit. However, some implementations does not have the statement though. * `HashMap`, `HashSet`: require guarantees on hashbrown side. * `PathBuf`: simply redirecting to `OsString`. Fixes #99606.
2022-08-22Rollup merge of #99957 - chotchki:ip-globally-reachable_rebase, ↵Dylan DPC-85/+217
r=Mark-Simulacrum Rework Ipv6Addr::is_global to check for global reachability rather than global scope - rebase Rebasing of pull request #86634 off of master to try and get the feature "ip" stabilized. I also found a test failure in the rebase that is_global was considering the benchmark space to be globally reachable. This is related to my other rebasing pull request #99947
2022-08-22update and extend some comments, and cfg-out some unused codeRalf Jung-7/+12
2022-08-22std: use realstd fast key when building testsRalf Jung-0/+10
2022-08-22Rollup merge of #93162 - camsteffen:std-prim-docs, r=Mark-SimulacrumDylan DPC-11/+56
Std module docs improvements My primary goal is to create a cleaner separation between primitive types and primitive type helper modules (fixes #92777). I also changed a few header lines in other top-level std modules (seen at https://doc.rust-lang.org/std/) for consistency. Some conventions used/established: * "The \`Box\<T>` type for heap allocation." - if a module mainly provides a single type, name it and summarize its purpose in the module header * "Utilities for the _ primitive type." - this wording is used for the header of helper modules * Documentation for primitive types themselves are removed from helper modules * provided-by-core functionality of primitive types is documented in the primitive type instead of the helper module (such as the "Iteration" section in the slice docs) I wonder if some content in `std::ptr` should be in `pointer` but I did not address this.
2022-08-21Extra documentation for new formatting featureIsaac Cloos-0/+2
High traffic macros should detail this helpful addition.
2022-08-21Rollup merge of #100839 - nelsonjchen:consistent_child_stdin_field_desc, ↵Matthias Krüger-5/+5
r=thomcc Make doc for stdin field of process consistent The other fields use this format and example.
2022-08-21Rollup merge of #100822 - WaffleLapkin:no_offset_question_mark, r=scottmcmMatthias Krüger-11/+11
Replace most uses of `pointer::offset` with `add` and `sub` As PR title says, it replaces `pointer::offset` in compiler and standard library with `pointer::add` and `pointer::sub`. This generally makes code cleaner, easier to grasp and removes (or, well, hides) integer casts. This is generally trivially correct, `.offset(-constant)` is just `.sub(constant)`, `.offset(usized as isize)` is just `.add(usized)`, etc. However in some cases we need to be careful with signs of things. r? ````@scottmcm```` _split off from #100746_
2022-08-21Make use of `pointer::is_aligned[_to]`Maybe Waffle-2/+3
2022-08-21Make doc for stdin field of process consistentNelson Chen-5/+5
The other fields use this format and example.
2022-08-21Fix redundant comparisonThom Chiovoloni-1/+1
2022-08-21Replace most uses of `pointer::offset` with `add` and `sub`Maybe Waffle-11/+11
2022-08-20Improve primitive/std docs separation and headersCameron Steffen-11/+56
2022-08-20Auto merge of #100810 - matthiaskrgr:rollup-xep778s, r=matthiaskrgrbors-35/+92
Rollup of 9 pull requests Successful merges: - #97963 (net listen backlog set to negative on Linux.) - #99935 (Reenable disabled early syntax gates as future-incompatibility lints) - #100129 (add miri-test-libstd support to libstd) - #100500 (Ban references to `Self` in trait object substs for projection predicates too.) - #100636 (Revert "Revert "Allow dynamic linking for iOS/tvOS targets."") - #100718 ([rustdoc] Fix item info display) - #100769 (Suggest adding a reference to a trait assoc item) - #100777 (elaborate how revisions work with FileCheck stuff in src/test/codegen) - #100796 (Refactor: remove unnecessary string searchings) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-20Rollup merge of #100129 - RalfJung:miri-test-libstd, r=thomccMatthias Krüger-33/+82
add miri-test-libstd support to libstd - The first commit mirrors what we already have in liballoc. - The second commit adds some regression tests that only really make sense to be run in Miri, since they rely on Miri's extra checks to detect anything. - The third commit makes the MPSC tests work in reasonable time in Miri by reducing iteration counts. - The fourth commit silences some warnings due to code being disabled with `cfg(miri)`
2022-08-20Rollup merge of #97963 - devnexen:net_listener_neg, r=the8472Matthias Krüger-2/+10
net listen backlog set to negative on Linux. it will be 4076 (from 5.4) or 128.
2022-08-20Rollup merge of #100710 - ChrisDenton:load-library, r=thomccMatthias Krüger-81/+93
Windows: Load synch functions together Attempt to load all the required sync functions and fail if any one of them fails. This fixes a FIXME by going back to optional loading of `WakeByAddressSingle`. Also reintroduces a macro for optional loading of functions but keeps it separate from the fallback macro rather than having that do two different jobs. r? `@thomcc`
2022-08-20Rollup merge of #100642 - mzohreva:mz/update-sgx-abi-cancel-queue, ↵Matthias Krüger-4/+31
r=Mark-Simulacrum Update fortanix-sgx-abi and export some useful SGX usercall traits Update `fortanix-sgx-abi` to 0.5.0 to add support for cancel queue (see https://github.com/fortanix/rust-sgx/pull/405 and https://github.com/fortanix/rust-sgx/pull/404). Export some useful traits for processing SGX usercall. This is needed for https://github.com/fortanix/rust-sgx/pull/404 to avoid duplication. cc `@raoulstrackx` and `@jethrogb`
2022-08-20Rollup merge of #99544 - dylni:expose-utf8lossy, r=Mark-SimulacrumMatthias Krüger-17/+32
Expose `Utf8Lossy` as `Utf8Chunks` This PR changes the feature for `Utf8Lossy` from `str_internals` to `utf8_lossy` and improves the API. This is done to eventually expose the API as stable. Proposal: rust-lang/libs-team#54 Tracking Issue: #99543
2022-08-20Expose `Utf8Lossy` as `Utf8Chunks`dylni-17/+32
2022-08-20Rollup merge of #100729 - thomcc:less-initialized, r=ChrisDentonMatthias Krüger-5/+13
Avoid zeroing a 1kb stack buffer on every call to `std::sys::windows::fill_utf16_buf` I've also tried to be slightly more careful about integer overflows, although in practice this is likely still not handled ideally. r? `@ChrisDenton`
2022-08-20Rollup merge of #100383 - fortanix:raoul/aepic_leak_mitigation, r=cuviperMatthias Krüger-23/+166
Mitigate stale data reads on SGX platform Intel disclosed the Stale Data Read vulnerability yesterday. In order to mitigate this issue completely, reading userspace from an SGX enclave must be aligned and in 8-bytes chunks. This PR implements this mitigation References: - https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00657.html - https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/stale-data-read-from-xapic.html cc: ``@jethrogb``
2022-08-20Use const instead of staticChris Denton-3/+3
2022-08-20Simplify load/storeChris Denton-6/+3
2022-08-19Align android `sigaddset` impl with the reference impl from BionicThom Chiovoloni-3/+23
2022-08-19use <[u8]>::escape_ascii instead of core::ascii::escape_defaultKaDiWa-14/+2
2022-08-19Fix comment typoThom Chiovoloni-1/+1
2022-08-18clarify lib.rs attribute structureRalf Jung-10/+13
2022-08-18silence some unused-fn warnings in miri std buildsRalf Jung-0/+2
2022-08-18make many std tests work in MiriRalf Jung-30/+47
2022-08-18add some Miri-only testsRalf Jung-0/+19
2022-08-18add miri-test-libstd support to libstdRalf Jung-0/+8
2022-08-18Avoid zeroing a 1kb stack buffer on every call to ↵Thom Chiovoloni-5/+13
`std::sys::windows::fill_utf16_buf`
2022-08-18Address reviewer commentsNick Cameron-55/+74
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-08-18Windows: Load synch functions togetherChris Denton-79/+94
Attempt to load all the required sync functions and fail if any one of them fails. This reintroduces a macro for optional loading of functions but keeps it separate from the fallback macro rather than having that do two different jobs.
2022-08-17Mitigate Stale Data Read for xAPIC vulnerabilityRaoul Strackx-7/+137
In order to mitigate the Stale Data Read for xAPIC vulnerability completely, reading userspace from an SGX enclave must be aligned and in 8-bytes chunks. References: - https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00657.html - https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/stale-data-read-from-xapic.html
2022-08-16Update fortanix-sgx-abi and export some useful SGX usercall traitsMohsen Zohrevandi-4/+31
Update fortanix-sgx-abi to 0.5.0 to add support for cancel queue (see https://github.com/fortanix/rust-sgx/pull/405 and https://github.com/fortanix/rust-sgx/pull/404). Export some useful traits for processing SGX usercall. This is needed for https://github.com/fortanix/rust-sgx/pull/404 to avoid duplication.
2022-08-16Simplify `IpDisplayBuffer` API.Markus Reiter-6/+10
2022-08-16Use `MaybeUninit<u8>` for `IpDisplayBuffer`.Markus Reiter-6/+14
2022-08-16Move `IpDisplayBuffer` into submodule.Markus Reiter-32/+36
2022-08-16Add `IpDisplayBuffer` helper struct.Markus Reiter-31/+48