about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2020-04-01Rollup merge of #70081 - lcnr:issue68387, r=varkorDylan DPC-3/+2
add `unused_braces` lint Add the lint `unused_braces` which is warn by default. `unused_parens` is also extended and now checks anon consts. closes #68387 r? @varkor
2020-03-31Inline start_thread into its callers.Vytautas Astrauskas-26/+30
2020-03-31Fix double-free and undefined behaviour in libstd::syn::unix::Thread::new.Vytautas Astrauskas-18/+43
2020-03-31Add io::Write::write_all_vectoredThomas de Zeeuw-1/+161
Similar to io::Write::write_all but uses io::Write::write_vectored instead.
2020-03-31fix internal lint falloutBastian Kauschke-3/+2
2020-03-31Rollup merge of #70613 - matthiaskrgr:cl5ppy_squashed, r=CentrilMazdak Farrokhzad-3/+3
more clippy fixes * use is_empty() instead of len comparison (clippy::len_zero) * use if let instead of while let loop that never loops (clippy::never_loop) * remove redundant returns (clippy::needless_return) * remove redundant closures (clippy::redundant_closure) * use if let instead of match and wildcard pattern (clippy::single_match) * don't repeat field names redundantly (clippy::redundant_field_names) r? @Centril
2020-03-31more clippy fixesMatthias Krüger-3/+3
use is_empty() instead of len comparison (clippy::len_zero) use if let instead of while let loop that never loops (clippy::never_loop) remove redundant returns (clippy::needless_return) remove redundant closures (clippy::redundant_closure) use if let instead of match and wildcard pattern (clippy::single_match) don't repeat field names redundantly (clippy::redundant_field_names)
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-30Rollup merge of #70479 - RalfJung:win-env, r=Mark-SimulacrumDylan DPC-1/+1
avoid creating unnecessary reference in Windows Env iterator Discovered in https://github.com/rust-lang/miri/pull/1225: the Windows `Env` iterator violates Stacked Borrows by creating an `&u16`, turning it into a raw pointer, and then accessing memory outside the range of that type. There is no need to create a reference here in the first place, so the fix is trivial. Cc @JOE1994 Cc https://github.com/rust-lang/unsafe-code-guidelines/issues/134
2020-03-30Add inline attributes for functions used in the query systemJohn Kåre Alsaker-0/+1
2020-03-30move the definition of thread priorities to hermit-abiStefan Lankes-25/+2
2020-03-30reorder imports to pass the format checkStefan Lankes-1/+1
2020-03-30minor changes to pass the format checkStefan Lankes-2/+1
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-1/+1
2020-03-30move OS constants to platform crateStefan Lankes-9/+3
2020-03-29Implement `init` and `init_offset` on `AllocInit` and mark it unsafeTim Diekmann-4/+4
2020-03-29Rollup merge of #70510 - RalfJung:bool-vs-boolean, r=Mark-SimulacrumDylan DPC-1/+1
fix TryEnterCriticalSection return type Source: https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-tryentercriticalsection Fixes https://github.com/rust-lang/rust/issues/70504
2020-03-29Rollup merge of #69937 - TyPR124:osstr_ascii, r=dtolnayDylan DPC-11/+235
ASCII methods on OsStr Would close #69566 I don't know enough about encodings to know if this is a valid change, however the comment on the issue suggests it could be. This does two things: 1. Makes ASCII methods available on OsStr 2. Makes it possible to obtain a `&mut OsStr`. This is necessary to actually use `OsStr::make_ascii_*case` methods since they modify the underlying value. As far as I can tell, the only way to modify a `&mut OsStr` is via the methods I just added. My original hope was to have these methods on `OsStrExt` for Windows, since the standard library already assumes `make_ascii_uppercase` is valid in Windows (see the change I made to windows/process.rs). If it is found these are not valid changes on non-Windows platforms, I can move the methods to the ext trait instead.
2020-03-28add tracking issueTyPR124-6/+6
2020-03-28move doc links for consistencyTyPR124-4/+4
2020-03-28remove unnecessary commentsTyPR124-2/+0
2020-03-28use make_ascii_uppercase in windows/process.rsTyPR124-5/+4
2020-03-28ascii methods on osstrTyPR124-6/+233
2020-03-28fix TryEnterCriticalSection return typeRalf Jung-1/+1
2020-03-28Make fields in `MemoryBlock` publicTim Diekmann-16/+17
2020-03-28Replace last mention of IRC with DiscordBenjamin Kästner-1/+3
Mozilla's IRC service was shut down in March 2020. The official instant messaging variant has been Discord for a while, and most of the links were already replaced by #61524. This was the last line that came up with `irc.mozilla.org` or any combination of "irc.*#[a-z]+" in a `git grep`: git grep -i -E "irc.*#[a-z]+" As there is only one other link directly to Rust's discord, I used the same Markdown link `[rust-discord]` as in `bootstrap/README.md` to stay consistent. This might come in handy if the chat platform changes at a later point again. As an aside: for those interested in the use of IRC, Mozilla's [wiki] still offers a lot of in-depth knowledge. [wiki]: https://wiki.mozilla.org/IRC
2020-03-27avoid creating unnecessary reference in Windows Env iteratorRalf Jung-1/+1
2020-03-27Auto merge of #68404 - Amanieu:llvm-asm, r=estebankbors-29/+10
Rename asm! to llvm_asm! As per https://github.com/rust-lang/rfcs/pull/2843, this PR renames `asm!` to `llvm_asm!`. It also renames the compiler's internal `InlineAsm` data structures to `LlvmInlineAsm` in preparation for the new `asm!` functionality specified in https://github.com/rust-lang/rfcs/pull/2850. This PR doesn't actually deprecate `asm!` yet, it just makes it redirect to `llvm_asm!`. This is necessary because we first need to update the submodules (in particular stdarch) to use `llvm_asm!`.
2020-03-27Rollup merge of #70048 - TyPR124:mutable_osstr, r=dtolnayDylan DPC-0/+50
Allow obtaining &mut OsStr ```rust impl DerefMut for OsString {...} // type Target = OsStr impl IndexMut<RangeFull> for OsString {...} // type Output = OsStr ``` --- This change is pulled out of #69937 per @dtolnay This implements `DerefMut for OsString` to allow obtaining a `&mut OsStr`. This also implements `IndexMut for OsString`, which is used by `DerefMut`. This pattern is the same as is used by `Deref`. This is necessary to for methods like `make_ascii_lowercase` which need to mutate the underlying value.
2020-03-26Remove alignment from `MemoryBlock`Tim Diekmann-32/+29
2020-03-26Add comment to `AllocRef` implementation for `System`Tim Diekmann-0/+2
2020-03-26Fix issues from review and unsoundness of `RawVec::into_box`Tim Diekmann-50/+44
2020-03-26Overhaul of the `AllocRef` trait to match allocator-wg's latest consensTim Diekmann-40/+78
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-29/+10
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-26introduce `negative_impls` feature gate and documentNiko Matsakis-0/+1
They used to be covered by `optin_builtin_traits` but negative impls are now applicable to all traits, not just auto traits. This also adds docs in the unstable book for the current state of auto traits.
2020-03-25Rollup merge of #70361 - tmiasko:backtrace, r=Mark-SimulacrumMazdak Farrokhzad-1/+1
Update backtrace crate to 0.3.46 * Support line-tables-only when using libbacktrace * Update libbacktrace to latest master * Define HAVE_KERN_PROC on FreeBSD to fix rust-lang/rust#54434
2020-03-24spaces between braces really ruin readabilityWithout Boats-4/+4
2020-03-24Update backtrace crate to 0.3.46Tomasz Miąsko-1/+1
2020-03-24correct rustc versionWithout Boats-2/+2
2020-03-24IoSlice/IoSliceMut should be Send and SyncWithout Boats-0/+12
2020-03-23Update src/libstd/lib.rsSaoirse Shipwreckt-1/+1
Co-Authored-By: Ashley Mannix <ashleymannix@live.com.au>
2020-03-23Add `wake_trait` feature directive to stdWithout Boats-0/+1
2020-03-23Add Wake trait for safe construction of Wakers.Without Boats-0/+5
Currently, constructing a waker requires calling the unsafe `Waker::from_raw` API. This API requires the user to manually construct a vtable for the waker themself - which is both cumbersome and very error prone. This API would provide an ergonomic, straightforward and guaranteed memory-safe way of constructing a waker. It has been our longstanding intention that the `Waker` type essentially function as an `Arc<dyn Wake>`, with a `Wake` trait as defined here. Two considerations prevented the original API from being shipped as simply an `Arc<dyn Wake>`: - We want to support futures on embedded systems, which may not have an allocator, and in optimized executors for which this API may not be best-suited. Therefore, we have always explicitly supported the maximally-flexible (but also memory-unsafe) `RawWaker` API, and `Waker` has always lived in libcore. - Because `Waker` lives in libcore and `Arc` lives in liballoc, it has not been feasible to provide a constructor for `Waker` from `Arc<dyn Wake>`. Therefore, the Wake trait was left out of the initial version of the task waker API. However, as Rust 1.41, it is possible under the more flexible orphan rules to implement `From<Arc<W>> for Waker where W: Wake` in liballoc. Therefore, we can now define this constructor even though `Waker` lives in libcore. This PR adds these APIs: - A `Wake` trait, which contains two methods - A required method `wake`, which is called by `Waker::wake` - A provided method `wake_by_ref`, which is called by `Waker::wake_by_ref` and which implementors can override if they can optimize this use case. - An implementation of `From<Arc<W>> for Waker where W: Wake + Send + Sync + 'static` - A similar implementation of `From<Arc<W>> for RawWaker`.
2020-03-23Rollup merge of #70207 - hatoo:macos-getentropy, r=dtolnayMazdak Farrokhzad-0/+37
Use getentropy(2) on macos resolves #70179
2020-03-22Rollup merge of #70240 - brain0:thread_id, r=Mark-SimulacrumDylan DPC-2/+2
Return NonZeroU64 from ThreadId::as_u64. As discussed in #67939, this allows turning Option<ThreadId> into Option<NonZeroU64> which can then be stored inside an AtomicU64.
2020-03-21Rollup merge of #70232 - adrian5:patch-1, r=Dylan-DPCDylan DPC-1/+1
Tweak wording for std::io::Read::read function I think the sentence as a whole reads smoother that way.
2020-03-21Rollup merge of #70218 - intgr:fix-deprecated-method-in-docs, r=jonas-schievinkDylan DPC-1/+1
Fix deprecated Error.description() usage in docs
2020-03-21Rollup merge of #70197 - pnkfelix:issue-53957-revise-test-of-23076, ↵Dylan DPC-4/+19
r=LukasKalbertodt For issue 53957: revise unit test to focus on underlying bug of 23076. Fix #53957 by revising unit test to focus on underlying bug of #23076. Namely, this version focuses on the end-to-end behavior that the attempt to create the UDP binding will fail, regardless of the semantics of how particular DNS servers handle junk inputs. (I spent some time trying to create a second more-focused test that would sidestep the DNS resolution, but this is not possible without more invasive changes to the internal infrastructure of `ToSocketAddrs` and what not. It is not worth it.)
2020-03-21Return NonZeroU64 from ThreadId::as_u64.Thomas Bächler-2/+2
As discussed in #67939, this allows turning Option<ThreadId> into Option<NonZeroU64> which can then be stored inside an AtomicU64.
2020-03-21Tweak wording for std::io::Read::read functionadrian5-1/+1