]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorollup merge of #19577: aidancully/master
Alex Crichton [Tue, 9 Dec 2014 17:24:39 +0000 (09:24 -0800)]
rollup merge of #19577: aidancully/master

pthread_key_create can be 0.
addresses issue #19567.

9 years agorollup merge of #19576: nhoss2/master
Alex Crichton [Tue, 9 Dec 2014 17:24:38 +0000 (09:24 -0800)]
rollup merge of #19576: nhoss2/master

There was a link to a non existing guide

9 years agoauto merge of #19466 : nikomatsakis/rust/recursion-limit, r=eddyb
bors [Tue, 9 Dec 2014 14:02:45 +0000 (14:02 +0000)]
auto merge of #19466 : nikomatsakis/rust/recursion-limit, r=eddyb

This is particularly important for deeply nested types, which generate deeply nested impls. This is a fix for #19318. It's possible we could also improve this particular case not to increment the recursion count, but it's worth being able to adjust the recursion limit anyhow.

cc @jdm
r? @pcwalton

9 years agoauto merge of #19249 : barosl/rust/json-type-safety, r=alexcrichton
bors [Tue, 9 Dec 2014 10:51:49 +0000 (10:51 +0000)]
auto merge of #19249 : barosl/rust/json-type-safety, r=alexcrichton

This pull request tries to improve type safety of `serialize::json::Encoder`.

Looking at #18319, I decided to test some JSON implementations in other languages. The results are as follows:

* Encoding to JSON

| Language | 111111111111111111 | 1.0 |
| --- | --- | --- |
| JavaScriptâ„¢ | "111111111111111100" | "1" |
| Python | "111111111111111111" | **"1.0"** |
| Go | "111111111111111111" | "1" |
| Haskell | "111111111111111111" | "1" |
| Rust | **"111111111111111104"** | "1" |

* Decoding from JSON

| Language | "1" | "1.0" | "1.6" |
| --- | --- | --- | --- |
| JavaScriptâ„¢ | 1 (Number) | 1 (Number) | 1.6 (Number) |
| Python | 1 (int) | 1.0 (float) | 1.6 (float) |
| Go | **1 (float64)** | 1 (float64) | 1.6 (float64) |
| Go (expecting `int`) | 1 (int) | **error** | error |
| Haskell (with `:: Int`) | 1 (Int) | 1 (Int) | **2 (Int)** |
| Haskell (with `:: Double`) | 1.0 (Double) | 1.0 (Double) | 1.6 (Double) |
| Rust (with `::<int>`) | 1 (int) | 1 (Int) | **1 (Int)** |
| Rust (with `::<f64>`) | 1 (f64) | 1 (f64) | 1.6 (f64) |

* The tests on Haskell were done using the [json](http://hackage.haskell.org/package/json) package.
* The error message printed by Go was: `cannot unmarshal number 1.0 into Go value of type int`

As you see, there is no uniform behavior. Every implementation follows its own principle. So I think it is reasonable to find a desirable set of behaviors for Rust.

Firstly, every implementation except the one for JavaScript is capable of handling `i64` values. It is even practical, because [Twitter API uses an i64 number to represent a tweet ID](https://dev.twitter.com/overview/api/twitter-ids-json-and-snowflake), although it is recommended to use the string version of the ID.

Secondly, looking into the Go's behavior, implicit type conversion is not allowed in their decoder. If the user expects an integer value to follow, decoding a float value will raise an error. This behavior is desirable in Rust, because we are pleased to follow the principles of strong typing.

Thirdly, Python's JSON module forces a decimal point to be printed even if the fractional part does not exist. This eases the distinction of a float value from an integer value in JSON, because by the spec there is only one type to represent numbers, `Number`.

So, I suggest the following three breaking changes:

1. Remove float preprocessing in serialize::json::Encoder

 `serialize::json::Encoder` currently uses `f64` to emit any integral type. This is possibly due to the behavior of JavaScript, which uses `f64` to represent any numeric value.

 This leads to a problem that only the integers in the range of [-2^53+1, 2^53-1] can be encoded. Therefore, `i64` and `u64` cannot be used reliably in the current implementation.

 [RFC 7159](http://tools.ietf.org/html/rfc7159) suggests that good interoperability can be achieved if the range is respected by implementations. However, it also says that implementations are allowed to set the range of number accepted. And it seems that the JSON encoders outside of the JavaScript world usually make use of `i64` values.

 This commit removes the float preprocessing done in the `emit_*` methods. It also increases performance, because transforming `f64` into String costs more than that of an integral type.

 Fixes #18319

2. Do not coerce to integer when decoding a float value

 When an integral value is expected by the user but a fractional value is found, the current implementation uses `std::num::cast()` to coerce to an integer type, losing the fractional part. This behavior is not desirable because the number loses precision without notice.

 This commit makes it raise `ExpectedError` when such a situation arises.

3. Always use a decimal point when emitting a float value

 JSON doesn't distinguish between integer and float. They are just numbers. Also, in the current implementation, a fractional number without the fractional part is encoded without a decimal point.

 Thereforce, when the value is decoded, it is first rendered as `Json`, either `I64` or `U64`. This reduces type safety, because while the original intention was to cast the value to float, it can also be casted to integer.

 As a workaround of this problem, this commit makes the encoder always emit a decimal point even if it is not necessary. If the fractional part of a float number is zero, ".0" is padded to the end of the result.

9 years agoauto merge of #19644 : pcwalton/rust/oibit3, r=nikomatsakis
bors [Tue, 9 Dec 2014 07:51:52 +0000 (07:51 +0000)]
auto merge of #19644 : pcwalton/rust/oibit3, r=nikomatsakis

9 years agoAdd some missing Copy implementations
Patrick Walton [Mon, 8 Dec 2014 22:07:33 +0000 (14:07 -0800)]
Add some missing Copy implementations

9 years agoauto merge of #19645 : alexcrichton/rust/old-snap, r=brson
bors [Tue, 9 Dec 2014 05:01:53 +0000 (05:01 +0000)]
auto merge of #19645 : alexcrichton/rust/old-snap, r=brson

The most recent snapshot was produced on OSX 10.8, but this segfaults on OSX
10.7 so we need to roll back one snapshot so we can start bootstrapping on 10.7
systems again.

cc #19643

9 years agoRevert "Register new snapshots"
Alex Crichton [Mon, 8 Dec 2014 22:30:13 +0000 (14:30 -0800)]
Revert "Register new snapshots"

This reverts commit 9b443289cf32cbcff16768614340f0c844675340.

9 years agoauto merge of #19456 : nikomatsakis/rust/reborrow-closure-arg, r=pnkfelix
bors [Mon, 8 Dec 2014 21:31:51 +0000 (21:31 +0000)]
auto merge of #19456 : nikomatsakis/rust/reborrow-closure-arg, r=pnkfelix

Otherwise region inference can fail when closure arguments include `ref` bindings. Test case included in the PR.

9 years agoLink regions in `ref` bindings from fn arguments.
Niko Matsakis [Tue, 2 Dec 2014 07:42:11 +0000 (02:42 -0500)]
Link regions in `ref` bindings from fn arguments.

9 years agoStop masking overflow and propagate it out more aggressively; also improve error...
Niko Matsakis [Tue, 2 Dec 2014 19:04:10 +0000 (14:04 -0500)]
Stop masking overflow and propagate it out more aggressively; also improve error reporting to suggest to user how to fix.

9 years agoKill dead code
Niko Matsakis [Tue, 2 Dec 2014 18:28:59 +0000 (13:28 -0500)]
Kill dead code

9 years agoAdd ability to configure recursion limit.
Niko Matsakis [Tue, 2 Dec 2014 17:57:38 +0000 (12:57 -0500)]
Add ability to configure recursion limit.

Fixes #19318.

9 years agoAdd a feature opt `opt_out_copy` that allows people to revert to the older
Niko Matsakis [Mon, 8 Dec 2014 18:21:35 +0000 (13:21 -0500)]
Add a feature opt `opt_out_copy` that allows people to revert to the older
behavior temporarily. This feature will eventually transition to REJECTED.

9 years agolibrustc: Make `Copy` opt-in.
Niko Matsakis [Sat, 6 Dec 2014 01:01:33 +0000 (17:01 -0800)]
librustc: Make `Copy` opt-in.

This change makes the compiler no longer infer whether types (structures
and enumerations) implement the `Copy` trait (and thus are implicitly
copyable). Rather, you must implement `Copy` yourself via `impl Copy for
MyType {}`.

A new warning has been added, `missing_copy_implementations`, to warn
you if a non-generic public type has been added that could have
implemented `Copy` but didn't.

For convenience, you may *temporarily* opt out of this behavior by using
`#![feature(opt_out_copy)]`. Note though that this feature gate will never be
accepted and will be removed by the time that 1.0 is released, so you should
transition your code away from using it.

This breaks code like:

    #[deriving(Show)]
    struct Point2D {
        x: int,
        y: int,
    }

    fn main() {
        let mypoint = Point2D {
            x: 1,
            y: 1,
        };
        let otherpoint = mypoint;
        println!("{}{}", mypoint, otherpoint);
    }

Change this code to:

    #[deriving(Show)]
    struct Point2D {
        x: int,
        y: int,
    }

    impl Copy for Point2D {}

    fn main() {
        let mypoint = Point2D {
            x: 1,
            y: 1,
        };
        let otherpoint = mypoint;
        println!("{}{}", mypoint, otherpoint);
    }

This is the backwards-incompatible part of #13231.

Part of RFC #3.

[breaking-change]

9 years agoauto merge of #19574 : erickt/rust/vec-reserve, r=alexcrichton
bors [Mon, 8 Dec 2014 18:42:21 +0000 (18:42 +0000)]
auto merge of #19574 : erickt/rust/vec-reserve, r=alexcrichton

(I don't understand why this works, and so I don't quite trust this yet. I'm pushing it up to see if anyone else can replicate this performance increase)

Somehow llvm is able to optimize this version of Vec::reserve into dramatically faster than the old version. In micro-benchmarks this was 2-10 times faster. It also reduce my Rust compile time from 41 minutes to 27 minutes.

Closes #19281.

9 years agoauto merge of #19306 : steveklabnik/rust/gh19269, r=nikomatsakis,brson
bors [Mon, 8 Dec 2014 16:22:43 +0000 (16:22 +0000)]
auto merge of #19306 : steveklabnik/rust/gh19269, r=nikomatsakis,brson

Fixes #19269.

/cc @thestinger @mahkoh @mitsuhiko

9 years agoauto merge of #19560 : sfackler/rust/should-fail-reason, r=alexcrichton
bors [Mon, 8 Dec 2014 12:12:23 +0000 (12:12 +0000)]
auto merge of #19560 : sfackler/rust/should-fail-reason, r=alexcrichton

The test harness will make sure that the panic message contains the
specified string. This is useful to help make `#[should_fail]` tests a
bit less brittle by decreasing the chance that the test isn't
"accidentally" passing due to a panic occurring earlier than expected.
The behavior is in some ways similar to JUnit's `expected` feature:
`@Test(expected=NullPointerException.class)`.

Without the message assertion, this test would pass even though it's not
actually reaching the intended part of the code:
```rust
#[test]
#[should_fail(message = "out of bounds")]
fn test_oob_array_access() {
    let idx: uint = from_str("13o").unwrap(); // oops, this will panic
    [1i32, 2, 3][idx];
}
```

9 years agolibserialize: Prefer into_string() to to_string() wherever possible
Barosl Lee [Mon, 8 Dec 2014 09:16:09 +0000 (18:16 +0900)]
libserialize: Prefer into_string() to to_string() wherever possible

Except for the example code!

9 years agolibserialize: Code cleanup
Barosl Lee [Sun, 23 Nov 2014 18:32:31 +0000 (03:32 +0900)]
libserialize: Code cleanup

9 years agolibserialize: Always use a decimal point when emitting a float value
Barosl Lee [Sun, 23 Nov 2014 18:14:02 +0000 (03:14 +0900)]
libserialize: Always use a decimal point when emitting a float value

JSON doesn't distinguish between integer and float. They are just
numbers. Also, in the current implementation, a fractional number
without the fractional part is encoded without a decimal point.

Thereforce, when the value is decoded, it is first rendered as Json,
either I64 or U64. This reduces type safety, because while the original
intention was to cast the value to float, it can also be casted to
integer.

As a workaround of this problem, this commit makes the encoder always
emit a decimal point even if it is not necessary. If the fractional part
of a float number is zero, ".0" is padded to the end of the result.

[breaking-change]

9 years agoauto merge of #19506 : eddyb/rust/fmt-polish, r=alexcrichton
bors [Mon, 8 Dec 2014 09:02:33 +0000 (09:02 +0000)]
auto merge of #19506 : eddyb/rust/fmt-polish, r=alexcrichton

9 years agolibserialize: Do not coerce to integer when decoding a float value
Barosl Lee [Sun, 23 Nov 2014 18:00:10 +0000 (03:00 +0900)]
libserialize: Do not coerce to integer when decoding a float value

When an integral value is expected by the user but a fractional value is
found, the current implementation uses std::num::cast() to coerce to an
integer type, losing the fractional part. This behavior is not desirable
because the number loses precision without notice.

This commit makes it raise ExpectedError when such a situation arises.

[breaking-change]

9 years agolibserialize: Remove float preprocessing in serialize::json::Encoder
Barosl Lee [Sun, 23 Nov 2014 17:22:30 +0000 (02:22 +0900)]
libserialize: Remove float preprocessing in serialize::json::Encoder

serialize::json::Encoder currently uses f64 to emit any integral type.
This is possibly due to the behavior of JavaScript, which uses f64 to
represent any numeric value.

This leads to a problem that only the integers in the range of [-2^53+1,
2^53-1] can be encoded. Therefore, i64 and u64 cannot be used reliably
in the current implementation.

RFC 7159 suggests that good interoperability can be achieved if the
range is respected by implementations. However, it also says that
implementations are allowed to set the range of number accepted. And it
seems that the JSON encoders outside of the JavaScript world usually
make use of i64 values.

This commit removes the float preprocessing done in the emit_* methods.
It also increases performance, because transforming f64 into String
costs more than that of an integral type.

Fixes #18319

[breaking-change]

9 years agotest: adjust pretty/issue-4264 for formatting changes.
Eduard Burtescu [Mon, 8 Dec 2014 07:14:00 +0000 (09:14 +0200)]
test: adjust pretty/issue-4264 for formatting changes.

9 years agocore: make the public fmt API completely safe.
Eduard Burtescu [Wed, 3 Dec 2014 20:56:39 +0000 (22:56 +0200)]
core: make the public fmt API completely safe.

9 years agocore: remove the dead function fmt::argumentstr.
Eduard Burtescu [Wed, 3 Dec 2014 20:46:09 +0000 (22:46 +0200)]
core: remove the dead function fmt::argumentstr.

9 years agoauto merge of #19555 : jbranchaud/rust/add-doctests-for-key-values-of-btreemap, r...
bors [Mon, 8 Dec 2014 05:52:28 +0000 (05:52 +0000)]
auto merge of #19555 : jbranchaud/rust/add-doctests-for-key-values-of-btreemap, r=Gankro

9 years agoauto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichton
bors [Mon, 8 Dec 2014 02:32:31 +0000 (02:32 +0000)]
auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichton

Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns:

- `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")`
- `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")`
- `vec.as_mut_slice().sort()` -> `vec.sort()`
- `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)`

---

Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation.

This is rebased on top of #19167

cc @alexcrichton @aturon

9 years agoauto merge of #19561 : csouth3/rust/treeset-bitops, r=Gankro
bors [Mon, 8 Dec 2014 00:12:30 +0000 (00:12 +0000)]
auto merge of #19561 : csouth3/rust/treeset-bitops, r=Gankro

Implement the `BitOr`, `BitAnd`, `BitXor`, and `Sub` traits from `std::ops` for TreeSet.  The behavior of these operator overloads is consistent with [RFC 235](https://github.com/rust-lang/rfcs/blob/master/text/0235-collections-conventions.md#combinations).

r? @Gankro

9 years agoMention expected in testing docs
Steven Fackler [Sat, 6 Dec 2014 23:33:33 +0000 (15:33 -0800)]
Mention expected in testing docs

9 years agoauto merge of #19548 : luqmana/rust/mfb, r=nikomatsakis
bors [Sun, 7 Dec 2014 19:02:18 +0000 (19:02 +0000)]
auto merge of #19548 : luqmana/rust/mfb, r=nikomatsakis

Fixes #19367.

9 years agoauto merge of #19539 : cmr/rust/18959, r=nikomatsakis
bors [Sun, 7 Dec 2014 16:12:22 +0000 (16:12 +0000)]
auto merge of #19539 : cmr/rust/18959, r=nikomatsakis

Closes #18959

Technically, this causes code that once compiled to no longer compile, but
that code probably never ran.

[breaking-change]

------------

Not quite sure the error message is good enough, I feel like it ought to tell you "because it inherits from non-object-safe trait Foo", so I've opened up a follow-up issue #19538

9 years agoFix syntax error on android tests
Jorge Aparicio [Sun, 7 Dec 2014 13:49:17 +0000 (08:49 -0500)]
Fix syntax error on android tests

9 years agoauto merge of #19522 : mukilan/rust/import-conflicts-item, r=cmr
bors [Sun, 7 Dec 2014 13:42:18 +0000 (13:42 +0000)]
auto merge of #19522 : mukilan/rust/import-conflicts-item, r=cmr

Fixes #19498

9 years agoauto merge of #19488 : jbranchaud/rust/add-btree-set-doctests, r=alexcrichton
bors [Sun, 7 Dec 2014 07:12:16 +0000 (07:12 +0000)]
auto merge of #19488 : jbranchaud/rust/add-btree-set-doctests, r=alexcrichton

There is already a test for `union` in the test namespace, but this commit adds a doctest that will appear in the rustdocs.

Someone on IRC said, *Write doctests!*, so here I am.

I am not sure this is the best way to demonstrate the behavior of the union function, so I am open to suggestions for improving this. If I am on the right track I'd be glad to include similar doctests for `intersection`, `difference`, etc.

9 years agolibtime: remove unnecessary `to_string()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:58:14 +0000 (19:58 -0500)]
libtime: remove unnecessary `to_string()` calls

9 years agolibtest: remove unnecessary `to_string()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:55:37 +0000 (19:55 -0500)]
libtest: remove unnecessary `to_string()` calls

9 years agolibterm: remove unnecessary `to_string()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:53:58 +0000 (19:53 -0500)]
libterm: remove unnecessary `to_string()` calls

9 years agolibsyntax: remove unnecessary `to_string()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:52:53 +0000 (19:52 -0500)]
libsyntax: remove unnecessary `to_string()` calls

9 years agolibstd: remove unnecessary `to_string()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:45:47 +0000 (19:45 -0500)]
libstd: remove unnecessary `to_string()` calls

9 years agolibserialize: remove unnecessary `to_string()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:36:41 +0000 (19:36 -0500)]
libserialize: remove unnecessary `to_string()` calls

9 years agolibrustc_back: remove unnecessary `to_string()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:23:53 +0000 (19:23 -0500)]
librustc_back: remove unnecessary `to_string()` calls

9 years agolibgetopts: remove unnecessary `to_string()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:18:54 +0000 (19:18 -0500)]
libgetopts: remove unnecessary `to_string()` calls

9 years agolibcollections: remove unnecessary `to_string()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:09:59 +0000 (19:09 -0500)]
libcollections: remove unnecessary `to_string()` calls

9 years agolibtest: remove unnecessary `as_mut_slice()` calls
Jorge Aparicio [Fri, 28 Nov 2014 00:00:21 +0000 (19:00 -0500)]
libtest: remove unnecessary `as_mut_slice()` calls

9 years agolibstd: remove unnecessary `as_mut_slice` calls
Jorge Aparicio [Thu, 27 Nov 2014 21:50:34 +0000 (16:50 -0500)]
libstd: remove unnecessary `as_mut_slice` calls

9 years agolibrustdoc: remove unnecessary `as_mut_slice` calls
Jorge Aparicio [Thu, 27 Nov 2014 21:49:29 +0000 (16:49 -0500)]
librustdoc: remove unnecessary `as_mut_slice` calls

9 years agolibrustc_trans: remove unnecessary `as_mut_slice` calls
Jorge Aparicio [Thu, 27 Nov 2014 21:49:02 +0000 (16:49 -0500)]
librustc_trans: remove unnecessary `as_mut_slice` calls

9 years agolibrustc: remove unnecessary `as_mut_slice` calls
Jorge Aparicio [Thu, 27 Nov 2014 21:47:48 +0000 (16:47 -0500)]
librustc: remove unnecessary `as_mut_slice` calls

9 years agolibcollections: remove unnecessary `as_mut_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 21:44:57 +0000 (16:44 -0500)]
libcollections: remove unnecessary `as_mut_slice()` calls

9 years agolibtest: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 20:06:09 +0000 (15:06 -0500)]
libtest: remove unnecessary `as_slice()` calls

9 years agolibterm: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 20:03:37 +0000 (15:03 -0500)]
libterm: remove unnecessary `as_slice()` calls

9 years agolibsyntax: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 20:00:50 +0000 (15:00 -0500)]
libsyntax: remove unnecessary `as_slice()` calls

9 years agolibstd: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 19:43:55 +0000 (14:43 -0500)]
libstd: remove unnecessary `as_slice()` calls

9 years agoauto merge of #19407 : frewsxcv/rust/rm-reexports, r=cmr
bors [Sun, 7 Dec 2014 04:12:20 +0000 (04:12 +0000)]
auto merge of #19407 : frewsxcv/rust/rm-reexports, r=cmr

In regards to:

https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729

This commit:

* Changes the #deriving code so that it generates code that utilizes fewer
  reexports (in particur Option::\*, Result::\*, and Ordering::\*), which is necessary to
  remove those reexports in the future
* Changes other areas of the codebase so that fewer reexports are utilized

9 years agoAdd compile-fail tests for #19498
Mukilan Thiyagarajan [Sun, 7 Dec 2014 01:51:58 +0000 (07:21 +0530)]
Add compile-fail tests for #19498

9 years agolibserialize: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 19:28:51 +0000 (14:28 -0500)]
libserialize: remove unnecessary `as_slice()` calls

9 years agolibrustdoc: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 19:19:27 +0000 (14:19 -0500)]
librustdoc: remove unnecessary `as_slice()` calls

9 years agolibrustc_trans: remove unnecessary `as_slice` calls
Jorge Aparicio [Thu, 27 Nov 2014 19:10:25 +0000 (14:10 -0500)]
librustc_trans: remove unnecessary `as_slice` calls

9 years agolibrustc_back: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:57:31 +0000 (13:57 -0500)]
librustc_back: remove unnecessary `as_slice()` calls

9 years agolibrustc: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:53:34 +0000 (13:53 -0500)]
librustc: remove unnecessary `as_slice()` calls

9 years agolibregex_macros: remove unnecessary `as_slice` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:28:57 +0000 (13:28 -0500)]
libregex_macros: remove unnecessary `as_slice` calls

9 years agolibregex: remove unnecessary `as_slice` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:27:19 +0000 (13:27 -0500)]
libregex: remove unnecessary `as_slice` calls

9 years agoliblog: remove unnecessary `as_slice` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:21:31 +0000 (13:21 -0500)]
liblog: remove unnecessary `as_slice` calls

9 years agolibgraphviz: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:19:57 +0000 (13:19 -0500)]
libgraphviz: remove unnecessary `as_slice()` calls

9 years agolibgetops: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:18:39 +0000 (13:18 -0500)]
libgetops: remove unnecessary `as_slice()` calls

9 years agolibfmt_macros: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:15:18 +0000 (13:15 -0500)]
libfmt_macros: remove unnecessary `as_slice()` calls

9 years agolibflate: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:14:37 +0000 (13:14 -0500)]
libflate: remove unnecessary `as_slice()` calls

9 years agolibcoretest: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:12:30 +0000 (13:12 -0500)]
libcoretest: remove unnecessary `as_slice()` calls

9 years agoliballoc: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 18:03:07 +0000 (13:03 -0500)]
liballoc: remove unnecessary `as_slice()` calls

9 years agolibcollections: remove unnecessary `as_slice()` calls
Jorge Aparicio [Thu, 27 Nov 2014 16:45:50 +0000 (11:45 -0500)]
libcollections: remove unnecessary `as_slice()` calls

9 years agoChange from message to expected
Steven Fackler [Sat, 6 Dec 2014 23:16:38 +0000 (15:16 -0800)]
Change from message to expected

9 years agoAllow message specification for should_fail
Steven Fackler [Fri, 5 Dec 2014 07:02:36 +0000 (23:02 -0800)]
Allow message specification for should_fail

The test harness will make sure that the panic message contains the
specified string. This is useful to help make `#[should_fail]` tests a
bit less brittle by decreasing the chance that the test isn't
"accidentally" passing due to a panic occurring earlier than expected.
The behavior is in some ways similar to JUnit's `expected` feature:
`@Test(expected=NullPointerException.class)`.

Without the message assertion, this test would pass even though it's not
actually reaching the intended part of the code:
```rust
 #[test]
 #[should_fail(message = "out of bounds")]
fn test_oob_array_access() {
    let idx: uint = from_str("13o").unwrap(); // oops, this will panic
    [1i32, 2, 3][idx];
}
```

9 years agoauto merge of #19579 : alexcrichton/rust/snapshots, r=nikomatsakis
bors [Sat, 6 Dec 2014 23:12:17 +0000 (23:12 +0000)]
auto merge of #19579 : alexcrichton/rust/snapshots, r=nikomatsakis

9 years agoauto merge of #19431 : erickt/rust/buf-writer-error, r=alexcrichton
bors [Sat, 6 Dec 2014 20:12:13 +0000 (20:12 +0000)]
auto merge of #19431 : erickt/rust/buf-writer-error, r=alexcrichton

Previously, `BufWriter::write` would just return an `std::io::OtherIoError` if someone attempted to write past the end of the wrapped buffer. This pull request changes the error to support partial writes and return a `std::io::ShortWrite`, or an `io::io::EndOfFile` if it's been fully exhausted.

 I've also optimized away a bounds check inside `BufWriter::write`, which should help shave off some nanoseconds in an inner loops.

9 years agoauto merge of #19590 : sfackler/rust/fix-android, r=sfackler
bors [Sat, 6 Dec 2014 17:42:16 +0000 (17:42 +0000)]
auto merge of #19590 : sfackler/rust/fix-android, r=sfackler

Seems to be blocking forever

9 years agoIgnore wait-forked-but-failed-child
Steven Fackler [Sat, 6 Dec 2014 06:58:04 +0000 (22:58 -0800)]
Ignore wait-forked-but-failed-child

Test will be fixed in #19588

9 years agorustc: check supertraits for object safety
Corey Richardson [Thu, 27 Nov 2014 16:28:51 +0000 (11:28 -0500)]
rustc: check supertraits for object safety

Closes #18959

Technically, this causes code that once compiled to no longer compile, but
that code probably never ran.

[breaking-change]

9 years agoIgnore issue #16671 test on android
Steven Fackler [Sat, 6 Dec 2014 04:22:35 +0000 (20:22 -0800)]
Ignore issue #16671 test on android

Seems to be blocking forever

9 years agoImplement BitOps for TreeSet
Chase Southwood [Fri, 5 Dec 2014 07:14:43 +0000 (01:14 -0600)]
Implement BitOps for TreeSet

9 years agoprefer "FIXME" to "TODO".
Aidan Cully [Fri, 5 Dec 2014 23:39:58 +0000 (18:39 -0500)]
prefer "FIXME" to "TODO".

9 years agoRegister new snapshots
Alex Crichton [Fri, 5 Dec 2014 23:21:03 +0000 (15:21 -0800)]
Register new snapshots

9 years agoUtilize fewer reexports
Corey Farwell [Fri, 28 Nov 2014 16:57:41 +0000 (11:57 -0500)]
Utilize fewer reexports

In regards to:

https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729

This commit:

* Changes the #deriving code so that it generates code that utilizes fewer
  reexports (in particur Option::* and Result::*), which is necessary to
  remove those reexports in the future
* Changes other areas of the codebase so that fewer reexports are utilized

9 years agoAdd doctests for union, diff, sym_diff, and intersection.
jbranchaud [Wed, 3 Dec 2014 04:59:24 +0000 (22:59 -0600)]
Add doctests for union, diff, sym_diff, and intersection.

Add a rustdoc test for union to exhibit how it is used.

There is already a test for union in the test namespace, but this commit
adds a doctest that will appear in the rustdocs.

Add a doctest for the difference function.

Add a doctest for the symmetric_difference function.

Add a doctest for the intersection function.

Update the union et al. doctests based on @Gankro's comments.

Make the union et al. doctests a bit more readable.

9 years agowork around portability issue on FreeBSD, in which the key returned from
Aidan Cully [Fri, 5 Dec 2014 22:20:44 +0000 (17:20 -0500)]
work around portability issue on FreeBSD, in which the key returned from
pthread_key_create can be 0.

9 years agofix 404
Nafis [Fri, 5 Dec 2014 22:17:49 +0000 (08:17 +1000)]
fix 404

9 years agoAdd doctests for keys() and values() of the BTreeMap collection.
jbranchaud [Fri, 5 Dec 2014 06:10:58 +0000 (00:10 -0600)]
Add doctests for keys() and values() of the BTreeMap collection.

Update keys() and values() for BTreeMap based on @Gankro's comments.

Assign keys and values to variables before doing assertion.

9 years agoauto merge of #19508 : cmr/rust/rollup-2014_12_03, r=cmr
bors [Fri, 5 Dec 2014 20:23:10 +0000 (20:23 +0000)]
auto merge of #19508 : cmr/rust/rollup-2014_12_03, r=cmr

9 years agocollections: dramatically speed up Vec::reserve with magic
Erick Tryzelaar [Fri, 5 Dec 2014 19:29:15 +0000 (11:29 -0800)]
collections: dramatically speed up Vec::reserve with magic

Somehow llvm is able to optimize this version of Vec::reserve
into dramatically faster than the old version. In micro-benchmarks
this was 2-10 times faster. It also shaved 14 minutes off of
rust's compile times.

Closes #19281.

9 years agoMerge remote-tracking branch 'csouth3/trieset-bitops' into rollup-2014_12_03
Corey Richardson [Fri, 5 Dec 2014 19:19:50 +0000 (11:19 -0800)]
Merge remote-tracking branch 'csouth3/trieset-bitops' into rollup-2014_12_03

Conflicts:
src/libcollections/trie/set.rs

9 years agolibrustc: Don't reuse same alloca for match on struct/tuple field which we reassign...
Luqman Aden [Fri, 5 Dec 2014 02:32:02 +0000 (21:32 -0500)]
librustc: Don't reuse same alloca for match on struct/tuple field which we reassign to in match body.

9 years agoImplement BitOps for TrieSet
Chase Southwood [Thu, 4 Dec 2014 06:35:38 +0000 (00:35 -0600)]
Implement BitOps for TrieSet

9 years agorollup merge of #19553: sfackler/issue-19543
Corey Richardson [Fri, 5 Dec 2014 18:08:33 +0000 (10:08 -0800)]
rollup merge of #19553: sfackler/issue-19543

Closes #19543

9 years agorollup merge of #19534: scialex/liballoc-cfg
Corey Richardson [Fri, 5 Dec 2014 18:08:28 +0000 (10:08 -0800)]
rollup merge of #19534: scialex/liballoc-cfg

Adds the ability to use a custom allocator heap by passing either --cfg
external_crate and --extern external=<allocator_crate_name> or --cfg
external_funcs and defining the allocator functions prefixed by 'rust_'
somewhere.

This is useful for many applications including OS/embedded development,
and allocator development and testing.

9 years agorollup merge of #19530: aochagavia/remove-test
Corey Richardson [Fri, 5 Dec 2014 18:08:26 +0000 (10:08 -0800)]
rollup merge of #19530: aochagavia/remove-test

Fixes https://github.com/rust-lang/rust/issues/19510

9 years agorollup merge of #19528: aliblong/add_vecmap_capacity
Corey Richardson [Fri, 5 Dec 2014 18:08:24 +0000 (10:08 -0800)]
rollup merge of #19528: aliblong/add_vecmap_capacity

Part of #18424

Adds `capacity()` function to VecMap, as per the collections reform.

(Salvaged from #19516, #19523, while we await an RFC regarding `reserve`/`reserve_index` for `VecMap`)

9 years agorollup merge of #19526: steveklabnik/gh19402
Corey Richardson [Fri, 5 Dec 2014 18:07:49 +0000 (10:07 -0800)]
rollup merge of #19526: steveklabnik/gh19402

Fixes #19402.

9 years agorollup merge of #19525: steveklabnik/guide_edits
Corey Richardson [Fri, 5 Dec 2014 18:07:48 +0000 (10:07 -0800)]
rollup merge of #19525: steveklabnik/guide_edits

Fixes #19335. (or at least, the actionable parts)

9 years agorollup merge of #19520: csouth3/derefmut-unsized
Corey Richardson [Fri, 5 Dec 2014 18:07:47 +0000 (10:07 -0800)]
rollup merge of #19520: csouth3/derefmut-unsized

Right now, `DerefMut` is not `for Sized?`, so you can't impl `DerefMut<T> for Foo` where `Foo` is unsized.  However, there is no reason that it can't be `for Sized?`, so this pull request fixes the issue.

Closes #19493.