summary refs log tree commit diff
path: root/library/std/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2023-09-21Don't modify libstd to dump rustc ICEsMichael Goulet-3/+0
(cherry picked from commit 8ad23794077b4380da05fc5dabb573f38bdb2718)
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.
2023-04-21Limit read size in `File::read_to_end` loopChris Denton-0/+1
This works around performance issues on Windows by limiting reads the size of reads when the expected size is known.
2023-04-16Remove #[alloc_error_handler] from the compiler and libraryAmanieu d'Antras-1/+0
2023-04-16Report allocation errors as panicsAmanieu d'Antras-0/+1
2023-04-14Rollup merge of #110292 - scottmcm:sort-features-2, r=jyn514Yuki Okushi-7/+19
Add `tidy-alphabetical` to features in `alloc` & `std` So that people have to keep them sorted in future, rather than just sticking them on the end where they conflict more often. Follow-up to #110269 cc `@jyn514`
2023-04-13Add `tidy-alphabetical` to features in `alloc` & `std`Scott McMurray-7/+19
So that people have to keep them sorted in future, rather than just sticking them on the end where they conflict more often.
2023-04-10Stabilize IsTerminalJosh Triplett-1/+0
closes: https://github.com/rust-lang/rust/issues/98070
2023-04-06Stabilize is_some_andJonas Platte-1/+0
2023-03-29Stabilize a portion of 'once_cell'Trevor Gross-1/+1
Move items not part of this stabilization to 'lazy_cell' or 'once_cell_try'
2023-03-27Rollup merge of #97506 - JohnTitor:stabilize-nonnull-slice-from-raw-parts, ↵Matthias Krüger-1/+0
r=m-ou-se,the8472 Stabilize `nonnull_slice_from_raw_parts` FCP is done: https://github.com/rust-lang/rust/issues/71941#issuecomment-1100910416 Note that this doesn't const-stabilize `NonNull::slice_from_raw_parts` as `slice_from_raw_parts_mut` isn't const-stabilized yet. Given #67456 and #57349, it's not likely available soon, meanwhile, stabilizing only the feature makes some sense, I think. Closes #71941
2023-03-13Rollup merge of #108419 - tgross35:atomic-as-ptr, r=m-ou-seMatthias Krüger-1/+0
Stabilize `atomic_as_ptr` Fixes #66893 This stabilizes the `as_ptr` methods for atomics. The stabilization feature gate used here is `atomic_as_ptr` which supersedes `atomic_mut_ptr` to match the change in https://github.com/rust-lang/rust/pull/107736. This needs FCP. New stable API: ```rust impl AtomicBool { pub const fn as_ptr(&self) -> *mut bool; } impl AtomicI32 { pub const fn as_ptr(&self) -> *mut i32; } // Includes all other atomic types impl<T> AtomicPtr<T> { pub const fn as_ptr(&self) -> *mut *mut T; } ``` r? libs-api ``@rustbot`` label +needs-fcp
2023-03-07Auto merge of #95317 - Jules-Bertholet:round_ties_to_even, ↵bors-0/+1
r=pnkfelix,m-ou-se,scottmcm Add `round_ties_even` to `f32` and `f64` Tracking issue: #96710 Redux of #82273. See also #55107 Adds a new method, `round_ties_even`, to `f32` and `f64`, that rounds the float to the nearest integer , rounding halfway cases to the number with an even least significant bit. Uses the `roundeven` LLVM intrinsic to do this. Of the five IEEE 754 rounding modes, this is the only one that doesn't already have a round-to-integer function exposed by Rust (others are `round`, `floor`, `ceil`, and `trunc`). Ties-to-even is also the rounding mode used for int-to-float and float-to-float `as` casts, as well as float arithmentic operations. So not having an explicit rounding method for it seems like an oversight. Bikeshed: this PR currently uses `round_ties_even` for the name of the method. But maybe `round_ties_to_even` is better, or `round_even`, or `round_to_even`?
2023-02-27Rollup merge of #107110 - strega-nil:mbtwc-wctmb, r=ChrisDentonMatthias Krüger-0/+1
[stdio][windows] Use MBTWC and WCTMB `MultiByteToWideChar` and `WideCharToMultiByte` are extremely well optimized, and therefore should probably be used when we know we can (specifically in the Windows stdio stuff). Fixes #107092
2023-02-26Move IpAddr and SocketAddr to coreLinus Färnstrand-0/+2
2023-02-25[stdio][windows] Use MBTWC and WCTMBNicole Mazzuca-0/+1
2023-02-23Stabilize atomic_as_ptrTrevor Gross-1/+0
2023-02-10Remove a couple of `#[doc(hidden)] pub fn` and their `#[feature]` gatesTobias Bucher-4/+0
2023-02-01Stabilize feature 'cstr_from_bytes_until_nul'Trevor Gross-1/+0
2023-01-25Stabilize the const_socketaddr featureLinus Färnstrand-1/+0
2023-01-17refactor[std]: do not use box syntaxjoboet-1/+0
2023-01-08Auto merge of #104658 - thomcc:rand-update-and-usable-no_std, r=Mark-Simulacrumbors-0/+27
Update `rand` in the stdlib tests, and remove the `getrandom` feature from it. The main goal is actually removing `getrandom`, so that eventually we can allow running the stdlib test suite on tier3 targets which don't have `getrandom` support. Currently those targets can only run the subset of stdlib tests that exist in uitests, and (generally speaking), we prefer not to test libstd functionality in uitests, which came up recently in https://github.com/rust-lang/rust/pull/104095 and https://github.com/rust-lang/rust/pull/104185. Additionally, the fact that we can't update `rand`/`getrandom` means we're stuck with the old set of tier3 targets, so can't test new ones. ~~Anyway, I haven't checked that this actually does allow use on tier3 targets (I think it does not, as some work is needed in stdlib submodules) but it moves us slightly closer to this, and seems to allow at least finally updating our `rand` dep, which definitely improves the status quo.~~ Checked and works now. For the most part, our tests and benchmarks are fine using hard-coded seeds. A couple tests seem to fail with this (stuff manipulating the environment expecting no collisions, for example), or become pointless (all inputs to a function become equivalent). In these cases I've done a (gross) dance (ab)using `RandomState` and `Location::caller()` for some extra "entropy". Trying to share that code seems *way* more painful than it's worth given that the duplication is a 7-line function, even if the lines are quite gross. (Keeping in mind that sharing it would require adding `rand` as a non-dev dep to std, and exposing a type from it publicly, all of which sounds truly awful, even if done behind a perma-unstable feature). See also some previous attempts: - https://github.com/rust-lang/rust/pull/86963 (in particular https://github.com/rust-lang/rust/pull/86963#issuecomment-885438936 which explains why this is non-trivial) - https://github.com/rust-lang/rust/pull/89131 - https://github.com/rust-lang/rust/pull/96626#issuecomment-1114562857 (I tried in that PR at the same time, but settled for just removing the usage of `thread_rng()` from the benchmarks, since that was the main goal). - https://github.com/rust-lang/rust/pull/104185 - Probably more. It's very tempting of a thing to "just update". r? `@Mark-Simulacrum`
2023-01-04Update rand in the stdlib tests, and remove the getrandom feature from itThom Chiovoloni-0/+27
2023-01-04docs: fix broken link "search bar"Michael Howell-1/+1
2022-12-30Replace libstd, libcore, liballoc in line comments.jonathanCogan-4/+4
2022-12-11Remove some `cfg(not(bootstrap))`Jules Bertholet-1/+1
2022-12-11Add `round_ties_even` to `f32` and `f64`Jules Bertholet-0/+1
2022-11-22Rollup merge of #104647 - RalfJung:alloc-strict-provenance, r=thomccManish Goregaokar-1/+2
enable fuzzy_provenance_casts lint in liballoc and libstd r? ````@thomcc````
2022-11-20enable fuzzy_provenance_casts lint in libstdRalf Jung-1/+2
2022-11-20Add get_many_mut methods to sliceMarvin Löbel-0/+1