about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2023-09-22Auto merge of #116054 - matthiaskrgr:rollup-3pusno6, r=matthiaskrgrbors-8/+87
Rollup of 7 pull requests Successful merges: - #114379 (Command: also print removed env vars) - #116034 (add UI test for delimiter errors) - #116036 (tests/ui: Split large_moves.rs and move to lint/large_assignments) - #116038 (Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity returns an empty mask) - #116039 (Account for nested `impl Trait` in TAIT) - #116041 (Add note to `is_known_rigid`) - #116049 (give FutureIncompatibilityReason variants more explicit names) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-22Rollup merge of #116038 - the8472:panic-on-sched_getaffinity-bug, r=cuviperMatthias Krüger-6/+19
Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity returns an empty mask Followup to #115946 A gentler fix for #115868, one that doesn't panic, [suggested on zulip](https://rust-lang.zulipchat.com/#narrow/stream/259402-t-libs.2Fmeetings/topic/Meeting.202023-09-19/near/391942927) In that situation - on the buggy kernel versions - a zero-mask means no affinities have been set so `_SC_NPROCESSORS_ONLN` provides the right value.
2023-09-22Rollup merge of #114379 - RalfJung:command-removed-env-vars, r=m-ou-seMatthias Krüger-2/+68
Command: also print removed env vars There is no real shell syntax for unsetting an env var so easily, so we have to make one up. But we already do that for showing the 'program' name so I hope that's okay here, too. No strong opinion on what that should look like, I went with `unset(VAR_NAME)` for now.
2023-09-22Auto merge of #114780 - RalfJung:io-safety, r=Amanieubors-29/+99
add more explicit I/O safety documentation Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/434 Cc https://github.com/rust-lang/rust/issues/114167 Cc `@Manishearth` `@sunfishcode` `@joshtriplett`
2023-09-21Auto merge of #115230 - Vtewari2311:mod-hurd-latest, r=b-naberbors-27/+511
added support for GNU/Hurd adding support for i686-unknown-hurd-gnu
2023-09-21Fall back to _SC_NPROCESSORS_ONLN if sched_getaffinity returns an empty maskThe 8472-6/+19
2023-09-21added support for GNU/HurdSamuel Thibault-27/+511
2023-09-21Auto merge of #116013 - matthiaskrgr:rollup-mv5i4fd, r=matthiaskrgrbors-21/+21
Rollup of 4 pull requests Successful merges: - #114394 (style-guide: Document formatting of `as` casts (mostly like a binary operator)) - #115990 (Allow anyone to set llvm-fixed-upstream) - #116008 (Rename BoxMeUp to PanicPayload.) - #116011 (Update browser-ui-test version to 0.16.10) r? `@ghost` `@rustbot` modify labels: rollup
2023-09-21Rollup merge of #116008 - m-ou-se:boxmeup, r=oli-obkMatthias Krüger-21/+21
Rename BoxMeUp to PanicPayload. "BoxMeUp" is not very clear. Let's rename that to a description of what it actually represents: a panic payload. This PR also renames the structs that implement this trait to have more descriptive names. Part of https://github.com/rust-lang/rust/issues/116005 r? `@oli-obk`
2023-09-20Auto merge of #115542 - saethlin:fileencoder-is-bufwriter, r=WaffleLapkinbors-0/+1
Simplify/Optimize FileEncoder FileEncoder is basically a BufWriter except that it exposes access to the not-written-to-yet region of the buffer so that some users can write directly to the buffer. This strategy is awesome because it lets us avoid calling memcpy for small copies, but the previous strategy was based on the writer accessing a `&mut [MaybeUninit<u8>; N]` and returning a `&[u8]` which is an API which currently mandates the use of unsafe code, making that interface in general not that appealing. So this PR cleans up the FileEncoder implementation and builds on that general idea of direct buffer access in order to prevent `memcpy` calls in a few key places when encoding the dep graph and rmeta tables. The interface used here is now 100% safe, but with the caveat that internally we need to avoid trusting the number of bytes that the provided function claims to have written. The original primary objective of this PR was to clean up the FileEncoder implementation so that the fix for the following issues would be easy to implement. The fix for these issues is to correctly update self.buffered even when writes fail, which I think it's easy to verify manually is now done, because all the FileEncoder methods are small. Fixes https://github.com/rust-lang/rust/issues/115298 Fixes https://github.com/rust-lang/rust/issues/114671 Fixes https://github.com/rust-lang/rust/issues/114045 Fixes https://github.com/rust-lang/rust/issues/108100 Fixes https://github.com/rust-lang/rust/issues/106787
2023-09-20PR feedbackBen Kimock-0/+1
2023-09-20Rename BoxMeUp to PanicPayload.Mara Bos-21/+21
2023-09-20Auto merge of #115753 - tgross35:threadinfo-refactor, r=thomccbors-16/+21
Refactor `thread_info` to remove the `RefCell` `thread_info` currently uses `RefCell`-based initialization. Refactor this to use `OnceCell` instead which is more performant and better suits the needs of one-time initialization. This is nobody's bottleneck but OnceCell checks are a single `cmp` vs. `RefCell<Option>` needing runtime logic
2023-09-19Auto merge of #115627 - compiler-errors:icedump-no-std, r=m-ou-sebors-32/+7
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-19Replace 'mutex' with 'lock' in RwLock documentationKriskras99-2/+2
When copying the documentation for `clear_poison` from Mutex, not every occurence of 'mutex' was replaced with 'lock'.
2023-09-19Rollup merge of #115946 - the8472:panic-on-sched_getaffinity-bug, ↵Guillaume Gomez-2/+4
r=Mark-Simulacrum panic when encountering an illegal cpumask in thread::available_parallelism Fixes #115868 by panicking instead of returning an invalid `NonZeroUsize`
2023-09-19Auto merge of #104101 - betrusted-io:xous-libstd-initial, r=bjorn3bors-4/+2473
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-18panic when encountering an illegal cpumaskThe 8472-2/+4
2023-09-18get rid of duplicate primitive_docsRalf Jung-1594/+1
2023-09-17Rollup merge of #115477 - kellerkindt:stabilized_int_impl, r=dtolnayDylan DPC-2/+1
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-17Rollup merge of #114965 - benschulz:mpsc-drop, r=dtolnayDylan DPC-15/+0
Remove Drop impl of mpsc Receiver and (Sync)Sender This change removes the empty `Drop` implementations for `mpsc::Receiver`, `mpsc::Sender` and `mpsc::SyncSender`. These implementations do not specify `#[may_dangle]`, so by removing them we make `mpsc` types play nice with drop check. This was previously attempted in [#105243](https://github.com/rust-lang/rust/pull/105243#issuecomment-1337188646) but then [abandoned due to a test failure](https://github.com/rust-lang/rust/pull/105243#issuecomment-1337227970). I've aligned the test with those for `Mutex` and `RwLock`.
2023-09-17Auto merge of #113753 - dvdsk:master, r=dtolnaybors-1/+81
Add implementation for thread::sleep_until - Feature gate is `thread::sleep_until` - Tracking issue is: #113752 - APC: https://github.com/rust-lang/libs-team/issues/237
2023-09-16Rollup merge of #115329 - xzmeng:fix-std-doc, r=dtolnayMatthias Krüger-4/+4
fix std::primitive doc: homogenous -> homogeneous replace "homogenous" with the more commonly used "homogeneous".
2023-09-16Rollup merge of #115247 - the8472:life-before-main, r=dtolnayMatthias Krüger-1/+25
Document std limitations before/after main Solves #110708
2023-09-13Disabled socketpair for VitaNikolay Arhipov-2/+2
2023-09-11Refactor `thread_info` to remove the `RefCell`Trevor Gross-16/+21
`thread_info` currently uses `RefCell`-based initialization. Refactor this to use `OnceCell` instead which is more performant and better suits the needs of one-time initialization.
2023-09-10Auto merge of #114967 - japaric:ja-gh114966, r=Mark-Simulacrumbors-0/+4
QNX: pass a truncated thread name to the OS The maximum length the thread name can have is `_NTO_THREAD_NAME_MAX` fixes #114966
2023-09-09Auto merge of #114590 - ijackson:stdio-stdio-2, r=dtolnaybors-11/+134
Allow redirecting subprocess stdout to our stderr etc. (redux) This is the code from #88561, tidied up, including review suggestions, and with the for-testing-only CI commit removed. FCP for the API completed in #88561. I have made a new MR to facilitate review. The discussion there is very cluttered and the branch is full of changes (in many cases as a result of changes to other Rust stdlib APIs since then). Assuming this MR is approvedl we should close that one. ### Reviewer doing a de novo review Just code review these four commits.. FCP discussion starts here: https://github.com/rust-lang/rust/pull/88561#issuecomment-1640527595 Portability tests: you can see that this branch works on Windows too by looking at the CI results in #88561, which has the same code changes as this branch but with an additional "DO NOT MERGE" commit to make the Windows tests run. ### Reviewer doing an incremental review from some version of #88561 Review the new commits since your last review. I haven't force pushed the branch there. git diff the two branches (eg `git diff 176886197d6..0842b69c219`). You'll see that the only difference is in gitlab CI files. You can also see that *this* MR doesn't touch those files.
2023-09-09std::process (unsupported): Implement From<io::Stdout> etc. for imp::StdioIan Jackson-0/+20
This implementation is wrong. Like the impl for From<File>, it is forced to panic because process::Stdio in unsupported/process.rs doesn't have a suitable variant. The root cause of the problem is that process::Stdio in unsupported/process.rs has any information in it at all. I'm pretty sure that it should just be a unit struct. However, making that build on all platforms is going to be a lot of work, iterating through CI and/or wrestling Docker. I don't think this extra panic is making things significantly worse. For now I have added some TODOs.
2023-09-07Don't modify libstd to dump rustc ICEsMichael Goulet-32/+7
2023-09-06fix typoRalf Jung-1/+1
Co-authored-by: Marcin S. <marcin@realemail.net>
2023-09-06Auto merge of #115453 - ibraheemdev:patch-16, r=joshtriplettbors-3/+1
Stabilize `io_error_other` feature Per the FCP for https://github.com/rust-lang/rust/issues/91946.
2023-09-04"what would rustfmt do"Tshepang Mbambo-71/+69
2023-09-04Auto merge of #115493 - Ayush1325:raw-os-error, r=workingjubileebors-4/+3
Move RawOsError defination to sys This was originally a part of https://github.com/rust-lang/rust/pull/105861, but I feel it should be its own PR since the raw os error is still unstable.
2023-09-03Rollup merge of #115512 - Fulgen301:startupinfow, r=ChrisDentonMatthias Krüger-1/+1
Command::spawn: Fix STARTUPINFOW.cb being initialized with the address of size_of Fixes #115511.
2023-09-03Rollup merge of #115489 - saethlin:is-interrupted, r=thomccMatthias Krüger-17/+18
Use std::io::Error::is_interrupted everywhere In https://github.com/rust-lang/rust/pull/115228 I introduced this helper and started using it, this PR uses it to replace all applicable uses of `std::io::Error::kind`. The justification is the same; for whatever reason LLVM totally flops optimizing `Error::kind` so it's nice to use it less. FYI ``@mkroening`` I swear the hermit changes look good, but I was so sure about the previous PR.
2023-09-03Command::spawn: Fix STARTUPINFOW.cb being initialized with the address of ↵Fulgen301-1/+1
size_of
2023-09-03Use std::io::Error::is_interrupted everywhereBen Kimock-17/+18
2023-09-03Move RawOsError defination to sysAyush Singh-4/+3
Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
2023-09-03Stabilize the Saturating type (saturating_int_impl, gh-87920)Michael Watzko-2/+1
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-09-02Rollup merge of #115443 - epage:os_str, r=cuviperMatthias Krüger-90/+86
feat(std): Stabilize 'os_str_bytes' feature Closes #111544
2023-09-02Rollup merge of #115427 - solid-rs:patch/kmc-solid/is-interrupted, r=cuviperMatthias Krüger-8/+2
kmc-solid: Fix `is_interrupted` Follow-up to #115228. Fixes a build error in [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets. ``` error[E0603]: function `is_interrupted` is private --> library\std\src\sys\solid\mod.rs:77:12 | 77 | error::is_interrupted(code) | ^^^^^^^^^^^^^^ private function | note: the function `is_interrupted` is defined here --> library\std\src\sys\solid\error.rs:35:1 | 35 | fn is_interrupted(er: abi::ER) -> bool { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
2023-09-01don't panic in BorrowedCursor::writeZachary S-2/+3
2023-09-01fix(std): Rename os_str_bytes to encoded_bytesEd Page-82/+82
2023-09-01stabilize `io_error_other` featureIbraheem Ahmed-3/+1
2023-09-01feat(std): Stabilize 'os_str_bytes' featureEd Page-8/+4
Closes #111544
2023-09-01Auto merge of #114448 - SteveLauC:std_fs_read_doc, r=Mark-Simulacrumbors-5/+7
docs: improve std::fs::read doc #### What does this PR do 1. Rephrase a confusing sentence in the document of `std::fs::read()` ----- Closes #114432 cc `@Dexus0` `@saethlin`
2023-09-01kmc-solid: Refactor `is_interrupted` to avoid integer overflowTomoaki Kawada-2/+1
2023-09-01docs: improve std::fs::read docSteve Lau-5/+7
2023-09-01kmc-solid: Directly delegate to `net::is_interrupted` in ↵Tomoaki Kawada-6/+1
`std::sys::solid::is_interrupted`