about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-12-13Reuse the `staged_api` feature for `rustc_const_unstable`Oliver Scherer-1/+1
2019-12-12std: Implement `LineWriter::write_vectored`Alex Crichton-1/+171
This commit implements the `write_vectored` method of the `LineWriter` type. First discovered in bytecodealliance/wasmtime#629 the `write_vectored` method of `Stdout` bottoms out here but only ends up writing the first buffer due to the default implementation of `write_vectored`. Like `BufWriter`, however, `LineWriter` can have a non-default implementation of `write_vectored` which tries to preserve the vectored-ness as much as possible. Namely we can have a vectored write for everything before the newline and everything after the newline if all the stars align well. Also like `BufWriter`, though, special care is taken to ensure that whenever bytes are written we're sure to signal success since that represents a "commit" of writing bytes.
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-12Rollup merge of #67230 - chansuke:remove-irrelevant-passage, r=Dylan-DPCYuki Okushi-2/+0
Remove irelevant comment on `register_dtor` Fixes #66572.
2019-12-11Auto merge of #65345 - ↵bors-1/+0
davidtwco:issue-64130-async-send-sync-error-improvements, r=nikomatsakis async/await: improve not-send errors, part 2 Part of #64130. Fixes #65667. This PR improves the errors introduced in #64895 so that they have specialized messages for `Send` and `Sync`. r? @nikomatsakis
2019-12-12Remove irelevant comment on `register_dtor`chansuke-2/+0
2019-12-11Rollup merge of #67181 - TheSamsa:update-hashmap-doc, r=Dylan-DPCYuki Okushi-1/+1
Update hashmap doc Update hint to the used algorithms. Skimmed over the longer description but could not find another mentioning of the old algorithms. Closes #67093
2019-12-09Update HashMap documentation hint of the used 'quadratic probing' and 'SIMD ↵Christoph Schmidler-1/+1
lookup' algorithms
2019-12-09inline some common methods on OsStrLzu Tao-0/+11
2019-12-08Auto merge of #66730 - hermitcore:master, r=alexcrichtonbors-2/+0
remove dependency from libhermit The build process of the unikernel HermitCore is redesigned and doesn't longer depend on libhermit.
2019-12-08async/await: more improvements to non-send errorsDavid Wood-1/+0
Signed-off-by: David Wood <david@davidtw.co>
2019-12-08Rollup merge of #66325 - BartMassey:master, r=joshtriplettMazdak Farrokhzad-2/+2
Change unused_labels from allow to warn Fixes #66324, making the unused_labels lint warn instead of allow by default. I'm told @rust-lang/lang will need to review this, and perhaps will want to do a crater run.
2019-12-06Rollup merge of #67094 - RalfJung:fields, r=Mark-SimulacrumMazdak Farrokhzad-26/+24
get rid of __ in field names This old work-around should not be needed any more.
2019-12-06get rid of __ in field namesRalf Jung-26/+24
2019-12-07Rollup merge of #67085 - reitermarkus:addr-parser, r=Mark-SimulacrumYuki Okushi-19/+4
Remove boxed closures in address parser. Simplify address parser by removing unnecessary boxed closures. Also relevant for https://github.com/rust-lang/rfcs/pull/2832.
2019-12-07Rollup merge of #67049 - tmiasko:io-slice-advance, r=rkruppeYuki Okushi-29/+26
Simplify {IoSlice, IoSliceMut}::advance examples and tests Remove unnecessary calls to `std::mem::replace` and make variables immutable.
2019-12-07Rollup merge of #66998 - Wind-River:master_up, r=alexcrichtonYuki Okushi-2/+9
Modified the testcases for VxWorks
2019-12-06Remove boxed closures in address parser.Markus Reiter-19/+4
2019-12-06Rewrite %rax register before syscall because it is overwritten by the ↵Pieter Agten-2/+2
syscall itself
2019-12-06Auto merge of #67080 - JohnTitor:rollup-2t6fm3u, r=JohnTitorbors-9/+26
Rollup of 10 pull requests Successful merges: - #66649 (VxWorks: fix issues in accessing environment variables) - #66764 (Tweak wording of `collect()` on bad target type) - #66900 (Clean up error codes) - #66974 ([CI] fix the `! isCI` check in src/ci/run.sh) - #66979 (Add long error for E0631 and update ui tests.) - #67017 (cleanup long error explanations) - #67021 (Fix docs for formatting delegations) - #67041 (add ExitStatusExt into prelude) - #67065 (Fix fetching arguments on the wasm32-wasi target) - #67066 (Update the revision of wasi-libc used in wasm32-wasi) Failed merges: r? @ghost
2019-12-06Rollup merge of #67065 - alexcrichton:update-wasi, r=sfacklerYuki Okushi-0/+1
Fix fetching arguments on the wasm32-wasi target 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-06Rollup merge of #67041 - Wind-River:master_base, r=alexcrichtonYuki Okushi-0/+3
add ExitStatusExt into prelude r? @alexcrichton
2019-12-06Rollup merge of #66649 - Wind-River:master_xyz, r=alexcrichtonYuki Okushi-9/+22
VxWorks: fix issues in accessing environment variables
2019-12-06Auto merge of #66835 - AviKozokin:master, r=alexcrichtonbors-2/+2
std:win: avoid WSA_FLAG_NO_INHERIT flag and don't use SetHandleInformation on UWP This flag is not supported on Windows 7 before SP1, and on windows server 2008 SP2. This breaks Socket creation & duplication. This was fixed in a previous PR. cc #26658 This PR: cc #60260 reuses this flag to support UWP, and makes an attempt to handle the potential error. This version still fails to create a socket, as the error returned by WSA on this case is WSAEINVAL (invalid argument). and not WSAEPROTOTYPE. MSDN page for WSASocketW (that states the platform support for WSA_FLAG_NO_HANDLE_INHERIT): https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw CC #26543 CC #26518
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-05Processed review commentsPieter Agten-7/+17
2019-12-05Simplify {IoSlice, IoSliceMut}::advance examples and testsTomasz Miąsko-29/+26
Remove unnecessary calls to `std::mem::replace` and make variables immutable.
2019-12-04Create a separate entry point for the ELF file, instead of using the SGX ↵Pieter Agten-0/+20
entry point
2019-12-03Modified the testcases for VxWorksUmesh Kalappa-2/+9
2019-12-03Rollup merge of #66750 - alexcrichton:update-wasi, r=sfacklerMazdak Farrokhzad-362/+296
Update the `wasi` crate for `wasm32-wasi` 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-12-03add ExitStatusExt into preludeBaoshanPang-0/+3
2019-12-03Update the `wasi` crate for `wasm32-wasi`Alex Crichton-362/+296
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-12-03Rollup merge of #66904 - DevinR528:keyword-doc, r=Dylan-DPCMazdak Farrokhzad-5/+71
Adding docs for keyword match, move Partial fix of issue #34601.
2019-12-02added correct error code for WSASocketW failure fallbackavikozokin-2/+2
2019-12-02Rollup merge of #66346 - linkmauve:try-in-docstring, r=Dylan-DPCMazdak Farrokhzad-156/+284
Replace .unwrap() with ? in std::os::unix::net As people like to copy examples, this gives them good habits.
2019-12-01add grammer fixesDevin R-2/+2
2019-11-30add ";" for let = matchDevin R-1/+1
2019-11-30fix doc compile failDevin R-4/+5
2019-11-30Rollup merge of #66705 - pitdicker:atomic_mut_ptr, r=KodrAusMazdak Farrokhzad-5/+6
Atomic as_mut_ptr I encountered the following pattern a few times: In Rust we use some atomic type like `AtomicI32`, and an FFI interface exposes this as `*mut i32` (or some similar `libc` type). It was not obvious to me if a just transmuting a pointer to the atomic was acceptable, or if this should use a cast that goes through an `UnsafeCell`. See https://github.com/rust-lang/rust/issues/66136#issuecomment-557802477 Transmuting the pointer directly: ```rust let atomic = AtomicI32::new(1); let ptr = &atomic as *const AtomicI32 as *mut i32; unsafe { ffi(ptr); } ``` A dance with `UnsafeCell`: ```rust let atomic = AtomicI32::new(1); unsafe { let ptr = (&*(&atomic as *const AtomicI32 as *const UnsafeCell<i32>)).get(); ffi(ptr); } ``` Maybe in the end both ways could be valid. But why not expose a direct method to get a pointer from the standard library? An `as_mut_ptr` method on atomics can be safe, because only the use of the resulting pointer is where things can get unsafe. I documented its use for FFI, and "Doing non-atomic reads and writes on the resulting integer can be a data race." The standard library could make use this method in a few places in the WASM module. cc @RalfJung as you answered my original question.
2019-11-30remove trailing whitespaceDevin R-15/+15
2019-11-30add docs for move and match keywordsDevin R-2/+5
2019-11-30add example to moveDevin R-1/+4
2019-11-30document match and move keywordsDevin R-5/+64
2019-11-30Auto merge of #66887 - dtolnay:rollup-uxowp8d, r=Centrilbors-5378/+6081
Rollup of 4 pull requests Successful merges: - #66818 (Format libstd/os with rustfmt) - #66819 (Format libstd/sys with rustfmt) - #66820 (Format libstd with rustfmt) - #66847 (Allow any identifier as format arg name) Failed merges: r? @ghost
2019-11-29Rollup merge of #66820 - dtolnay:fmt3, r=Dylan-DPCDavid Tolnay-2660/+2897
Format libstd with rustfmt (Same strategy as #66691.) This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd *that are not involved in any currently open PR* to minimize merge conflicts, and are not part of libstd/os (#66818) or libstd/sys (#66819). 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 -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libstd. 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-11-29Rollup merge of #66819 - dtolnay:fmt2, r=kennytmDavid Tolnay-2285/+2527
Format libstd/sys with rustfmt (Same strategy as #66691.) 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-11-29Format libstd with rustfmtDavid Tolnay-2660/+2897
This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd *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 -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libstd. 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-11-29Format libstd/sys with rustfmtDavid Tolnay-2285/+2527
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-11-29Format libstd/os with rustfmtDavid Tolnay-433/+657
This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd/os *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/os -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd/os 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-11-30Auto merge of #66873 - RalfJung:miri-args, r=dtolnaybors-1/+7
really_init cmdline args on Miri r? @joshtriplett Closes #66862.