summary refs log tree commit diff
path: root/library/std/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2024-01-02Fix fallout of making c_str_literals unstable againWesley Wiser-1/+1
2023-12-15Stabilize `ptr::{from_ref, from_mut}`Maybe Waffle-1/+0
2023-12-03library: use c string literalsklensy-0/+1
2023-12-03Auto merge of #118487 - RalfJung:exposed-provenance, r=thomccbors-0/+1
move exposed-provenance APIs into separate feature gate We have already stated explicitly for all the 'exposed' functions that > Using this method means that code is *not* following strict provenance rules. However, they were part of the same feature gate and still described as part of the strict provenance experiment. Unfortunately, their semantics are much less clear and certainly nowhere near stabilization, so in preparation for an attempt to stabilize the strict provenance APIs, I suggest we split the things related to "exposed" into their own feature gate. I also used this opportunity to better explain how Exposed Provenance fits into the larger plan here: this is *one possible candidate* for `as` semantics, but we don't know if it is actually viable, so we can't really promise that it is equivalent to `as`. If it works out we probably want to make `as` equivalent to the 'exposed' APIs; if it doesn't, we will remove them again and try to find some other semantics for `as`.
2023-12-02Auto merge of #118484 - blyxxyz:os-str-slice, r=BurntSushibors-0/+1
Add substring API for `OsStr` This adds a method for taking a substring of an `OsStr`, which in combination with [`OsStr::as_encoded_bytes()`](https://doc.rust-lang.org/std/ffi/struct.OsStr.html#method.as_encoded_bytes) makes it possible to implement most string operations in safe code. API: ```rust impl OsStr { pub fn slice_encoded_bytes<R: ops::RangeBounds<usize>>(&self, range: R) -> &Self; } ``` Motivation, examples and research at https://github.com/rust-lang/libs-team/issues/306. Tracking issue: #118485 cc `@epage` r? libs-api
2023-12-02Auto merge of #118077 - calebzulawski:sync-portable-simd-2023-11-19, ↵bors-1/+2
r=workingjubilee Portable SIMD subtree update Syncs nightly to the latest changes from rust-lang/portable-simd r? `@rust-lang/libs`
2023-12-02Add substring API for `OsStr`Jan Verbeek-0/+1
2023-11-30move exposed-provenance APIs into separate feature gate and explain the ↵Ralf Jung-0/+1
relationship of Exposed Provenance and Strict Provenance
2023-11-29Rollup merge of #116839 - joboet:xous_thread_parking, r=m-ou-seMatthias Krüger-0/+1
Implement thread parking for xous This follows the pattern set by [the Windows parker](https://github.com/rust-lang/rust/blob/ddef56d5dfa18f169af9db912dc8e8343797eebb/library/std/src/sys/windows/thread_parking.rs) when it uses keyed events. An atomic variable is used to track the state and optimize the fast path, while notifications are send via the ticktime server to block and unblock the thread. ping `@xobs` `@rustbot` label +T-libs +A-atomic r? libs
2023-11-26Use inner docs to fix linksCaleb Zulawski-1/+2
2023-11-15Bump cfg(bootstrap)sMark Rousskov-1/+1
2023-11-11Auto merge of #115694 - clarfonthey:std-hash-private, r=dtolnaybors-3/+2
Add `std::hash::{DefaultHasher, RandomState}` exports (needs FCP) This implements rust-lang/libs-team#267 to move the libstd hasher types to `std::hash` where they belong, instead of `std::collections::hash_map`. <details><summary>The below no longer applies, but is kept for clarity.</summary> This is a small refactor for #27242, which moves the definitions of `RandomState` and `DefaultHasher` into `std::hash`, but in a way that won't be noticed in the public API. I've opened rust-lang/libs-team#267 as a formal ACP to move these directly into the root of `std::hash`, but for now, they're at least separated out from the collections code in a way that will make moving that around easier. I decided to simply copy the rustdoc for `std::hash` from `core::hash` since I think it would be ideal for the two to diverge longer-term, especially if the ACP is accepted. However, I would be willing to factor them out into a common markdown document if that's preferred. </details>
2023-11-09Move `BorrowedBuf` and `BorrowedCursor` from `std:io` to `core::io`John Millikin-0/+1
Assigned new feature name `core_io_borrowed_buf` to distinguish from the `Read::read_buf` functionality in `std::io`.
2023-11-02Move RandomState and DefaultHasher into std::hash, but don't export for nowltdk-3/+2
2023-10-25Stabilize `[const_]pointer_byte_offsets`Maybe Waffle-1/+0
2023-10-18std: implement thread parking for xousjoboet-0/+1
2023-10-08rustdoc: remove rust logo from non-Rust cratesMichael Howell-0/+1
2023-10-04Disable CFI for core and std CFI violationsRamon de C Valle-0/+2
Works around #115199 by temporarily disabling CFI for core and std CFI violations to allow the user rebuild and use both core and std with CFI enabled using the Cargo build-std feature.
2023-10-02Stdio for UEFIAyush Singh-1/+1
- Uses Simple Text Output Protocol and Simple Text Input Protocol - Reading is done one character at a time - Writing is done with max 4096 characters Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2023-09-23Add the `cfg_match!` macroCaio-0/+3
2023-09-19Auto merge of #115627 - compiler-errors:icedump-no-std, r=m-ou-sebors-3/+0
Don't modify libstd to dump rustc ICEs Do a much simpler thing and just dump a `std::backtrace::Backtrace` to file. r? `@estebank` `@oli-obk` Fixes #115610
2023-09-19Auto merge of #104101 - betrusted-io:xous-libstd-initial, r=bjorn3bors-0/+1
Add initial libstd support for Xous This patchset adds some minimal support to the tier-3 target `riscv32imac-unknown-xous-elf`. The following features are supported: * alloc * thread creation and joining * thread sleeping * thread_local * panic_abort * mutex * condvar * stdout Additionally, internal support for the various Xous primitives surrounding IPC have been added as part of the Xous FFI. These may be exposed as part of `std::os::xous::ffi` in the future, however for now they are not public. This represents the minimum viable product. A future patchset will add support for networking and filesystem support.
2023-09-18get rid of duplicate primitive_docsRalf Jung-1/+1
2023-09-17Rollup merge of #115477 - kellerkindt:stabilized_int_impl, r=dtolnayDylan DPC-1/+0
Stabilize the `Saturating` type Closes #87920 Closes #92354 Stabilization report https://github.com/rust-lang/rust/issues/87920#issuecomment-1652346124 FCP https://github.com/rust-lang/rust/issues/87920#issuecomment-1676438885
2023-09-07Don't modify libstd to dump rustc ICEsMichael Goulet-3/+0
2023-09-03Stabilize the Saturating type (saturating_int_impl, gh-87920)Michael Watzko-1/+0
Also stabilizes saturating_int_assign_impl, gh-92354. And also make pub fns const where the underlying saturating_* fns became const in the meantime since the Saturating type was created.
2023-08-26Document std limitations before/after mainThe 8472-1/+25
2023-08-23Bump cfg(bootstrap)Mark Rousskov-2/+2
2023-08-22std: enable feature(slice_ptr_len) on xousSean Cross-0/+1
Xous passes slice pointers around in order to manipulate memory. This is feature-gated behind `slice_ptr_len`. Xous is currently the only target to use this feature, so gate it behind an OS flag. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-18resolve conflictsKyle Lin-0/+1
2023-08-15fix typo: affect -> effectRalf Jung-1/+1
2023-08-13core/any: remove Provider traitwayne warren-1/+0
* remove `impl Provider for Error` * rename `Demand` to `Request` * update docstrings to focus on the conceptual API provided by `Request` * move `core::any::{request_ref, request_value}` functions into `core::error` * move `core::any::tag`, `core::any::Request`, an `core::any::TaggedOption` into `core::error` * replace `provide_any` feature name w/ `error_generic_member_access` * move `core::error::request_{ref,value} tests into core::tests::error module * update unit and doc tests
2023-08-12Remove unnecessary feature gatesJacob Pratt-1/+0
2023-08-11Auto merge of #113432 - klensy:ms-cut-backtrace, r=ChrisDentonbors-1/+7
reduce deps for windows-msvc targets for backtrace (eventually) mirrors https://github.com/rust-lang/backtrace-rs/pull/543 Some dependencies of backtrace don't used on windows-msvc targets, so exclude them: miniz_oxide (+ adler) addr2line (+ gimli) object (+ memchr) This saves about 30kb of std.dll + 17.5mb of rlibs
2023-08-09Auto merge of #99747 - ankane:float_gamma, r=workingjubileebors-0/+1
Add gamma function to f32 and f64 Adds the [gamma function](https://en.wikipedia.org/wiki/Gamma_function) to `f32` and `f64` (`tgamma` and `tgammaf` from C). Refs: - https://github.com/rust-lang/rfcs/issues/864 - https://github.com/rust-lang/rust/issues/18271
2023-08-05use offset_of! to calculate dirent64 field offsetsThe 8472-0/+1
2023-08-03Add `internal_features` lintNilstrieb-0/+1
It lints against features that are inteded to be internal to the compiler and standard library. Implements MCP #596. We allow `internal_features` in the standard library and compiler as those use many features and this _is_ the standard library from the "internal to the compiler and standard library" after all. Marking some features as internal wasn't exactly the most scientific approach, I just marked some mostly obvious features. While there is a categorization in the macro, it's not very well upheld (should probably be fixed in another PR). We always pass `-Ainternal_features` in the testsuite About 400 UI tests and several other tests use internal features. Instead of throwing the attribute on each one, just always allow them. There's nothing wrong with testing internal features^^
2023-07-31Add gamma and ln_gamma functions to f32 and f64Andrew Kane-0/+1
2023-07-30Rollup merge of #109075 - joboet:lazylock_backtrace, r=workingjubileeJubilee-0/+1
Use `LazyLock` to lazily resolve backtraces By using TAIT to name the initializing closure, `LazyLock` can be used to replace the current `LazilyResolvedCapture`.
2023-07-28reduce deps for windows-msvc targets for backtraceklensy-1/+7
2023-07-24remove additional [allow(unused_unsafe)]James Dietz-1/+1
2023-07-19On nightly, dump ICE backtraces to diskEsteban Küber-0/+3
Implement rust-lang/compiler-team#578. When an ICE is encountered on nightly releases, the new rustc panic handler will also write the contents of the backtrace to disk. If any `delay_span_bug`s are encountered, their backtrace is also added to the file. The platform and rustc version will also be collected.
2023-07-09move personality to sysGus Caplan-1/+0
2023-07-05Revert "use c literals in library"León Orell Valerian Liehr-1/+0
This reverts commit f212ba6d6d60963c8101bb24fc3e53fca80c046f.
2023-06-11reorder attributes to make miri-test-libstd work againRalf Jung-6/+7
2023-05-31use c literals in libraryklensy-0/+1
2023-04-27std: use `LazyLock` to lazily resolve backtracesjoboet-0/+1
2023-04-25Revert "Report allocation errors as panics"Matthias Krüger-1/+0
This reverts commit c9a6e41026d7aa27d897fb83e995447719753076.
2023-04-25Revert "Remove #[alloc_error_handler] from the compiler and library"Matthias Krüger-0/+1
This reverts commit abc0660118cc95f47445fd33502a11dd448f5968.
2023-04-23Auto merge of #110655 - ChrisDenton:read-to-end, r=joshtriplettbors-0/+1
Limit read size in `File::read_to_end` loop Fixes #110650. Windows file reads have perf overhead that's proportional to the buffer size. When we have a reasonable expectation that we know the file size, we can set a reasonable upper bound for the size of the buffer in one read call.