about summary refs log tree commit diff
path: root/src/libstd/sys/wasi
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-2945/+0
2020-07-23Rollup merge of #74141 - euclio:typos, r=steveklabnikManish Goregaokar-4/+4
libstd/libcore: fix various typos
2020-07-21Auto merge of #74075 - sunfishcode:wasi-prelude-rawfd, r=alexcrichtonbors-1/+1
Add `RawFd` to WASI's `std::os::wasi::prelude`. Add `RawFd` to WASI's `std::os::wasi::prelude`, making it consistent with all other platforms which also have `AsRawFd`, `FromRawFd`, and `IntoRawFd` in their respective preludes.
2020-07-15Introduce restricted-std feature.Eric Huss-34/+11
2020-07-14Rollup merge of #74263 - RalfJung:thread-local, r=Mark-SimulacrumManish Goregaokar-4/+4
Slight reorganization of sys/(fast_)thread_local I was long confused by the `thread_local` and `fast_thread_local` modules in the `sys(_common)` part of libstd. The names make it *sound* like `fast_thread_local` is just a faster version of `thread_local`, but really these are totally different APIs: one provides thread-local "keys", which are non-addressable pointer-sized pieces of local storage with an associated destructor; the other (the "fast" one) provides just a destructor. So I propose we rename `fast_thread_local` to `thread_local_dtor`, and `thread_local` to `thread_local_key`. That's what this PR does.
2020-07-12adjust remaining targetsRalf Jung-4/+4
2020-07-09libstd/libcore: fix various typosAndy Russell-4/+4
2020-07-07Make WASI's FileExt's read_at/write_at consistent with other targets.Dan Gohman-4/+43
Rename the existing read_at/write_at to read_vectored_at/write_vectored_at, for consistency with libstd's read_vectored/write_vectored. And, introduce new read_at/write_at functions which take a single buffer, similar to all other targets which provide these functions, so this will make it easier for applications to share code between WASI and other targets. Note that WASI's FileExt is currently unstable.
2020-07-07Add `read_exact_at` and `write_all_at` to WASI's `FileExt`Dan Gohman-0/+94
This adds `read_exact_at` and `write_all_at` to WASI's `FileExt`, similar to the Unix versions of the same names.
2020-07-05Add `RawFd` to WASI's `std::os::wasi::prelude`.Dan Gohman-1/+1
Add `RawFd` to WASI's `std::os::wasi::prelude`, making it consistent with all other platforms which also have `AsRawFd`, `FromRawFd`, and `IntoRawFd` in their respective preludes.
2020-06-24Rollup merge of #73638 - yuqio:remove-unused-crate-imports, r=nikomatsakisDylan DPC-1/+0
Remove unused crate imports in 2018 edition crates Closes #73570
2020-06-23Remove unused crate imports in 2018 edition cratesyuqio-1/+0
2020-06-19Converted all platform-specific stdin/stdout/stderr implementations to io traitsNathan West-34/+32
2020-06-10Migrate to numeric associated constsLzu Tao-2/+2
2020-05-17abort_internal is safeRalf Jung-2/+2
2020-04-27fix wasiSteven Fackler-2/+2
2020-04-26Update nameSteven Fackler-9/+9
2020-04-26Add Read/Write::can_read/write_vectoredSteven Fackler-0/+41
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-03-30std: Fix over-aligned allocations on wasm32-wasiAlex Crichton-1/+1
The wasm32-wasi target delegates its malloc implementation to the functions in wasi-libc, but the invocation of `aligned_alloc` was incorrect by passing the number of bytes requested first rather than the alignment. This commit swaps the order of these two arguments to ensure that we allocate over-aligned memory correctly.
2020-03-14Rollup merge of #69403 - LeSeulArtichaut:copy-ioslice, r=sfacklerYuki Okushi-0/+1
Implement `Copy` for `IoSlice` Resolves #69395 r? @sfackler
2020-02-23Implement `Copy` for `IoSlice`LeSeulArtichaut-0/+1
2020-02-23Auto merge of #69084 - yaahc:delayed-doc-lint, r=petrochenkovbors-8/+4
Split non macro portion of unused_doc_comment from macro part into two passes/lints ## Motivation This change is motivated by the needs of the [spandoc library](https://github.com/yaahc/spandoc). The specific use case is that my macro is removing doc comments when an attribute is applied to a fn with doc comments, but I would like the lint to still appear when I forget to add the `#[spandoc]` attribute to a fn, so I don't want to have to silence the lint globally. ## Approach This change splits the `unused _doc_comment` lint into two lints, `unused_macro_doc_comment` and `unused_doc_comment`. The non macro portion is moved into an `early_lint_pass` rather than a pre_expansion_pass. This allows proc macros to silence `unused_doc_comment` warnings by either adding an attribute to silence it or by removing the doc comment before the early_pass runs. The `unused_macro_doc_comment` lint however will still be impossible for proc-macros to silence, but the only alternative that I can see is to remove this lint entirely, which I don't think is acceptable / is a decision I'm not comfortable making personally, so instead I opted to split the macro portion of the check into a separate lint so that it can be silenced globally with an attribute if necessary without needing to globally silence the `unused_doc_comment` lint as well, which is still desireable. fixes https://github.com/rust-lang/rust/issues/67838
2020-02-22rustfmt darnitJane Lusby-6/+2
2020-02-22make doc comments regular commentsJane Lusby-2/+2
2020-02-12Fix std::fs::copy on WASI targetIngvar Stepanyan-1/+9
Previously `std::fs::copy` on wasm32-wasi would reuse code from the `sys_common` module and would successfully copy contents of the file just to fail right before closing it. This was happening because `sys_common::copy` tries to copy permissions of the file, but permissions are not a thing in WASI (at least yet) and `set_permissions` is implemented as an unconditional runtime error. This change instead adds a custom working implementation of `std::fs::copy` (like Rust already has on some other targets) that doesn't try to call `set_permissions` and is essentially a thin wrapper around `std::io::copy`. Fixes #68560.
2020-01-10make use of pointer::is_nullLzu Tao-5/+6
2020-01-02Use drop instead of the toilet closure `|_| ()`Lzu Tao-2/+2
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-33/+14
2019-12-21Require issue = "none" over issue = "0" in unstable attributesRoss MacArthur-2/+2
2019-12-12Fix signature of `__wasilibc_find_relpath`Alex Crichton-14/+21
Looks like this function changed upstream, so it needs to be adjusted for when used by libstd.
2019-12-05Fix fetching arguments on the wasm32-wasi targetAlex Crichton-0/+1
Fixes an error introduced in #66750 where wasi executables always think they have zero arguments because one of the vectors returned here accidentally thought it was length 0.
2019-12-03Update the `wasi` crate for `wasm32-wasi`Alex Crichton-361/+295
This commit updates the `wasi` crate used by the standard library which is used to implement most of the functionality of libstd on the `wasm32-wasi` target. This update comes with a brand new crate structure in the `wasi` crate which caused quite a few changes for the wasi target here, but it also comes with a significant change to where the functionality is coming from. The WASI specification is organized into "snapshots" and a new snapshot happened recently, so the WASI APIs themselves have changed since the previous revision. This had only minor impact on the public facing surface area of libstd, only changing on `u32` to a `u64` in an unstable API. The actual source for all of these types and such, however, is now coming from the `wasi_preview_snapshot1` module instead of the `wasi_unstable` module like before. This means that any implementors generating binaries will need to ensure that their embedding environment handles the `wasi_preview_snapshot1` module.
2019-11-29Format libstd/sys with rustfmtDavid Tolnay-92/+63
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-10-20fix WASI sleep implArtyom Pavlov-4/+4
2019-09-06Rollup merge of #64186 - alexcrichton:improve-env-codegen, r=sfacklerMazdak Farrokhzad-3/+5
std: Improve downstream codegen in `Command::env` 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-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-30simplify codenewpavlov-5/+12
2019-08-29update to wasi v0.7newpavlov-52/+67
2019-08-24Merge branch 'master' into wasiArtyom Pavlov-2/+19
2019-08-23Implement decode_error_kind for wasiMarco A L Barbosa-2/+18
Based on the implementation for unix targets
2019-08-21move cvtnewpavlov-24/+24
2019-08-21fixesnewpavlov-74/+69
2019-08-21update argsnewpavlov-2/+8
2019-08-20use new get_argsnewpavlov-3/+5
2019-08-20fix C incompatibilitiesnewpavlov-22/+47
2019-08-19fixnewpavlov-3/+3
2019-08-19use constnewpavlov-2/+4
2019-08-19typo fixnewpavlov-1/+1
2019-08-19use non-zero clock idnewpavlov-2/+2