about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2019-07-18Fix clippy::clone_on_copy warningsMateusz Mikuła-1/+1
2019-07-16Remove last use of mem::uninitialized from std::io::utilnathanwhit-4/+9
2019-07-16Auto merge of #61946 - BaoshanPang:vxworks, r=alexcrichtonbors-2/+8372
port rust for vxWorks The supporting for vxWorks has been enabled in this branch. Although there are still a lots of work to do, I would like to upstream the code and fix the problems later. Please let me know if there is anything I have to do before upstream the code. r? @alexcrichton Thanks, Baoshan
2019-07-16Add supporting for vxWorksBaoshan Pang-2/+8372
r? @alexcrichton
2019-07-16Test that maplike FromIter satisfies uniquenessNick Hynes-2/+6
2019-07-15Update the stdarch submodulegnzlbg-4/+4
2019-07-14Auto merge of #62610 - Stargateur:fix-miri-error-cstring-into_inner, r=RalfJungbors-5/+6
Fix miri error in into_inner() of CString Fix #62553 I choice to not transmute because I think it's more unsafe and in case the structure change this code should always work. r? @RalfJung
2019-07-14Auto merge of #62464 - GuillaumeGomez:add-missing-urls-osstr, r=QuietMisdreavusbors-3/+4
Add missing urls for osstr r? @QuietMisdreavus
2019-07-13Fix miri error in into_inner() of CStringAntoine PLASKOWSKI-5/+6
2019-07-13simplify std::io::Write::write rustdocColin Arnott-1/+1
The std::io::Write::write method currensly suggests consumers guaranteed that `0 <= n <= buf.len()`, for `Ok(n)`, however `n` is of type `usize` causing the compiler to emit a warning: ``` warning: comparison is useless due to type limits --> lib.rs:6:18 | 6 | Ok(n) => 0 <= n && n <= output.len(), | ^^^^^^ | = note: #[warn(unused_comparisons)] on by default ``` This PR removes the suggestion to check `0 <= n` since it is moot. r? @steveklabnik
2019-07-11document that crate refers to the project rootNathan Goldbaum-1/+5
2019-07-11Rollup merge of #62425 - cyphar:linux-cloexec-use-fcntl, r=alexcrichtonMazdak Farrokhzad-0/+2
filedesc: don't use ioctl(FIOCLEX) on Linux All `ioctl(2)`s will fail on `O_PATH` file descriptors on Linux (because they use `&empty_fops` as a security measure against `O_PATH` descriptors affecting the backing file). As a result, `File::try_clone()` and various other methods would always fail with `-EBADF` on `O_PATH` file descriptors. The solution is to simply use `F_SETFD` (as is used on other unices) which works on `O_PATH` descriptors because it operates through the `fnctl(2)` layer and not through `ioctl(2)`s. Since this code is usually only used in strange error paths (a broken or ancient kernel), the extra overhead of one syscall shouldn't cause any dramas. Most other systems programming languages also use the fnctl(2) so this brings us in line with them. Fixes: rust-lang/rust#62314 Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2019-07-10filedesc: don't use ioctl(FIOCLEX) on LinuxAleksa Sarai-0/+2
All ioctl(2)s will fail on O_PATH file descriptors on Linux (because they use &empty_fops as a security measure against O_PATH descriptors affecting the backing file). As a result, File::try_clone() and various other methods would always fail with -EBADF on O_PATH file descriptors. The solution is to simply use F_SETFD (as is used on other unices) which works on O_PATH descriptors because it operates through the fnctl(2) layer and not through ioctl(2)s. Since this code is usually only used in strange error paths (a broken or ancient kernel), the extra overhead of one syscall shouldn't cause any dramas. Most other systems programming languages also use the fnctl(2) so this brings us in line with them. Fixes: rust-lang/rust#62314 Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2019-07-09Rollup merge of #62403 - SimonSapin:concat, r=alexcrichtonMazdak Farrokhzad-6/+0
Replace SliceConcatExt trait with inherent methods and SliceConcat helper trait Before this change `SliceConcatExt` was an unstable extension trait with stable methods. It was in the libstd prelude, so that its methods could be used on the stable channel. This replaces it with inherent methods, which can be used without any addition to the prelude. Since the methods are stable and very generic (with for example a return type that depends on the types of parameters), an helper trait is still needed. But now that trait does not need to be in scope for the methods to be used. Removing this depedency on the libstd prelude allows the methods to be used in `#![no_std]` crate that use liballoc, which does not have its own implicitly-imported prelude.
2019-07-07Add missing urls for osstrGuillaume Gomez-3/+4
2019-07-07Document `while` keywordYuki Okushi-9/+56
2019-07-07Stablize Euclidean Modulo (feature euclidean_division)CrLF0710-8/+4
2019-07-06`#[rustc_doc_only_macro]` -> `#[rustc_builtin_macro]`Vadim Petrochenkov-16/+16
2019-07-06Rollup merge of #62296 - RalfJung:memalign, r=alexcrichtonMazdak Farrokhzad-1/+9
request at least ptr-size alignment from posix_memalign Fixes https://github.com/rust-lang/rust/issues/62251
2019-07-05Rollup merge of #62414 - jethrogb:jb/sgx-uninit, r=Mark-SimulacrumMazdak Farrokhzad-3/+1
Remove last use of mem::uninitialized in SGX See #62397
2019-07-05Rollup merge of #62381 - pawroman:fix_typo_in_write_vectored, r=CentrilMazdak Farrokhzad-1/+1
Fix a typo in Write::write_vectored docs Fixed what seems like a typo. "Copy to from" is extremely confusing.
2019-07-05Remove last use of mem::uninitialized in SGXJethro Beekman-3/+1
2019-07-05Rollup merge of #62123 - jeremystucki:needless_lifetimes_std, r=alexcrichtonMazdak Farrokhzad-7/+7
Remove needless lifetimes (std) Split from #62039
2019-07-05Replace SliceConcatExt trait with inherent methods and SliceConcat helper traitSimon Sapin-6/+0
Before this change `SliceConcatExt` was an unstable extension trait with stable methods. It was in the libstd prelude, so that its methods could be used on the stable channel. This replaces it with inherent methods, which can be used without any addition to the prelude. Since the methods are stable and very generic (with for example a return type that depends on the types of parameters), an helper trait is still needed. But now that trait does not need to be in scope for the methods to be used. Removing this depedency on the libstd prelude allows the methods to be used in `#![no_std]` crate that use liballoc, which does not have its own implicitly-imported prelude.
2019-07-04Permit use of mem::uninitialized via allow(deprecated)Mark Rousskov-0/+5
2019-07-04Fix a typo in Write::write_vectored docsPaweł Romanowski-1/+1
2019-07-04Add missing lifetime specifierJeremy Stucki-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-04Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, ↵Mazdak Farrokhzad-3/+4
r=dtolnay,Centril Use mem::take instead of mem::replace with default
2019-07-03fix unused-import error on androidRalf Jung-2/+1
2019-07-03Rollup merge of #62304 - SimonSapin:safe, r=eddybMark Rousskov-0/+12
HashMap is UnwindSafe Fixes https://github.com/rust-lang/rust/issues/62301, a regression in 1.36.0-pre which was caused by hashbrown using `NonZero<T>` where the older hashmap used `Unique<T>`.
2019-07-03Rollup merge of #62183 - alexcrichton:fix-tests, r=nikomatsakisMark Rousskov-27/+0
std: Move a process test out of libstd This commit moves a test out of libstd which is causing deadlocks on musl on CI. Looks like the recent update in musl versions brings in some internal updates to musl which makes `setgid` and `setuid` invalid to call after a `fork` in a multithreaded program. The issue seen here is that the child thread was attempting to grab a lock held by a nonexistent thread, meaning that the child process simply deadlocked causing the whole test to deadlock. This commit moves the test to its own file with no threads which should work.
2019-07-02HashMap is UnwindSafeSimon Sapin-0/+12
Fixes https://github.com/rust-lang/rust/issues/62301, a regression in 1.36.0 which was caused by hashbrown using `NonZero<T>` where the older hashmap used `Unique<T>`.
2019-07-02improve and deduplicate commentsRalf Jung-4/+3
2019-07-02request at least ptr-size alignment from posix_memalignRalf Jung-1/+11
2019-07-01Enable mem_take feature in relevant cratesChris Gregory-0/+1
2019-07-01Convert more usages overChris Gregory-3/+3
2019-07-01Remove needless lifetimesJeremy Stucki-7/+7
2019-06-30Extend the #[must_use] lint to boxed typesvarkor-1/+3
2019-06-29Rollup merge of #62163 - cuviper:unix-uninit, r=RalfJungMazdak Farrokhzad-61/+58
Avoid mem::uninitialized() in std::sys::unix For `libc` types that will be initialized in FFI calls, we can just use `MaybeUninit` and then pass around raw pointers. For `sun_path_offset()`, which really wants `offset_of`, all callers have a real `sockaddr_un` available, so we can use that reference. r? @RalfJung
2019-06-27Rollup merge of #62102 - RalfJung:read, r=CentrilMazdak Farrokhzad-1/+10
call out explicitly that general read needs to be called with an initialized buffer
2019-06-27Rollup merge of #62043 - Centril:remove-fnbox, r=cramertjMazdak Farrokhzad-1/+0
Remove `FnBox` Remove `FnBox` since we now have `Box<dyn FnOnce>`. Closes https://github.com/rust-lang/rust/issues/28796. r? @cramertj
2019-06-27std: Move a process test out of libstdAlex Crichton-27/+0
This commit moves a test out of libstd which is causing deadlocks on musl on CI. Looks like the recent update in musl versions brings in some internal updates to musl which makes `setgid` and `setuid` invalid to call after a `fork` in a multithreaded program. The issue seen here is that the child thread was attempting to grab a lock held by a nonexistent thread, meaning that the child process simply deadlocked causing the whole test to deadlock. This commit moves the test to its own file with no threads which should work.
2019-06-26Use pointer::write_bytes for android sigemptysetJosh Stone-5/+3
2019-06-26Avoid mem::uninitialized() in std::sys::unixJosh Stone-58/+57
For `libc` types that will be initialized in FFI calls, we can just use `MaybeUninit` and then pass around raw pointers. For `sun_path_offset()`, which really wants `offset_of`, all callers have a real `sockaddr_un` available, so we can use that reference.
2019-06-25tweak wordingRalf Jung-3/+3
2019-06-24call out explicitly that general read needs to be called with an initialized ↵Ralf Jung-1/+10
buffer
2019-06-22Remove FnBox.Mazdak Farrokhzad-1/+0
2019-06-22TypoFelix Rabe-1/+1
2019-06-20Rollup merge of #61900 - s3bk:master, r=sfacklerMazdak Farrokhzad-0/+4
implement Error::source for Box<T: Error> fixes https://github.com/rust-lang/rust/issues/61899
2019-06-20Add a few trait impls for AccessErrorStjepan Glavina-0/+4