about summary refs log tree commit diff
path: root/src/libstd/sys/cloudabi
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-4907/+0
2020-07-12adjust remaining targetsRalf Jung-2/+2
2020-06-10Migrate to numeric associated constsLzu Tao-1/+1
2020-06-03Bump to 1.46Mark Rousskov-4/+1
2020-05-17abort_internal is safeRalf Jung-2/+5
2020-04-26Fix stragglersSteven Fackler-3/+3
2020-04-26Update nameSteven Fackler-3/+3
2020-04-26Add Read/Write::can_read/write_vectoredSteven Fackler-0/+24
When working with an arbitrary reader or writer, code that uses vectored operations may end up being slower than code that copies into a single buffer when the underlying reader or writer doesn't actually support vectored operations. These new methods allow you to ask the reader or witer up front if vectored operations are efficiently supported. Currently, you have to use some heuristics to guess by e.g. checking if the read or write only accessed the first buffer. Hyper is one concrete example of a library that has to do this dynamically: https://github.com/hyperium/hyper/blob/0eaf304644a396895a4ce1f0146e596640bb666a/src/proto/h1/io.rs#L582-L594
2020-04-03Delete unnecessary stub stack overflow handler for cloudabi.Vytautas Astrauskas-13/+1
2020-04-01In Thread::new, add a comment that a panic could cause a memory leak.Vytautas Astrauskas-1/+4
2020-03-31Use Box::into_raw instead of ManuallyDrop in Thread::new.Vytautas Astrauskas-9/+4
2020-03-31Inline start_thread into its callers.Vytautas Astrauskas-2/+6
2020-03-31Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new.Vytautas Astrauskas-3/+10
2020-03-21Rollup merge of #69955 - alexcrichton:stderr-infallible, r=sfacklerDylan DPC-4/+4
Fix abort-on-eprintln during process shutdown This commit fixes an issue where if `eprintln!` is used in a TLS destructor it can accidentally cause the process to abort. TLS destructors are executed after `main` returns on the main thread, and at this point we've also deinitialized global `Lazy` values like those which store the `Stderr` and `Stdout` internals. This means that despite handling TLS not being accessible in `eprintln!`, we will fail due to not being able to call `stderr()`. This means that we'll double-panic quickly because panicking also attempt to write to stderr. The fix here is to reimplement the global stderr handle to avoid the need for destruction. This avoids the need for `Lazy` as well as the hidden panic inside of the `stderr` function. Overall this should improve the robustness of printing errors and/or panics in weird situations, since the `stderr` accessor should be infallible in more situations.
2020-03-20Fix abort-on-eprintln during process shutdownAlex Crichton-4/+4
This commit fixes an issue where if `eprintln!` is used in a TLS destructor it can accidentally cause the process to abort. TLS destructors are executed after `main` returns on the main thread, and at this point we've also deinitialized global `Lazy` values like those which store the `Stderr` and `Stdout` internals. This means that despite handling TLS not being accessible in `eprintln!`, we will fail due to not being able to call `stderr()`. This means that we'll double-panic quickly because panicking also attempt to write to stderr. The fix here is to reimplement the global stderr handle to avoid the need for destruction. This avoids the need for `Lazy` as well as the hidden panic inside of the `stderr` function. Overall this should improve the robustness of printing errors and/or panics in weird situations, since the `stderr` accessor should be infallible in more situations.
2020-02-23Implement `Copy` for `IoSlice`LeSeulArtichaut-0/+1
2020-01-24Remove unused ignore-license directivesTomasz Miąsko-4/+0
The tidy check was removed in rust-lang/rust#53617
2019-12-24Deprecate Error::description for realDavid Tolnay-0/+1
`description` has been documented as soft-deprecated since 1.27.0 (17 months ago). There is no longer any reason to call it or implement it. This commit: - adds #[rustc_deprecated(since = "1.41.0")] to Error::description; - moves description (and cause, which is also deprecated) below the source and backtrace methods in the Error trait; - reduces documentation of description and cause to take up much less vertical real estate in rustdocs, while preserving the example that shows how to render errors without needing to call description; - removes the description function of all *currently unstable* Error impls in the standard library; - marks #[allow(deprecated)] the description function of all *stable* Error impls in the standard library; - replaces miscellaneous uses of description in example code and the compiler.
2019-12-22Format the worldMark Rousskov-1053/+1116
2019-11-29Format libstd/sys with rustfmtDavid Tolnay-44/+17
This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd/sys *that are not involved in any currently open PR* to minimize merge conflicts. THe list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in outstanding_files, the relevant commands were: $ find src/libstd/sys -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd/sys outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of the files. To confirm no funny business: $ git checkout $THIS_COMMIT^ $ git show --pretty= --name-only $THIS_COMMIT \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ git diff $THIS_COMMIT # there should be no difference
2019-09-05std: Improve downstream codegen in `Command::env`Alex Crichton-3/+5
This commit rejiggers the generics used in the implementation of `Command::env` with the purpose of reducing the amount of codegen that needs to happen in consumer crates, instead preferring to generate code into libstd. This was found when profiling the compile times of the `cc` crate where the binary rlib produced had a lot of `BTreeMap` code compiled into it but the crate doesn't actually use `BTreeMap`. It turns out that `Command::env` is generic enough to codegen the entire implementation in calling crates, but in this case there's no performance concern so it's fine to compile the code into the standard library. This change is done by removing the generic on the `CommandEnv` map which is intended to handle case-insensitive variables on Windows. Instead now a generic isn't used but rather a `use` statement defined per-platform is used. With this commit a debug build of `Command::new("foo").env("a", "b")` drops from 21k lines of LLVM IR to 10k.
2019-08-15Remove uses of `mem::uninitialized()` from cloudabiLzu Tao-14/+18
2019-08-14Handle cfg(bootstrap) throughoutMark Rousskov-1/+1
2019-08-03Add {IoSlice, IoSliceMut}::advanceThomas de Zeeuw-0/+14
2019-07-23Use raw pointers in std::sys::cloudabi when passing MaybeUninit valuesNathan-6/+6
2019-07-23Cleanup std::sys::cloudabiNathan-19/+19
2019-07-23Modify CloudABI ReentrantMutex to use MaybeUninitNathan-14/+18
Remove uses of mem::uninitialized, which is now deprecated
2019-07-22Remove uses of mem::uninitialized in std::sys::cloudabiNathan-16/+30
Usages still appear in cloudabi tests and in the reentrant mutex implementation
2019-07-19warn about deprecated-in-future in most of libstdRalf Jung-1/+1
2019-07-04Permit use of mem::uninitialized via allow(deprecated)Mark Rousskov-0/+2
2019-05-25std: Depend on `backtrace` crate from crates.ioAlex Crichton-118/+0
This commit removes all in-tree support for generating backtraces in favor of depending on the `backtrace` crate on crates.io. This resolves a very longstanding piece of duplication where the standard library has long contained the ability to generate a backtrace on panics, but the code was later extracted and duplicated on crates.io with the `backtrace` crate. Since that fork each implementation has seen various improvements one way or another, but typically `backtrace`-the-crate has lagged behind libstd in one way or another. The goal here is to remove this duplication of a fairly critical piece of code and ensure that there's only one source of truth for generating backtraces between the standard library and the crate on crates.io. Recently I've been working to bring the `backtrace` crate on crates.io up to speed with the support in the standard library which includes: * Support for `StackWalkEx` on MSVC to recover inline frames with debuginfo. * Using `libbacktrace` by default on MinGW targets. * Supporting `libbacktrace` on OSX as an option. * Ensuring all the requisite support in `backtrace`-the-crate compiles with `#![no_std]`. * Updating the `libbacktrace` implementation in `backtrace`-the-crate to initialize the global state with the correct filename where necessary. After reviewing the code in libstd the `backtrace` crate should be at exact feature parity with libstd today. The backtraces generated should have the same symbols and same number of frames in general, and there's not known divergence from libstd currently. Note that one major difference between libstd's backtrace support and the `backtrace` crate is that on OSX the crates.io crate enables the `coresymbolication` feature by default. This feature, however, uses private internal APIs that aren't published for OSX. While they provide more accurate backtraces this isn't appropriate for libstd distributed as a binary, so libstd's dependency on the `backtrace` crate explicitly disables this feature and forces OSX to use `libbacktrace` as a symbolication strategy. The long-term goal of this refactoring is to eventually move us towards a world where we can drop `libbacktrace` entirely and simply use Gimli and the surrounding crates for backtrace support. That's still aways off but hopefully will much more easily enabled by having the source of truth for backtraces live in crates.io! Procedurally if we go forward with this I'd like to transfer the `backtrace-rs` crate to the rust-lang GitHub organization as well, but I figured I'd hold off on that until we get closer to merging.
2019-04-27Stabilized vectored IOSteven Fackler-17/+17
This renames `std::io::IoVec` to `std::io::IoSlice` and `std::io::IoVecMut` to `std::io::IoSliceMut`, and stabilizes `std::io::IoSlice`, `std::io::IoSliceMut`, `std::io::Read::read_vectored`, and `std::io::Write::write_vectored`. Closes #58452
2019-04-14Rollup merge of #59852 - alexcrichton:more-vectored, r=sfacklerMazdak Farrokhzad-2/+18
std: Add `{read,write}_vectored` for more types This commit implements the `{read,write}_vectored` methods on more types in the standard library, namely: * `std::fs::File` * `std::process::ChildStd{in,out,err}` * `std::io::Std{in,out,err}` * `std::io::Std{in,out,err}Lock` * `std::io::Std{in,out,err}Raw` Where supported the OS implementations hook up to native support, otherwise it falls back to the already-defaulted implementation.
2019-04-10std: Add `{read,write}_vectored` for more typesAlex Crichton-2/+18
This commit implements the `{read,write}_vectored` methods on more types in the standard library, namely: * `std::fs::File` * `std::process::ChildStd{in,out,err}` * `std::io::Std{in,out,err}` * `std::io::Std{in,out,err}Lock` * `std::io::Std{in,out,err}Raw` Where supported the OS implementations hook up to native support, otherwise it falls back to the already-defaulted implementation.
2019-04-10Eliminate `FnBox` usages from libstd.CrLF0710-2/+1
2019-03-31libstd: deny(elided_lifetimes_in_paths), fixes in cloudabiMazdak Farrokhzad-3/+4
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-13/+13
2019-03-26Rollup merge of #59374 - faern:simplify-checked-duration-since, r=shepmasterMazdak Farrokhzad-5/+3
Simplify checked_duration_since This follows the same design as we updated to in #56490. Internally, all the system specific time implementations are checked, no panics. Then the panicking publicly exported API can just call the checked version of itself and make do with a single panic (`expect`) at the top. Since the internal sys implementations are now checked, this gets rid of the extra `if self >= &earlier` check in `checked_duration_since`. Except likely making the generated machine code simpler, it also reduces the algorithm from "Check panic condition -> call possibly panicking method" to just "call non panicking method". Added two test cases: * Edge case: Make sure `checked_duration_since` on two equal `Instant`s produce a zero duration, not a `None`. * Most common/intended usage: Make sure `later.checked_duration_since(earlier)`, returns an expected value.
2019-03-22Update sys::time impls to have checked_sub_instantLinus Färnstrand-5/+3
2019-03-22Auto merge of #59370 - Centril:rollup, r=Centrilbors-0/+4
Rollup of 18 pull requests Successful merges: - #59106 (Add peer_addr function to UdpSocket) - #59170 (Add const generics to rustdoc) - #59172 (Update and clean up several parts of CONTRIBUTING.md) - #59190 (consistent naming for Rhs type parameter in libcore/ops) - #59236 (Rename miri component to miri-preview) - #59266 (Do not complain about non-existing fields after parse recovery) - #59273 (some small HIR doc improvements) - #59291 (Make Option<ThreadId> no larger than ThreadId, with NonZeroU64) - #59297 (convert field/method confusion help to suggestions) - #59304 (Move some bench tests back from libtest) - #59309 (Add messages for different verbosity levels. Output copy actions.) - #59321 (Unify E0109, E0110 and E0111) - #59322 (Tweak incorrect escaped char diagnostic) - #59323 (use suggestions for "enum instead of variant" error) - #59327 (Add NAN test to docs) - #59329 (cleanup: Remove compile-fail-fulldeps directory again) - #59347 (Move one test from run-make-fulldeps to ui) - #59360 (Add tracking issue number for `seek_convenience`) Failed merges: r? @ghost
2019-03-22Auto merge of #58953 - jethrogb:jb/unify-ffi, r=alexcrichtonbors-2/+2
Unify OsString/OsStr for byte-based implementations As requested in #57860 r? @joshtriplett
2019-03-21Unify OsString/OsStr for byte-based implementationsJethro Beekman-2/+2
2019-03-16Add peer_addr function to UdpSocketLinus Unnebäck-0/+4
2019-03-09Use lifetime contravariance to elide more lifetimes in core+alloc+stdScott McMurray-2/+2
2019-02-28Fix #[macro_use] extern crate in sys/cloudabiTaiki Endo-2/+1
2019-02-28libstd => 2018Taiki Endo-173/+175
2019-02-26Auto merge of #58357 - sfackler:vectored-io, r=alexcrichtonbors-19/+59
Add vectored read and write support This functionality has lived for a while in the tokio ecosystem, where it can improve performance by minimizing copies. r? @alexcrichton
2019-02-24Fix cloudabiSteven Fackler-1/+9
2019-02-20Use standard Read/Write traits in sys::stdioPaul Dicker-5/+11
2019-02-20Remove sys::*::Stderr Write implementationPaul Dicker-13/+0