Commit Graph

34787 Commits

Author SHA1 Message Date
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
Daniel Hofstetter
e8056a452f Reference: Fix list in Expressions section 2014-11-13 16:05:07 +01:00
bors
37ea270acc auto merge of #18811 : pczarn/rust/issue-18763-ice, r=pnkfelix
Fix ICEs introduced in #17830

* fixed get_tt for doc comments
* properly handle MatchNt in `quote`

Fixes #18763
Fixes #18775
2014-11-13 14:17:10 +00:00
Jorge Aparicio
e5ef55675b fix "warning: deprecated syntax, use for keyword now" 2014-11-13 08:59:44 -05:00
bors
82f383839c auto merge of #18879 : pcwalton/rust/path-silliness, r=aturon
This breaks code like:

    struct Foo {
        x: int,
    }

    let f: Foo = ...;
    ... f.x::<int> ...

Change this code to not contain an unused type parameter. For example:

    struct Foo {
        x: int,
    }

    let f: Foo = ...;
    ... f.x ...

Closes #18680.

[breaking-change]

r? @aturon
2014-11-13 12:27:03 +00:00
bors
f6c0250139 auto merge of #18877 : michaelsproul/rust/panic-tests, r=alexcrichton
I'm fairly sure all these tests refer to task panics. I skim read them all, but there's a small chance I renamed something too eagerly.
2014-11-13 10:37:06 +00:00
bors
5db8381c7e auto merge of #18872 : hirschenberger/rust/master, r=thestinger
Discussed in #18587
2014-11-13 08:17:09 +00:00
bors
e2cd4765fb auto merge of #18867 : michaelsproul/rust/unreachable-formatting, r=pcwalton
Closes #18842.
2014-11-13 06:12:10 +00:00
Huon Wilson
661598cef0 Use the correct span for out-of-range int literals.
This corrects the error message to point at the literal, not the next
token.

Closes #17123.
2014-11-13 13:43:01 +11:00
Huon Wilson
26282ac337 Add more "help: ..."'s to the parser.
Adds a method for printing a fatal error and also a help message to the
parser and uses this in a variety of places to improve error messages.

Closes #12213.
2014-11-13 13:43:00 +11:00
Huon Wilson
e621e3216b Add error message specific to \<carriage return>.
This can crop-up with a misconfigured editor or an unexpected
interaction between version control and certain operating systems.

Closes #11669.
2014-11-13 13:43:00 +11:00
Huon Wilson
ceff2ca1fc Tweak and add test for detecting libraries with mismatching target triples.
Closes #10814.
2014-11-13 13:40:25 +11:00
bors
6a62ad3e29 auto merge of #18862 : murarth/rust/issue-18566-test, r=alexcrichton 2014-11-13 02:37:05 +00:00
bors
5745e41950 auto merge of #18858 : alexcrichton/rust/remove-time, r=jakub
This commit deprecates the entire libtime library in favor of the
externally-provided libtime in the rust-lang organization. Users of the
`libtime` crate as-is today should add this to their Cargo manifests:

    [dependencies.time]
    git = "https://github.com/rust-lang/time"

To implement this transition, a new function `Duration::span` was added to the
`std::time::Duration` time. This function takes a closure and then returns the
duration of time it took that closure to execute. This interface will likely
improve with `FnOnce` unboxed closures as moving in and out will be a little
easier.

Due to the deprecation of the in-tree crate, this is a:

[breaking-change]

cc #18855, some of the conversions in the `src/test/bench` area may have been a
little nicer with that implemented
2014-11-12 22:57:16 +00:00
Tobias Bucher
59b3c83a81 Fix Vec::map_in_place not doing what is written in the comment 2014-11-12 23:34:32 +01:00
bors
7a86aa83ee auto merge of #18907 : alexcrichton/rust/snapshots, r=jakub-,jakub 2014-11-12 21:07:09 +00:00
Alex Crichton
065e39bb2f Register new snapshots 2014-11-12 12:17:55 -08:00
bors
e1149f0223 auto merge of #18830 : adaszko/rust/patch-1, r=steveklabnik 2014-11-12 17:22:05 +00:00
Alex Crichton
fcd05ed99f time: Deprecate the library in the distribution
This commit deprecates the entire libtime library in favor of the
externally-provided libtime in the rust-lang organization. Users of the
`libtime` crate as-is today should add this to their Cargo manifests:

    [dependencies.time]
    git = "https://github.com/rust-lang/time"

To implement this transition, a new function `Duration::span` was added to the
`std::time::Duration` time. This function takes a closure and then returns the
duration of time it took that closure to execute. This interface will likely
improve with `FnOnce` unboxed closures as moving in and out will be a little
easier.

Due to the deprecation of the in-tree crate, this is a:

[breaking-change]

cc #18855, some of the conversions in the `src/test/bench` area may have been a
little nicer with that implemented
2014-11-12 09:18:35 -08:00
Brendan Zabarauskas
064e84e30b Fix stability_summary fallout 2014-11-13 03:46:39 +11:00
Brendan Zabarauskas
de938b6ca1 Remove Signed trait and add SignedInt trait
The methods have been moved into Float and SignedInt
2014-11-13 03:46:03 +11:00
Brendan Zabarauskas
e965ba85ca Remove lots of numeric traits from the preludes
Num, NumCast, Unsigned, Float, Primitive and Int have been removed.
2014-11-13 03:46:03 +11:00
Steve Klabnik
607eb12ab7 Fix po4a.conf 2014-11-12 11:34:00 -05:00
Brendan Zabarauskas
891559e30d Clean up core::num doc comments 2014-11-13 02:04:31 +11:00
Brendan Zabarauskas
878bebfb63 Deprecate signum wrapper and clean up signed impls 2014-11-13 02:04:31 +11:00
Brendan Zabarauskas
26196715e8 Deprecate Num, Unsigned and Primitive 2014-11-13 02:04:31 +11:00
Brendan Zabarauskas
46333d527b Deprecate Zero and One traits 2014-11-13 02:04:31 +11:00
Brendan Zabarauskas
0da49dcf13 Deprecate Bounded trait 2014-11-13 02:02:44 +11:00
Brendan Zabarauskas
e51cc089da Move checked arithmetic operators into Int trait 2014-11-13 02:02:44 +11:00
Brendan Zabarauskas
7e57cd843c Rejig Int impl macros
This should make implementing the checked operator methods easier
2014-11-13 02:02:44 +11:00
Brendan Zabarauskas
d431a67cec Move saturating operator methods into Int 2014-11-13 02:02:44 +11:00
Brendan Zabarauskas
d1eb68e8d7 Create UnsignedInt trait and deprecate free functions 2014-11-13 02:02:44 +11:00