Commit Graph

34313 Commits

Author SHA1 Message Date
bors
cb51567e19 auto merge of #18788 : ricky26/rust/master, r=aturon
This moves chars() and lines() out of Buffer and into separate traits (CharsBuffer and LinesBuffer respectively) - this matches the pattern used for bytes() on Reader (with BytesReader).

(I came across this when I wanted a trait object of a Buffer, so that I could use read_line(); rustc errors about std::io::Buffer not being object-safe.)

[breaking-change]
Any uses of Buffer::lines() will need to use the new trait std::io::LinesBuffer.
The same is true for Buffer::chars() with std::io::CharsBuffer.
2014-11-16 04:37:36 +00:00
Alfie John
a8933973f9 doc: make end comment consistent with start comment 2014-11-16 04:12:43 +00:00
Steven Fackler
579c65da1b Un-feature gate struct variants
Struct variant field visibility is now inherited. Remove `pub` keywords
from declarations.

Closes #18641

[breaking-change]
2014-11-15 18:15:27 -08:00
Brendan Zabarauskas
d82a7ea57a Move ToString to collections::string
This also impls `FormatWriter` for `Vec<u8>`
2014-11-16 12:41:55 +11:00
Brendan Zabarauskas
59abf75d9e Move IntoString to collections::string 2014-11-16 12:41:55 +11:00
Brendan Zabarauskas
2d8ca045d6 Rename IntoStr to IntoString
For consistancy with ToString
2014-11-16 12:41:55 +11:00
Brendan Zabarauskas
8b156724a3 Remove use of deprecated function 2014-11-16 12:41:55 +11:00
Brendan Zabarauskas
68bd495f0b Remove core::num::strconv 2014-11-16 12:41:55 +11:00
Brendan Zabarauskas
29bc9c632e Move FromStr to core::str 2014-11-16 12:41:55 +11:00
Alfie John
c5232615b6 doc: small grammar fix 2014-11-15 23:17:36 +00:00
Alex Gaynor
e94cd40f7e Fixed several typos 2014-11-15 15:00:47 -08:00
Alex Crichton
3e0368e621 std: Fix a flaky test on OSX 10.10
This test was somewhat sketchy already with a `loop` around `write`, so this
just adds some explicit synchronization to only call `write` once and guarantee
that the error happens.

Closes #18900
2014-11-15 11:23:40 -08:00
Colin Sherratt
6277e3b2d9 Update ring_buf.rs from fallout of #18827. 2014-11-15 12:48:02 -05:00
inrustwetrust
3391ddda11 Slightly improved rustc error messages for invalid -C arguments 2014-11-15 14:51:22 +01:00
bors
7e43f419cb auto merge of #18924 : cakebaker/rust/fix_list, r=steveklabnik 2014-11-15 13:22:24 +00:00
bors
d3af16bdbb auto merge of #18922 : japaric/rust/for, r=jakub-
r? @alexcrichton
2014-11-15 11:37:21 +00:00
bors
bc0b6120c1 auto merge of #18901 : steveklabnik/rust/quickfix, r=alexcrichton
Small copy/paste error from the crates guide.
2014-11-15 07:12:27 +00:00
Aaron Turon
60741e0fa0 rustdoc: tweak stability summary counting
This commit slightly tweaks the counting of impl blocks and structs for
the stability summary (so that the block itself isn't counted for
inherent impls, and the fields aren't counted for structs).
2014-11-14 20:54:27 -08:00
Aaron Turon
4caffa8526 libs: fix #[stable] inheritance fallout
A recent change turned off inheritance for the #[stable] by default, but
failed to catch all the cases where this was being used in std. This
patch fixes that problem.
2014-11-14 20:39:41 -08:00
Dan Luu
0f11eb5479 Guide: add a pointer to play.rust-lang.org and explain how to run the code examples. 2014-11-14 22:16:25 -06:00
Liigo Zhuang
8347450ee6 libstd: improve os::args() doc 2014-11-15 10:01:59 +08:00
Corey Richardson
5416901cca librustc: use type parameters less vigorously when giving the IR type names 2014-11-14 19:26:25 -05:00
Corey Ford
ccbda288d2 Hide interactive elements when printing rustdoc
Hide the search form and expand/collapse buttons, since they aren't useful when printed.
2014-11-14 15:48:05 -08:00
bors
d91a015ab4 auto merge of #18894 : ArtemGr/rust/patch-1, r=pnkfelix
A typo about Results being panics crawled in. Fixing it.
2014-11-14 23:37:27 +00:00
Stepan Koltsov
7eae5b4589 impl Default for Cell and RefCell
It is necessary to have #[deriving(Default)] for struct containing
cells like Cell<u32>.
2014-11-14 22:22:42 +03:00
bors
1e4e55aebc auto merge of #18880 : barosl/rust/doc-fail-to-panic, r=alexcrichton
I found some occurrences of "failure" and "fails" in the documentation. I changed them to "panics" if it means a task panic. Otherwise I left it as is, or changed it to "errors" to clearly distinguish them.

Also, I made a minor fix that is breaking the layout of a module page. "Example" is shown in an irrelevant place from the following page: http://doc.rust-lang.org/std/os/index.html
2014-11-14 18:17:28 +00:00
bors
1bf0649544 auto merge of #18893 : bkoropoff/rust/issue-18883, r=alexcrichton
This was a simple case of substitutions being applied inconsistently.  I haven't investigated why type parameters are actually showing up in the closure type here, but trans needs to handle them correctly in any case.
2014-11-14 15:22:28 +00:00
Barosl Lee
94169353ec Improve examples for syntax::ext::deriving::encodable
The examples in the documentation for syntax::ext::deriving::encodable
are outdated, and do not work. To fix this, the following changes are
applied:

- emit_field() -> emit_struct_field()
- read_field() -> read_struct_field()
- Use Result to report errors
- Add the mut keyword to Encoder/Decoder
- Prefer Encodable::encode() to emit_uint
2014-11-15 00:22:21 +09:00
bors
4963afdc7b auto merge of #18891 : erickt/rust/deprecate-as-ref, r=alexcrichton
It seems odd that the `AsRefReader`/`AsRefWriter` have the single method `by_ref()`. This creates the new traits `ByRefReader`/`ByRefWriter` and deprecates the old traits.
2014-11-14 13:17:24 +00:00
Tobias Bucher
eb9684ee19 Add Show and Clone trait to arrays
Due to not being able to parametrize over array sizes, `Clone` is only
implemented for element types that are `Copy`able.
2014-11-14 12:37:59 +01:00
Colin Sherratt
4019118ec2 Added population count assertion in reserve. Cleaned up wrap_index. 2014-11-14 03:41:08 -05:00
Colin Sherratt
5e549d8c3c Manually reset the ringbuffer before or after the ringbuffer push/pop tests. 2014-11-14 03:41:07 -05:00
Colin Sherratt
4cae9add8c Added some extra debug_asserts to ring_buf. 2014-11-14 03:41:07 -05:00
Colin Sherratt
ba24e33021 Handle allocate/reallocate errors in ring_buf
Use is_some() in clear to simplify the clear loop.
2014-11-14 03:41:07 -05:00
Colin Sherratt
7a666df5fa Expand the benchmarking and unit test suite for ring_buf.
-Adds unit tests for fn get() and fn get_mut() which are currently untested
-Adds unit tests to verify growth of the ringbuffer when reserve is called.
-Adds unit tests to confirm that dropping of items is correct
Move ringbuf to use a raw buffer instead of Option<T>
2014-11-14 03:41:07 -05:00
Tom Jakubowski
0053fbb891 serialize: Add ToJson impl for str 2014-11-14 00:38:55 -08:00
bors
bb2168c525 auto merge of #18840 : huonw/rust/tweaks, r=alexcrichton
Fix some old papercuts with diagnostics, e.g. tweaking spans, rewording messages. See individual commits.
2014-11-14 08:17:19 +00:00
Jonathan Reem
93c4942690 Rewrite std::sync::TaskPool to be load balancing and panic-resistant
The previous implementation was very likely to cause panics during
unwinding through this process:

- child panics, drops its receiver
- taskpool comes back around and sends another job over to that child
- the child receiver has hung up, so the taskpool panics on send
- during unwinding, the taskpool attempts to send a quit message to
  the child, causing a panic during unwinding
- panic during unwinding causes a process abort

This meant that TaskPool upgraded any child panic to a full process
abort. This came up in Iron when it caused crashes in long-running
servers.

This implementation uses a single channel to communicate between
spawned tasks and the TaskPool, which significantly reduces the complexity
of the implementation and cuts down on allocation. The TaskPool uses
the channel as a single-producer-multiple-consumer queue.

Additionally, through the use of send_opt and recv_opt instead of
send and recv, this TaskPool is robust on the face of child panics,
both before, during, and after the TaskPool itself is dropped.

Due to the TaskPool no longer using an `init_fn_factory`, this is a

[breaking-change]

otherwise, the API has not changed.

If you used `init_fn_factory` in your code, and this change breaks for
you, you can instead use an `AtomicUint` counter and a channel to
move information into child tasks.
2014-11-13 22:57:33 -08:00
bors
6f7081fad5 auto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichton
This implements a considerable portion of rust-lang/rfcs#369 (tracked in #18640). Some interpretations had to be made in order to get this to work. The breaking changes are listed below:

[breaking-change]

- `core::num::{Num, Unsigned, Primitive}` have been deprecated and their re-exports removed from the `{std, core}::prelude`.
- `core::num::{Zero, One, Bounded}` have been deprecated. Use the static methods on `core::num::{Float, Int}` instead. There is no equivalent to `Zero::is_zero`. Use `(==)` with `{Float, Int}::zero` instead.
- `Signed::abs_sub` has been moved to `std::num::FloatMath`, and is no longer implemented for signed integers.
- `core::num::Signed` has been removed, and its methods have been moved to `core::num::Float` and a new trait, `core::num::SignedInt`. The methods now take the `self` parameter by value.
- `core::num::{Saturating, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}` have been removed, and their methods moved to `core::num::Int`. Their parameters are now taken by value. This means that
- `std::time::Duration` no longer implements `core::num::{Zero, CheckedAdd, CheckedSub}` instead defining the required methods non-polymorphically.
- `core::num::{zero, one, abs, signum}` have been deprecated. Use their respective methods instead.
- The `core::num::{next_power_of_two, is_power_of_two, checked_next_power_of_two}` functions have been deprecated in favor of methods defined a new trait, `core::num::UnsignedInt`
- `core::iter::{AdditiveIterator, MultiplicativeIterator}` are now only implemented for the built-in numeric types.
- `core::iter::{range, range_inclusive, range_step, range_step_inclusive}` now require `core::num::Int` to be implemented for the type they a re parametrized over.
2014-11-14 05:37:17 +00:00
Brendan Zabarauskas
c9e6bda9c7 Revert the need for initial values with arithmetic iterators 2014-11-14 15:35:44 +11:00
Joseph Crail
643edeade9 Remove BTreeSet from all examples. 2014-11-13 22:17:22 -05:00
bors
a58fc68223 auto merge of #18929 : alexcrichton/rust/issue-18928, r=brson
Apparently it's not found on win64!

Closes #18928
2014-11-14 01:52:14 +00:00
bors
b1c84d6be8 auto merge of #18926 : alexcrichton/rust/issue-18925, r=huonw
The subtraction was erroneously backwards, returning negative durations!

Closes #18925
2014-11-13 23:37:21 +00:00
Ricky Taylor
43fd6446ad Make std::io::Buffer object-safe.
[breaking-change]
Any uses of Buffer::lines() and Buffer::chars() will need to use the new trait std::io::BufferPrelude.
2014-11-13 22:38:39 +00:00
Cody P Schafer
fb954a1578 src/etc/snapshot: support triples lacking a vendor 2014-11-13 17:23:02 -05:00
Ian Connolly
769d49a8b7 Don't use rust keyword for fake code 2014-11-13 19:52:08 +00:00
bors
15ba87f031 auto merge of #18887 : aturon/rust/controlled-inherit, r=alexcrichton
This patch tweaks the stability inheritance infrastructure so that
`#{stable]` attributes are not inherited. Doing so solves two problems:

1. It allows us to mark module *names* as stable without accidentally
marking the items they contain as stable.

2. It means that a `#[stable]` attribution must always appear directly
on the item it applies to, which makes it easier for reviewers to catch
changes to stable APIs.

Fixes #17484
2014-11-13 19:32:21 +00:00
Alex Crichton
b73bc79d12 etc: Don't bundle libctl3d32 on windows
Apparently it's not found on win64!

Closes #18928
2014-11-13 09:28:26 -08:00
Alex Crichton
877139495d std: Fix the return value of Duration::span
The subtraction was erroneously backwards, returning negative durations!

Closes #18925
2014-11-13 09:03:33 -08:00
areski
4aa2040cc7 convert 1 line match to 2 lines for readability 2014-11-13 17:58:03 +01:00