about summary refs log tree commit diff
path: root/src/libstd/sync/mpsc
AgeCommit message (Collapse)AuthorLines
2015-04-01Test fixes and rebase conflicts, round 2Alex Crichton-21/+21
2015-04-01rollup merge of #23176: huonw/rm-boundsAlex Crichton-29/+29
2015-03-31Indicate select! is code-likeCorey Farwell-1/+1
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-5/+5
Now that support has been removed, all lingering use cases are renamed.
2015-03-24Added `T:Send` bound to `Queue<T>` to avoid specialized `Drop` impl.Felix S. Klock II-1/+1
2015-03-24Added `T:Send` bound to `Packet<T>` to avoid specialized `Drop` impl.Felix S. Klock II-2/+2
2015-03-24Added `T:Send` bound to `Queue<T>` to avoid specialized Drop impl.Felix S. Klock II-2/+2
2015-03-24Added `T:Send` bound to `sync::mpsc::Receiver` and `sync::mpsc::Sender`.Felix S. Klock II-16/+16
This was necessary to avoid specialized `Drop` impls for the two structs.
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-0/+4
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23rollup merge of #23541: aturon/stab-errorAlex Crichton-2/+2
This small commit stabilizes the `Error` trait as-is, except that `Send` and `Debug` are added as constraints. The `Send` constraint is because most uses of `Error` will be for trait objects, and by default we would like these objects to be transferrable between threads. The `Debug` constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because types that implement `Display` should certainly implement `Debug` in any case. In the near future we expect to add `Any`-like downcasting features to `Error`, but this is waiting on some additional mechanisms (`Reflect`). It will be added before 1.0 via default methods. [breaking-change] r? @alexcrichton Closes #21790
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+4
2015-03-23Stabilize the Error traitAaron Turon-2/+2
This small commit stabilizes the `Error` trait as-is, except that `Send` and `Debug` are added as constraints. The `Send` constraint is because most uses of `Error` will be for trait objects, and by default we would like these objects to be transferrable between threads. The `Debug` constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because types that implement `Display` should certainly implement `Debug` in any case. In the near future we expect to add `Any`-like downcasting features to `Error`, but this is waiting on some additional mechanisms (`Reflect`). It will be added before 1.0 via default methods. [breaking-change]
2015-03-20don't use Result::ok just to be able to use unwrap/unwrap_orOliver Schneider-1/+1
2015-03-11Example -> ExamplesSteve Klabnik-4/+4
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-08Remove unneeded `Send` bounds from `std::sync::mpsc`.Huon Wilson-29/+29
The requirements `T: Send` only matter if the channel crosses thread boundaries i.e. the `Sender` or `Reciever` are sent across thread boundaries, and which is adequately controlled by the impls of `Send` for them. If `T` doesn't satisfy the bounds, then the types cannot cross thread boundaries and so everything is still safe (the pair of types collectively behave like a `Rc<RefCell<VecDeque>>`, or something of that nature).
2015-03-06Implement std::error::Error for std::sync::mpsc error typesDan Burkert-0/+63
2015-03-03Add `: Box<_>` or `::Box<_>` type annotations to various places.Felix S. Klock II-6/+6
This is the kind of change that one is expected to need to make to accommodate overloaded-`box`. ---- Note that this is not *all* of the changes necessary to accommodate Issue 22181. It is merely the subset of those cases where there was already a let-binding in place that made it easy to add the necesasry type ascription. (For unnamed intermediate `Box` values, one must go down a different route; `Box::new` is the option that maximizes portability, but has potential inefficiency depending on whether the call is inlined.) ---- There is one place worth note, `run-pass/coerce-match.rs`, where I used an ugly form of `Box<_>` type ascription where I would have preferred to use `Box::new` to accommodate overloaded-`box`. I deliberately did not use `Box::new` here, because that is already done in coerce-match-calls.rs. ---- Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-03-02Use `const`s instead of `static`s where appropriateFlorian Zeitz-5/+5
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-02-27Add some missing stability attributes on struct fields.Huon Wilson-1/+1
2015-02-24Fix integers in tests (fixup #22700)Manish Goregaokar-1/+1
2015-02-24Rollup merge of #22700 - nick29581:ints_hash, r=alexcrichtonManish Goregaokar-161/+161
fmt and hash are pretty straightforward I think. sync is a bit more complex. I thought one or two of the `isize`s ought to be `i32`s, but that would require a bunch of casting (the root cause being the lack of atomics other than isize/usize). r? @alexcrichton
2015-02-23int audit - std::syncNick Cameron-161/+161
2015-02-23Use boxed functions instead of transmuteStepan Koltsov-8/+8
... to convert between Box and raw pointers. E. g. use ``` let b: Box<Foo> = Box::from_raw(p); ``` instead of ``` let b: Box<Foo> = mem::transmute(p); ``` Patch also changes closure release code in `src/libstd/sys/unix/thread.rs` when `pthread_create` failed. Raw pointer was transmuted to box of `FnOnce()` instead of `Thunk`. This code was probably never executed, because `pthread_create` rarely fails in practice.
2015-02-21Remove `'static` bound from sync::mpsc, Mutex and RwLock.Huon Wilson-38/+38
Adds some basic tests to check that the types still catch the most glaring errors that could occur. cc #22444.
2015-02-18Remove `i`, `is`, `u`, or `us` suffixes that are not necessary.Niko Matsakis-22/+22
2015-02-17rollup merge of #22319: huonw/send-is-not-staticAlex Crichton-38/+38
Conflicts: src/libstd/sync/task_pool.rs src/libstd/thread.rs src/libtest/lib.rs src/test/bench/shootout-reverse-complement.rs src/test/bench/shootout-spectralnorm.rs
2015-02-17Fallout from stabilizationAaron Turon-111/+111
2015-02-18Update the libraries to reflect Send loosing the 'static bound.Huon Wilson-38/+38
In most places this preserves the current API by adding an explicit `'static` bound. Notably absent are some impls like `unsafe impl<T: Send> Send for Foo<T>` and the `std::thread` module. It is likely that it will be possible to remove these after auditing the code to ensure restricted lifetimes are safe. More progress on #22251.
2015-02-15Rollup merge of #22297 - nagisa:spring-cleanup, r=alexcrichtonManish Goregaokar-8/+8
This PR replaces uses of `os::getenv` with newly introduced `env::var{,_os}`. Mostly did this as a background activity to procrastinate from procrastinating. Tests appear to build and run fine. This includes benchmarks from test/bench directory.
2015-02-13Remove a few uses of deprecated getenvSimonas Kazlauskas-8/+8
2015-02-13Improve documentation for `Select::new()`.Steve Klabnik-4/+11
Remove incorrect claim, add example, reformat and re-word. Fixes #22266
2015-02-11rustc: Fix a number of stability lint holesAlex Crichton-13/+13
There are a number of holes that the stability lint did not previously cover, including: * Types * Bounds on type parameters on functions and impls * Where clauses * Imports * Patterns (structs and enums) These holes have all been fixed by overriding the `visit_path` function on the AST visitor instead of a few specialized cases. This change also necessitated a few stability changes: * The `collections::fmt` module is now stable (it was already supposed to be). * The `thread_local::imp::Key` type is now stable (it was already supposed to be). * The `std::rt::{begin_unwind, begin_unwind_fmt}` functions are now stable. These are required via the `panic!` macro. * The `std::old_io::stdio::{println, println_args}` functions are now stable. These are required by the `print!` and `println!` macros. * The `ops::{FnOnce, FnMut, Fn}` traits are now `#[stable]`. This is required to make bounds with these traits stable. Note that manual implementations of these traits are still gated by default, this stability only allows bounds such as `F: FnOnce()`. Additionally, the compiler now has special logic to ignore its own generated `__test` module for the `--test` harness in terms of stability. Closes #8962 Closes #16360 Closes #20327 [breaking-change]
2015-02-06Rollup merge of #21991 - steveklabnik:gh21915, r=huonwManish Goregaokar-1/+1
Fixes #21915
2015-02-06Rollup merge of #21954 - jbcrail:fix-misspelled-comments, r=steveklabnikManish Goregaokar-1/+1
The spelling corrections were made in both documentation comments and regular comments.
2015-02-05Mention the queueueue-ness of mpsc.Steve Klabnik-1/+1
Fixes #21915
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-1/+1
2015-02-04Fix for misspelled comments.Joseph Crail-1/+1
The spelling corrections were made in both documentation comments and regular comments.
2015-01-30rollup merge of #21631: tbu-/isize_policeAlex Crichton-37/+37
Conflicts: src/libcoretest/iter.rs
2015-01-30std: Stabilize the std::fmt moduleAlex Crichton-3/+3
This commit performs a final stabilization pass over the std::fmt module, marking all necessary APIs as stable. One of the more interesting aspects of this module is that it exposes a good deal of its runtime representation to the outside world in order for `format_args!` to be able to construct the format strings. Instead of hacking the compiler to assume that these items are stable, this commit instead lays out a story for the stabilization and evolution of these APIs. There are three primary details used by the `format_args!` macro: 1. `Arguments` - an opaque package of a "compiled format string". This structure is passed around and the `write` function is the source of truth for transforming a compiled format string into a string at runtime. This must be able to be constructed in stable code. 2. `Argument` - an opaque structure representing an argument to a format string. This is *almost* a trait object as it's just a pointer/function pair, but due to the function originating from one of many traits, it's not actually a trait object. Like `Arguments`, this must be constructed from stable code. 3. `fmt::rt` - this module contains the runtime type definitions primarily for the `rt::Argument` structure. Whenever an argument is formatted with nonstandard flags, a corresponding `rt::Argument` is generated describing how the argument is being formatted. This can be used to construct an `Arguments`. The primary interface to `std::fmt` is the `Arguments` structure, and as such this type name is stabilize as-is today. It is expected for libraries to pass around an `Arguments` structure to represent a pending formatted computation. The remaining portions are largely "cruft" which would rather not be stabilized, but due to the stability checks they must be. As a result, almost all pieces have been renamed to represent that they are "version 1" of the formatting representation. The theory is that at a later date if we change the representation of these types we can add new definitions called "version 2" and corresponding constructors for `Arguments`. One of the other remaining large questions about the fmt module were how the pending I/O reform would affect the signatures of methods in the module. Due to [RFC 526][rfc], however, the writers of fmt are now incompatible with the writers of io, so this question has largely been solved. As a result the interfaces are largely stabilized as-is today. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md Specifically, the following changes were made: * The contents of `fmt::rt` were all moved under `fmt::rt::v1` * `fmt::rt` is stable * `fmt::rt::v1` is stable * `Error` is stable * `Writer` is stable * `Writer::write_str` is stable * `Writer::write_fmt` is stable * `Formatter` is stable * `Argument` has been renamed to `ArgumentV1` and is stable * `ArgumentV1::new` is stable * `ArgumentV1::from_uint` is stable * `Arguments::new_v1` is stable (renamed from `new`) * `Arguments::new_v1_formatted` is stable (renamed from `with_placeholders`) * All formatting traits are now stable, as well as the `fmt` method. * `fmt::write` is stable * `fmt::format` is stable * `Formatter::pad_integral` is stable * `Formatter::pad` is stable * `Formatter::write_str` is stable * `Formatter::write_fmt` is stable * Some assorted top level items which were only used by `format_args!` were removed in favor of static functions on `ArgumentV1` as well. * The formatting-flag-accessing methods remain unstable Within the contents of the `fmt::rt::v1` module, the following actions were taken: * Reexports of all enum variants were removed * All prefixes on enum variants were removed * A few miscellaneous enum variants were renamed * Otherwise all structs, fields, and variants were marked stable. In addition to these actions in the `std::fmt` module, many implementations of `Show` and `String` were stabilized as well. In some other modules: * `ToString` is now stable * `ToString::to_string` is now stable * `Vec` no longer implements `fmt::Writer` (this has moved to `String`) This is a breaking change due to all of the changes to the `fmt::rt` module, but this likely will not have much impact on existing programs. Closes #20661 [breaking-change]
2015-01-30Remove all `i` suffixesTobias Bucher-37/+37
2015-01-29s/Show/Debug/gJorge Aparicio-3/+3
2015-01-29convert remaining `range(a, b)` to `a..b`Jorge Aparicio-10/+10
2015-01-29`for x in range(a, b)` -> `for x in a..b`Jorge Aparicio-42/+42
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-29`range(a, b).foo()` -> `(a..b).foo()`Jorge Aparicio-1/+1
sed -i 's/ range(\([^,]*\), *\([^()]*\))\./ (\1\.\.\2)\./g' **/*.rs
2015-01-27Merge remote-tracking branch 'rust-lang/master'Brian Anderson-2/+2
Conflicts: src/libcore/cell.rs src/librustc_driver/test.rs src/libstd/old_io/net/tcp.rs src/libstd/old_io/process.rs
2015-01-26Fallout of io => old_ioAlex Crichton-2/+2
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-2/+19
Conflicts: src/libcore/cmp.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/num/f32.rs src/libcore/num/f64.rs src/libcore/result.rs src/libcore/str/mod.rs src/librustc/lint/builtin.rs src/librustc/lint/context.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/poison.rs
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-133/+46
Conflicts: mk/tests.mk src/liballoc/arc.rs src/liballoc/boxed.rs src/liballoc/rc.rs src/libcollections/bit.rs src/libcollections/btree/map.rs src/libcollections/btree/set.rs src/libcollections/dlist.rs src/libcollections/ring_buf.rs src/libcollections/slice.rs src/libcollections/str.rs src/libcollections/string.rs src/libcollections/vec.rs src/libcollections/vec_map.rs src/libcore/any.rs src/libcore/array.rs src/libcore/borrow.rs src/libcore/error.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/ops.rs src/libcore/result.rs src/libcore/slice.rs src/libcore/str/mod.rs src/libregex/lib.rs src/libregex/re.rs src/librustc/lint/builtin.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/mutex.rs src/libstd/sync/poison.rs src/libstd/sync/rwlock.rs src/libsyntax/feature_gate.rs src/libsyntax/test.rs
2015-01-23grandfathered -> rust1Brian Anderson-29/+29
2015-01-23std: Relax Result::unwrap() to DebugAlex Crichton-2/+19
This commit relaxes the bound on `Result::unwrap` and `Result::unwrap_err` from the `Display` trait to the `Debug` trait for generating an error message about the unwrapping operation. This commit is a breaking change and any breakage should be mitigated by ensuring that `Debug` is implemented on the relevant type. [breaking-change]