about summary refs log tree commit diff
path: root/library/std/src
AgeCommit message (Collapse)AuthorLines
2023-08-24Rollup merge of #115124 - ↵Weihang Lo-1/+1
solid-rs:patch/kmc-solid/import-poison-error-in-os, r=cuviper kmc-solid: Import `std::sync::PoisonError` in `std::sys::solid::os` Follow-up to #114968. Fixes a missing import in [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets. ``` error[E0433]: failed to resolve: use of undeclared type `PoisonError` C:\Users\xxxxx\.rustup\toolchains\nightly-2023-08-23-x86_64-pc-windows-gnu\lib\rustlib\src\rust\library\std\src\sys\solid\os.rs(85,36) | 85 | ENV_LOCK.read().unwrap_or_else(PoisonError::into_inner) | ^^^^^^^^^^^ use of undeclared type `PoisonError` | ```
2023-08-24Auto merge of #115094 - Mark-Simulacrum:bootstrap-update, r=ozkanonurbors-21/+21
Update bootstrap compiler to 1.73.0 beta
2023-08-24also use 'env' for printing unsettingRalf Jung-8/+4
2023-08-24also print clearing the environment entirelyRalf Jung-12/+44
2023-08-24fix a typo in env_clear docsRalf Jung-1/+1
2023-08-24make unsetting env vars print as executable commandRalf Jung-4/+19
2023-08-24Command: also print removed env varsRalf Jung-1/+24
2023-08-23Bump cfg(bootstrap)Mark Rousskov-2/+2
2023-08-23Rollup merge of #114696 - g0djan:godjan/fix_114610, r=Mark-SimulacrumGuillaume Gomez-0/+8
Fix a pthread_t handle leak #114610 https://github.com/rust-lang/rust/issues/114610 Ran the tests as described in https://github.com/rust-lang/rust/blob/master/src/doc/rustc/src/platform-support/wasm32-wasi-preview1-threads.md?plain=1#L125
2023-08-23Rollup merge of #115053 - waywardmonkeys:augment-type-keyword-docs, r=cuviperDylan DPC-1/+9
docs: Add example, reference link for `type` keyword. Fixes #114281.
2023-08-23kmc-solid: Import `std::sync::PoisonError` in `std::sys::solid::os`Tomoaki Kawada-1/+1
2023-08-22std: unix process_unsupported: Provide a wait status emulation (tidy)Ian Jackson-36/+39
Move tests into a module as demanded by tidy.
2023-08-22fixup! std: unix process: Test exit statuses / wait statusesIan Jackson-1/+1
2023-08-22std: unix process_unsupported: Provide a wait status emulation (fmt)Ian Jackson-15/+3
Worsify formatting as required by rustfmt.
2023-08-22fixup! std: unix process_unsupported: Provide a wait status emulationIan Jackson-1/+1
2023-08-22std: unix process: Test exit statuses / wait statusesIan Jackson-0/+33
This is a pretty basic test but should spot any other platforms which are `#[cfg(unix)]` but not Unix and where the wait status representation is wrong. (And any actual Unix platforms where it's not as expected, but I don't think they exist.)
2023-08-22std: unix process_unsupported: Provide a wait status emulationIan Jackson-50/+120
Fixes #114593 Needs FCP due to behavioural changes.
2023-08-22Improve UdpSocket documentationPatiga-1/+20
I tried working with `UdpSocket` and ran into `EINVAL` errors with no clear indication of what causes the error. Also, it was uncharacteristically hard to figure this module out, compared to other Rust `std` modules. 1. `send` and `send_to` return a `usize` This one is just clarity. Usually, returned `usize`s indicate that the buffer might have only been sent partially. This is not the case with UDP. Since that `usize` must always be `buffer.len()`, I have documented that. 2. `bind` limits `connect` and `send_to` When you bind to a limited address space like localhost, you can only `connect` to addresses in that same address space. Error kind: `AddrNotAvailable`. 3. `connect`ing to localhost locks you to localhost On Linux, if you first `connect` to localhost, subsequent `connect`s to non-localhost addresses fail. Error kind: `InvalidInput`. Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
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-22std: xous: add support for locksSean Cross-1/+310
Add support for Condvar, Mutex, and RWLock. These are all backed by the ticktimer server. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add thread_local_keySean Cross-1/+190
Add an implementation of thread local storage. This uses a container that is pointed to by the otherwise-unsed `$tp` register. This container is allocated on-demand, so threads that use no TLS will not allocate this extra memory. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add thread supportSean Cross-1/+144
Add initial support for threads on Xous. This includes thread creation and joining. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add support for timeSean Cross-1/+57
Add support for determining the current time. This connects to the ticktimer server in order to get the system uptime. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add output support for stdioSean Cross-1/+131
Add support for stdout. This enables basic console printing via `println!()`. Output is written to the log server. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add services supportSean Cross-0/+264
Xous has a concept of `services` that provide various features. Processes may connect to these services by name or by address. Most services require a name server in order to connect. Add a file with the most common services, and provide a way to connect to a service by querying the name server. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add alloc supportSean Cross-1/+62
Basic alloc support on Xous is supported by the `dlmalloc` crate. This necessitates bumping the dlmalloc version to 0.2.4. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: process: skip tests on xousSean Cross-1/+1
Xous does not yet support spawning processes. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: fs: skip fs tests on xousSean Cross-1/+1
The xous filesystem support is not yet ready for merging. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: net: skip tests on xousSean Cross-2/+2
Network functionality is not yet ready for merging. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: the basics of `os`Sean Cross-1/+147
Add the basics to get the operating system running, including how to exit the operating system. Since Xous has no libc, there is no default entrypoint. Add a `_start` entrypoint to the system-specific os module. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22std: xous: add os-specific ffi callsSean Cross-0/+1122
Xous has no C FFI. Instead, all FFI is done via syscalls that are specified in Rust. Add these FFI calls to libstd, as well as some of the currently-supported syscalls. This enables Rust programs to interact with the Xous operating system while avoiding adding an extra dependency to libstd. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22Replace version placeholders with 1.73.0Mark Rousskov-19/+19
2023-08-22clarify what you cannot doRalf Jung-3/+3
2023-08-22typos and wordingRalf Jung-3/+3
Co-authored-by: Dan Gohman <dev@sunfishcode.online>
2023-08-22libstd: add xous to libstdSean Cross-0/+48
Add the `xous` target to libstd. Currently this defers everything to the `unsupported` target. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-21docs: add alias log1p to ln_1pMichael Howell-0/+2
This is what the function is called in several other languages: * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p * https://numpy.org/doc/stable/reference/generated/numpy.log1p.html * https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/log1p-log1pf-log1pl2?view=msvc-170 It also confused people at URLO: https://users.rust-lang.org/t/64-bit-trigonometry/98599/27
2023-08-21docs: Add example, reference link for `type` keyword.Bruce Mitchener-1/+9
Fixes #114281.
2023-08-20Rollup merge of #114968 - ShE3py:unix-getsetenv-ub, r=thomccMatthias Krüger-27/+47
Fix UB in `std::sys::os::getenv()` Fixes #114949. Reduced the loops to 1k iterations (100k was taking way too long), Miri no longer shows any UB. `@rustbot` label +A-process +C-bug +I-unsound +O-unix
2023-08-20Auto merge of #113167 - ChAoSUnItY:redundant_explicit_link, r=GuillaumeGomezbors-0/+1
rustdoc: Add lint `redundant_explicit_links` Closes #87799. - Lint warns by default - Reworks link parser to cache original link's display text r? `@jyn514`
2023-08-20Rollup merge of #114983 - crlf0710:formatmsg, r=ChrisDentonMatthias Krüger-6/+2
Usage zero as language id for `FormatMessageW()` This switches the language selection from using system language (note that this might be different than application language, typically stored as thread ui language) to use `FormatMessageW` default search strategy, which is `neutral` first, then `thread ui lang`, then `user language`, then `system language`, then `English`. (See https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-formatmessagew) This allows the Rust program to take more control of `std::io::Error`'s message field, by setting up thread ui language themselves before hand (which many programs already do).
2023-08-20Rollup merge of #114973 - shepmaster:std-provide-value, r=AmanieuMatthias Krüger-1/+1
Expose core::error::request_value in std I think this was simply forgotten in #113464. /cc ``@waynr`` r? ``@Amanieu``
2023-08-20Rollup merge of #114605 - Easyoakland:hash-collection-doc, r=thomccMatthias Krüger-5/+8
Increase clarity about Hash - Eq consistency in HashMap and HashSet docs As discussed [here](https://users.rust-lang.org/t/what-hapens-if-hash-and-partialeq-dont-match-when-using-hashmap/98052/13) the description of logic errors in `HashMap` and `HashSet` does not explicitly apply to ```text k1 == k2 -> hash(k1) == hash(k2) ``` but this is likely what is intended. This PR is a small doc change to correct this. r? rust-lang/libs
2023-08-19Correct and expand documentation of `handle_alloc_error` and ↵Kevin Reid-6/+20
`set_alloc_error_hook`. Add the following facts: * `handle_alloc_error` may panic instead of aborting. * What happens if a hook returns rather than diverging. * A hook may panic. (This was already demonstrated in an example, but not stated in prose.) * A hook must be sound to call — it cannot assume that it is only called by the runtime, since its function pointer can be retrieved by safe code.
2023-08-19Usage zero as language id for FormatMessageW()Charles Lew-6/+2
2023-08-19Rollup merge of #114977 - kpreid:modulo, r=thomccMatthias Krüger-0/+2
Add `modulo` and `mod` as doc aliases for `rem_euclid`. When I was learning Rust I looked for “a modulo function” and couldn’t find one, so thought I had to write my own; it wasn't at all obvious that a function with “rem” in the name was the function I wanted. Hopefully this will save the next learner from that. However, it does have the disadvantage that the top results in rustdoc for “mod” are now these aliases instead of the Rust keyword, which probably isn't ideal.
2023-08-19Rollup merge of #114971 - kpreid:trig, r=joshtriplettMatthias Krüger-0/+18
Add doc aliases for trigonometry and other f32,f64 methods. These are common alternate names, usually a less-abbreviated form, for the operation; e.g. `arctan` instead of `atan`. Prompted by <https://users.rust-lang.org/t/64-bit-trigonometry/98599>
2023-08-18Add `modulo` and `mod` as doc aliases for `rem_euclid`.Kevin Reid-0/+2
When I was learning Rust I looked for “a modulo function” and couldn’t find one, so thought I had to write my own; it wasn't at all obvious that a function with “rem” in the name was the function I wanted. Hopefully this will save the next learner from that. However, it does have the disadvantage that the top results in rustdoc for “mod” are now these aliases instead of the Rust keyword, which probably isn't ideal.
2023-08-18Auto merge of #114591 - joboet:thread_parking_ordering_fix, r=thomccbors-11/+6
Synchronize with all calls to `unpark` in id-based thread parker [The documentation for `thread::park`](https://doc.rust-lang.org/nightly/std/thread/fn.park.html#memory-ordering) guarantees that "park synchronizes-with all prior unpark operations". In the id-based thread parking implementation, this is not implemented correctly, as the state variable is reset with a simple store, so there will not be a *synchronizes-with* edge if an `unpark` happens just before the reset. This PR corrects this, replacing the load-check-reset sequence with a single `compare_exchange`.
2023-08-18Expose core::error::request_value in stdJake Goulding-1/+1
I think this was simply forgotten in #113464.
2023-08-18Add doc aliases for trigonometry and other f32,f64 methods.Kevin Reid-0/+18
These are common alternate names, usually a less-abbreviated form, for the operation; e.g. `arctan` instead of `atan`. Prompted by <https://users.rust-lang.org/t/64-bit-trigonometry/98599>