summary refs log tree commit diff
path: root/src/libstd/sync
AgeCommit message (Collapse)AuthorLines
2019-06-12Deprecate ONCE_INITSteven Fackler-0/+6
Once::new() has been a stable const fn for a while now. Closes #61746
2019-05-20Rollup merge of #60511 - taiki-e:libstd-intra-doc, r=Dylan-DPCMazdak Farrokhzad-0/+4
Fix intra-doc link resolution failure on re-exporting libstd Currently, re-exporting libstd items as below will [occur a lot of failures](https://gist.github.com/taiki-e/e33e0e8631ef47f65a74a3b69f456366). ```rust pub use std::*; ``` Until the underlying issue (#56922) fixed, we can fix that so they don't propagate to downstream crates. Related: https://github.com/rust-lang/rust/pull/56941 (That PR fixed failures that occur when re-exporting from libcore to libstd.) r? @QuietMisdreavus
2019-05-17Remove the unstable and deprecated mpsc_selectJosh Stone-1038/+9
This removes macro `select!` and `std::sync::mpsc::{Handle, Select}`, which were all unstable and have been deprecated since 1.32.
2019-05-04Fix intra-doc link resolution failure on re-exporting libstdTaiki Endo-0/+4
2019-04-25ignore-tidy-filelength on all files with greater than 3000 linesvarkor-0/+2
2019-04-08Add must_use annotations to Result::is_ok and is_errAlex Gaynor-1/+1
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-39/+43
2019-03-25SGX target: fix std unit testsJethro Beekman-7/+20
2019-03-11Resolved nits raised in review.Alexander Regueiro-6/+6
2019-03-11Improvements to comments in libstd, libcore, liballoc.Alexander Regueiro-6/+6
2019-02-28libstd => 2018Taiki Endo-114/+114
2019-02-20Rollup merge of #58553 - scottmcm:more-ihle, r=Centrilkennytm-23/+23
Use more impl header lifetime elision Inspired by seeing explicit lifetimes on these two: - https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator - https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not And a follow-up to https://github.com/rust-lang/rust/pull/54687, that started using IHLE in libcore. Most of the changes in here fall into two big categories: - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm). I also removed two lifetimes that turned out to be completely unused; see https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
2019-02-17Use more impl header lifetime elisionScott McMurray-23/+23
There are two big categories of changes in here - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-21/+21
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-11Fiddle through the module visibilities for testsOliver Scherer-8/+8
2019-02-11Move out tests of a deprecated module to work around `#[test]` bugsOliver Scherer-414/+416
https://github.com/rust-lang/rust/issues/47238
2019-02-10libs: doc commentsAlexander Regueiro-13/+13
2019-02-10tests: doc commentsAlexander Regueiro-8/+8
2019-01-17Simplify Debug implementation of MutexGuard.Mara Bos-7/+1
Just transparently print the guarded data, instead of wrapping it in `MutexGuard { lock: Mutex { data: ... } }`.
2019-01-17Make MutexGuard's Debug implementation more useful.Mara Bos-3/+7
Fixes #57702.
2019-01-02Auto merge of #56827 - faern:eliminate-recv-timeout-panic, r=KodrAusbors-6/+18
Eliminate Receiver::recv_timeout panic Fixes #54552. This panic is because `recv_timeout` uses `Instant::now() + timeout` internally. This possible panic is not mentioned in the documentation for this method. Very recently we merged (still unstable) support for checked addition (#56490) of `Instant + Duration`, so it's now finally possible to add these together without risking a panic.
2018-12-25Remove licensesMark Rousskov-160/+0
2018-12-14Use checked_add for adding time in recv_timeoutLinus Färnstrand-6/+18
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-4/+4
2018-11-16Replace data.clone() by Arc::clone(&data) in mutex doc.Benoît C-1/+1
Arc::clone(&from) is considered as more idiomatic because it conveys more explicitly the meaning of the code.
2018-11-08Deprecate channel selectionStjepan Glavina-4/+4
2018-11-07Rollup merge of #55734 - teresy:shorthand-fields, r=davidtwcokennytm-1/+1
refactor: use shorthand fields refactor: use shorthand for single fields everywhere (excluding tests).
2018-11-06refactor: use shorthand fieldsteresy-1/+1
2018-10-23fix typos in various placesMatthias Krüger-3/+3
2018-10-07Fix tracking issue for Once::is_completedSimon Sapin-1/+1
2018-10-05Rollup merge of #54078 - GabrielMajeri:expand-sync-docs, r=steveklabnikPietro Albini-4/+148
Expand the documentation for the `std::sync` module I've tried to expand the documentation for Rust's synchronization primitives. The module level documentation explains why synchronization is required when working with a multiprocessor system, and then links to the appropiate structure in this module. Fixes #29377, since this should be the last item on the checklist (documentation for `Atomic*` was fixed in #44854, but not ticked off the checklist).
2018-10-05Address review commentsGabriel Majeri-43/+67
2018-09-29Fix Once perf regressionAleksey Kladov-0/+1
Because `call_once` is generic, but `is_completed` is not, we need `#[inline]` annotation to allow LLVM to inline `is_completed` into `call_once` in downstream crates.
2018-09-28Rewrite section on concurrencyGabriel Majeri-4/+5
2018-09-28Fix broken linksGabriel Majeri-5/+7
2018-09-27Address review commentsGabriel Majeri-14/+15
Reword the lead paragraph and turn the list items into complete sentences.
2018-09-27Make example code use global variablesGabriel Majeri-13/+14
Because `fn main()` was added automatically, the variables were actually local statics.
2018-09-27Expand the documentation for the std::sync moduleGabriel Majeri-4/+119
Provides an overview on why synchronization is required, as well a short summary of what sync primitives are available.
2018-09-06Fix invalid urlsGuillaume Gomez-4/+0
2018-09-05Auto merge of #53075 - Mark-Simulacrum:update-cargolock, r=alexcrichtonbors-1/+1
Update Cargo.lock This also includes major version bumps for the rand crate used by core, std, and alloc tests, among other crates (regex, etc.) used elsewhere. Since these are all internal there should be no user-visible changes. r? @alexcrichton
2018-09-05Auto merge of #53027 - matklad:once_is_completed, r=alexcrichtonbors-14/+59
Allow to check if sync::Once is already initialized Hi! I propose to expose a way to check if a `Once` instance is initialized. I need it in `once_cell`. `OnceCell` is effetively a pair of `(Once, UnsafeCell<Option<T>>)`, which can set the `T` only once. Because I can't check if `Once` is initialized, I am forced to add an indirection and check the value of ptr instead: https://github.com/matklad/once_cell/blob/8127a81976c3f2f4c0860562c3f14647ebc025c0/src/lib.rs#L423-L429 https://github.com/matklad/once_cell/blob/8127a81976c3f2f4c0860562c3f14647ebc025c0/src/lib.rs#L457-L461 The `parking_lot`'s version of `Once` exposes the state as an enum: https://docs.rs/parking_lot/0.6.3/parking_lot/struct.Once.html#method.state. I suggest, for now, just to add a simple `bool` function: this fits my use-case perfectly, exposes less implementation details, and is forward-compatible with more fine-grained state checking.
2018-09-04Breaking change upgradesMark Rousskov-1/+1
2018-08-19Fix typos found by codespell.Matthias Krüger-1/+1
2018-08-14Auto merge of #52936 - felixrabe:patch-1, r=alexcrichtonbors-0/+28
Document #39364 – Panic in mpsc::Receiver::recv_timeout I can still reproduce #39364 with the example code at https://github.com/rust-lang/rust/issues/39364#issuecomment-320637702. I'm opening this PR in an attempt to document this bug as a known issue in [libstd/sync/mpsc/mod.rs](https://github.com/rust-lang/rust/blob/master/src/libstd/sync/mpsc/mod.rs). Inputs very much welcome. ([Nightly docs for `recv_timeout`.](https://doc.rust-lang.org/nightly/std/sync/mpsc/struct.Receiver.html?search=#method.recv_timeout))
2018-08-09Reduce code duplication in OnceAleksey Kladov-14/+18
2018-08-07"Panics" -> "Known Issues"; rm trailing WSFelix Rabe-2/+2
2018-08-07Less words better than moar wordsFelix Rabe-2/+2
2018-08-07RephraseFelix Rabe-2/+2
2018-08-07Document panic in mpsc::Receiver::recv_timeoutFelix Rabe-1/+23
2018-08-06Remove references to `StaticMutex` which got removed a while agoRalf Jung-6/+4