]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorollup merge of #19626: bluss/string-extend-str
Alex Crichton [Tue, 9 Dec 2014 17:25:10 +0000 (09:25 -0800)]
rollup merge of #19626: bluss/string-extend-str

Strings iterate to both char and &str, so it is natural it can also be extended or collected from an iterator of &str.

Apart from the trait implementations, `Extend<char>` is updated to use the iterator size hint, and the test added tests both the char and the &str versions of Extend and FromIterator.

9 years agorollup merge of #19623: rustyrazorblade/patch-1
Alex Crichton [Tue, 9 Dec 2014 17:25:09 +0000 (09:25 -0800)]
rollup merge of #19623: rustyrazorblade/patch-1

Docs said from_utf8 accepts a vector when it actually accepts an array of bytes.

9 years agorollup merge of #19622: steveklabnik/fix_ringbuf_doc
Alex Crichton [Tue, 9 Dec 2014 17:25:08 +0000 (09:25 -0800)]
rollup merge of #19622: steveklabnik/fix_ringbuf_doc

  https://botbot.me/mozilla/rust/2014-12-07/?msg=27003846&page=20

9 years agorollup merge of #19620: retep998/memorymap
Alex Crichton [Tue, 9 Dec 2014 17:25:07 +0000 (09:25 -0800)]
rollup merge of #19620: retep998/memorymap

9 years agorollup merge of #19616: steveklabnik/gh19556
Alex Crichton [Tue, 9 Dec 2014 17:25:06 +0000 (09:25 -0800)]
rollup merge of #19616: steveklabnik/gh19556

Closes #19556.

9 years agorollup merge of #19615: steveklabnik/gh19595
Alex Crichton [Tue, 9 Dec 2014 17:25:05 +0000 (09:25 -0800)]
rollup merge of #19615: steveklabnik/gh19595

Fixes #19595.

9 years agorollup merge of #19614: steveklabnik/gh19599
Alex Crichton [Tue, 9 Dec 2014 17:25:04 +0000 (09:25 -0800)]
rollup merge of #19614: steveklabnik/gh19599

Fixes #19599

9 years agorollup merge of #19608: jbranchaud/add-missing-semicolon-in-intro
Alex Crichton [Tue, 9 Dec 2014 17:24:53 +0000 (09:24 -0800)]
rollup merge of #19608: jbranchaud/add-missing-semicolon-in-intro

9 years agorollup merge of #19604: vadimcn/gcc-less
Alex Crichton [Tue, 9 Dec 2014 17:24:52 +0000 (09:24 -0800)]
rollup merge of #19604: vadimcn/gcc-less

- Support gcc-less installation on Windows.  To do so in unattended mode run:`<intaller>.exe /TYPE=compact /SILENT`.
- Do not require admin privileges to install.

cc #19519

9 years agorollup merge of #19598: japaric/ord
Alex Crichton [Tue, 9 Dec 2014 17:24:51 +0000 (09:24 -0800)]
rollup merge of #19598: japaric/ord

cc #18755

r? @alexcrichton
cc @bjz

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

It is useful to have configurable newlines in base64 as the standard
leaves that for the implementation to decide.  GNU `base64` apparently
uses LF, which meant in `uutils` we had to manually convert the CRLF to
LF.  This made the program very slow for large inputs.

[breaking-change]

9 years agorollup merge of #19592: jbranchaud/add-btreemap-iter-doctest
Alex Crichton [Tue, 9 Dec 2014 17:24:48 +0000 (09:24 -0800)]
rollup merge of #19592: jbranchaud/add-btreemap-iter-doctest

I'm interested in including doctests for `BTreeMap`'s `iter_mut` and `into_iter` methods in this PR as well, but I am not sure of the best way to demonstrate/test what they do for the doctests.

9 years agorollup merge of #19589: huonw/unboxed-closure-elision
Alex Crichton [Tue, 9 Dec 2014 17:24:47 +0000 (09:24 -0800)]
rollup merge of #19589: huonw/unboxed-closure-elision

This means that `Fn(&A) -> (&B, &C)` is equivalent to `for<'a> Fn(&'a A)
-> (&'a B, &'a C)` similar to the lifetime elision of lower-case `fn` in
types and declarations.

Closes #18992.

9 years agorollup merge of #19588: nodakai/libstd-fix-zombie-children-finder
Alex Crichton [Tue, 9 Dec 2014 17:24:46 +0000 (09:24 -0800)]
rollup merge of #19588: nodakai/libstd-fix-zombie-children-finder

Reported as a part of rust-lang/rust#19120

The logic of rust-lang/rust@74fb798a200dc82cf5b4a18065e3ea565229adc3 was
flawed because when a CI tool run the test parallely with other tasks,
they all belong to a single session family and the test may pick up
irrelevant zombie processes before they are reaped by the CI tool
depending on timing.

9 years agorollup merge of #19587: huonw/closure-feature-gate
Alex Crichton [Tue, 9 Dec 2014 17:24:44 +0000 (09:24 -0800)]
rollup merge of #19587: huonw/closure-feature-gate

detect UFCS drop and allow UFCS methods to have explicit type parameters.

Work towards #18875.

Since code could previously call the methods & implement the traits
manually, this is a

[breaking-change]

Closes #19586. Closes #19375.

9 years agorollup merge of #19585: mdinger/guide_typo
Alex Crichton [Tue, 9 Dec 2014 17:24:43 +0000 (09:24 -0800)]
rollup merge of #19585: mdinger/guide_typo

@steveklabnik r?

9 years agorollup merge of #19584: CaptainHayashi/patch-1
Alex Crichton [Tue, 9 Dec 2014 17:24:42 +0000 (09:24 -0800)]
rollup merge of #19584: CaptainHayashi/patch-1

Substitutes 'lifetime' for 'liftime' in a few places.

Apologies if this has already been noticed/PRQed!  I did try to do due diligence, though :grinning:

9 years agorollup merge of #19581: luqmana/duc
Alex Crichton [Tue, 9 Dec 2014 17:24:41 +0000 (09:24 -0800)]
rollup merge of #19581: luqmana/duc

Fixes #19575.

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 agoserialize: base64: remove some .as_bytes() from the tests
Arcterus [Tue, 9 Dec 2014 08:21:43 +0000 (00:21 -0800)]
serialize: base64: remove some .as_bytes() from the tests

9 years agoserialize: base64: improve newline handling speed
Arcterus [Sat, 6 Dec 2014 18:58:18 +0000 (10:58 -0800)]
serialize: base64: improve newline handling speed

9 years agoserialize: base64: allow LF in addition to CRLF and optimize slightly
Arcterus [Sat, 6 Dec 2014 10:35:26 +0000 (02:35 -0800)]
serialize: base64: allow LF in addition to CRLF and optimize slightly

It is useful to have configurable newlines in base64 as the standard
leaves that for the implementation to decide.  GNU `base64` apparently
uses LF, which meant in `uutils` we had to manually convert the CRLF to
LF.  This made the program very slow for large inputs.

[breaking-change]

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 agodocumentation incorrectly described from_utf8
Jon Haddad [Sun, 7 Dec 2014 19:35:06 +0000 (11:35 -0800)]
documentation incorrectly described from_utf8

Docs said from_utf8 accepts a vector when it actually accepts a slice of bytes.

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 agostring: Add test for FromIterator<&str> and Extend<&str>
bluss [Sun, 7 Dec 2014 20:45:47 +0000 (21:45 +0100)]
string: Add test for FromIterator<&str> and Extend<&str>

9 years agostring: Add test for FromIterator<char> and Extend<char>
bluss [Sun, 7 Dec 2014 20:43:11 +0000 (21:43 +0100)]
string: Add test for FromIterator<char> and Extend<char>

9 years agosyntax: use UFCS in the expansion of `#[deriving(Ord)]`
Jorge Aparicio [Sat, 6 Dec 2014 16:56:55 +0000 (11:56 -0500)]
syntax: use UFCS in the expansion of `#[deriving(Ord)]`

cc #18755

9 years agostring: Implement FromIterator<&str> and Extend<&str> for String
bluss [Sun, 7 Dec 2014 20:32:00 +0000 (21:32 +0100)]
string: Implement FromIterator<&str> and Extend<&str> for String

&str is a "particle" of a string already, see the graphemes iterator,
so it seems natural that we should be able to use it with Extend.

9 years agostring: Use the iterator size_hint() in .extend()
bluss [Sun, 7 Dec 2014 20:31:24 +0000 (21:31 +0100)]
string: Use the iterator size_hint() in .extend()

9 years agoRemove mention of Dequeue in collections docs.
Steve Klabnik [Sun, 7 Dec 2014 19:12:01 +0000 (14:12 -0500)]
Remove mention of Dequeue in collections docs.

  https://botbot.me/mozilla/rust/2014-12-07/?msg=27003846&page=20

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 agoMake MemoryMap use HANDLE on Windows.
Peter Atashian [Sun, 7 Dec 2014 18:25:51 +0000 (13:25 -0500)]
Make MemoryMap use HANDLE on Windows.
Also fixes some conflicting module names.

Signed-off-by: Peter Atashian <retep998@gmail.com>
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 agoAdd enum namespacing to the Guide.
Steve Klabnik [Sun, 7 Dec 2014 12:55:30 +0000 (07:55 -0500)]
Add enum namespacing to the Guide.

Closes #19556.

9 years agoCorrect the reference with regards to floats
Steve Klabnik [Sun, 7 Dec 2014 12:30:15 +0000 (07:30 -0500)]
Correct the reference with regards to floats

Fixes #19595.

9 years agoremove usage of notrust from the docs
Steve Klabnik [Sun, 7 Dec 2014 09:18:56 +0000 (04:18 -0500)]
remove usage of notrust from the docs

Fixes #19599

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