Commit Graph

34944 Commits

Author SHA1 Message Date
Brian Anderson
e92e8ac365 Use rust-installer for installation
This is just a refactoring of the current installer so that Rust and Cargo
use the same codebase.

cc #16456
2014-12-11 17:14:17 -08:00
Brian Anderson
65bca024a7 Don't try to dist src/README.md which does not exist 2014-12-10 09:47:36 -08:00
Alex Crichton
e8bc621f48 rustc: Fix make install
Move a few docblocks from 'ignore' to something that's not rust (e.g. 'text').

Closes #19678
2014-12-10 09:46:30 -08:00
bors
bc486dc233 auto merge of #19663 : tbu-/rust/pr_fix_vecmap, r=Gankro
- Introduce a named type for the return type of `VecMap::move_iter`
- Rename all type parameters to `V` for "Value".
- Remove unnecessary call to an `Option::unwrap`, use pattern matching instead.
- Remove incorrect `Hash` implementation which took the `VecMap`'s capacity
  into account.

This is a [breaking-change], however whoever used the `Hash` implementation
relied on an incorrect implementation.
2014-12-10 15:22:18 +00:00
bors
daa2bde2ba auto merge of #19655 : jbranchaud/rust/change-example-to-examples, r=steveklabnik
@steveklabnik I got a start on this.
2014-12-10 12:46:11 +00:00
bors
fddec2d88a auto merge of #19638 : barosl/rust/typeck-tupled-arguments-ice, r=jakub
When a type error occurs, `check_method_argument_types()` tries to provide arguments filled with `ty::mk_err()`. However, if a function takes the parameters as a tuple, the arguments should be converted to a tuple before passing it to `check_argument_types()`.

Fixes #19521.
2014-12-10 09:56:14 +00:00
bors
444a759b84 auto merge of #19628 : jbranchaud/rust/add-string-as-string-doctest, r=steveklabnik 2014-12-10 06:46:16 +00:00
bors
ab1b1ae719 auto merge of #19648 : mquandalle/rust/patch-1, r=alexcrichton 2014-12-10 03:41:14 +00:00
Barosl Lee
21d12c0297 typeck: Make the supplied parameters to be a tuple
When a type error occurs, check_method_argument_types() tries to provide
arguments filled with ty::mk_err(). However, if a function takes the
parameters as a tuple, the arguments should be converted to a tuple
before being passed to check_argument_types().

Fixes #19521.
2014-12-10 12:33:20 +09:00
bors
4c692d3a35 auto merge of #19573 : apasel422/rust/sized_fn_once, r=alexcrichton
- Remove the `for Sized?` bound on `core::ops::FnOnce`, as it takes `self` by value and can never be implemented by an unsized type.
- Add a missing `Sized?` bound to the blanket `core::ops::FnMut` impl, as both `Fn` and `FnMut` are `for Sized?`.
2014-12-10 00:31:13 +00:00
bors
8fbfa66b45 auto merge of #19563 : alexcrichton/rust/issue-19501, r=pnkfelix
One of the causes of #19501 was that the metadata on OSX was getting corrupted.
For any one particular invocation of the compiler the metadata file inside of an
rlib archive would have extra bytes appended to the end of it. These extra bytes
end up confusing rbml and have it run off the end of the array (resulting in the
out of bounds detected).

This commit prepends the length of metadata to the start of the metadata to
ensure that we always slice the precise amount that we want, and it also
un-ignores the test from #19502.

Closes #19501
2014-12-09 21:56:13 +00:00
bors
b25e100173 auto merge of #19665 : alexcrichton/rust/rollup, r=alexcrichton 2014-12-09 19:12:02 +00:00
Tobias Bucher
20eaf168c5 Add a proper Hash implementation for VecMap
Also re-add the previously deleted test with an additional test that would have
failed before, when the hash function depended on the capacity.
2014-12-09 20:05:51 +01:00
Alex Crichton
1a61fe4280 Test fixes and rebase conflicts from the rollup 2014-12-09 10:26:04 -08:00
Alex Crichton
2457375534 rollup merge of #19653: frewsxcv/rm-reexports
Brief note: This does *not* affect anything in the prelude

Part of #19253

All this does is remove the reexporting of Result and Option from their
respective modules. More core reexports might be removed, but these ones
are the safest to remove since these enums (and their variants) are included in
the prelude.

Depends on https://github.com/rust-lang/rust/pull/19407 which is merged, but might need a new snapshot

[breaking-change]
2014-12-09 09:25:14 -08:00
Alex Crichton
b4b1bb0a4e rollup merge of #19642: aaronweiss74/master
This was discussed in [#rust-internals](
https://botbot.me/mozilla/rust-internals/2014-12-08/?msg=27077624&page=5). It's a small change.
2014-12-09 09:25:12 -08:00
Alex Crichton
4b34f3c3ad 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.
2014-12-09 09:25:10 -08:00
Alex Crichton
1cbb07507e rollup merge of #19623: rustyrazorblade/patch-1
Docs said from_utf8 accepts a vector when it actually accepts an array of bytes.
2014-12-09 09:25:09 -08:00
Alex Crichton
21e5efb43c rollup merge of #19622: steveklabnik/fix_ringbuf_doc
https://botbot.me/mozilla/rust/2014-12-07/?msg=27003846&page=20
2014-12-09 09:25:08 -08:00
Alex Crichton
4a49912cfe rollup merge of #19620: retep998/memorymap 2014-12-09 09:25:07 -08:00
Alex Crichton
a2e9c99a66 rollup merge of #19616: steveklabnik/gh19556
Closes #19556.
2014-12-09 09:25:06 -08:00
Alex Crichton
e6d8190b0c rollup merge of #19615: steveklabnik/gh19595
Fixes #19595.
2014-12-09 09:25:05 -08:00
Alex Crichton
fb587f1f9b rollup merge of #19614: steveklabnik/gh19599
Fixes #19599
2014-12-09 09:25:04 -08:00
Alex Crichton
ae805da487 rollup merge of #19608: jbranchaud/add-missing-semicolon-in-intro 2014-12-09 09:24:53 -08:00
Alex Crichton
c56344ba31 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
2014-12-09 09:24:52 -08:00
Alex Crichton
2a244ce7f4 rollup merge of #19598: japaric/ord
cc #18755

r? @alexcrichton
cc @bjz
2014-12-09 09:24:51 -08:00
Alex Crichton
d0ad3c7f93 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]
2014-12-09 09:24:50 -08:00
Alex Crichton
ae60f9c592 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.
2014-12-09 09:24:48 -08:00
Alex Crichton
63ef9e980f 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.
2014-12-09 09:24:47 -08:00
Alex Crichton
356193be0e 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@74fb798a20 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.
2014-12-09 09:24:46 -08:00
Alex Crichton
26c24221e4 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.
2014-12-09 09:24:44 -08:00
Alex Crichton
60f97fc44a rollup merge of #19585: mdinger/guide_typo
@steveklabnik r?
2014-12-09 09:24:43 -08:00
Alex Crichton
6a652cfd1d 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 😀
2014-12-09 09:24:42 -08:00
Alex Crichton
2593070d57 rollup merge of #19581: luqmana/duc
Fixes #19575.
2014-12-09 09:24:41 -08:00
Alex Crichton
39b57115fb rollup merge of #19577: aidancully/master
pthread_key_create can be 0.
addresses issue #19567.
2014-12-09 09:24:39 -08:00
Alex Crichton
a09632f7cb rollup merge of #19576: nhoss2/master
There was a link to a non existing guide
2014-12-09 09:24:38 -08:00
Tobias Bucher
67ae3a49e4 Clean up libcollections::VecMap
- Introduce a named type for the return type of `VecMap::move_iter`
- Rename all type parameters to `V` for "Value".
- Remove unnecessary call to an `Option::unwrap`, use pattern matching instead.
- Remove incorrect `Hash` implementation which took the `VecMap`'s capacity
  into account.

This is a [breaking-change], however whoever used the `Hash` implementation
relied on an incorrect implementation.
2014-12-09 18:20:20 +01:00
jbranchaud
de3fcee2dc Add a doctest for the std::string::as_string method.
Change Example to Examples.

Add a doctest that better demonstrates the utility of as_string.

Update the doctest example to use String instead of &String.
2014-12-09 11:11:50 -06:00
Maxime Quandalle
c93d47d395 Delete the outdated source layout README 2014-12-09 16:53:22 +01:00
Arcterus
a119ad83c7 serialize: base64: remove some .as_bytes() from the tests 2014-12-09 07:40:21 -08:00
Arcterus
a943a7a4e5 serialize: base64: improve newline handling speed 2014-12-09 07:40:21 -08:00
Arcterus
553ab271a3 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]
2014-12-09 07:40:21 -08:00
bors
ef4982f0f8 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
2014-12-09 14:02:45 +00:00
bors
cafe296677 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.
2014-12-09 10:51:49 +00:00
bors
c56e59c722 auto merge of #19644 : pcwalton/rust/oibit3, r=nikomatsakis 2014-12-09 07:51:52 +00:00
Patrick Walton
fcd1f53e43 Add some missing Copy implementations 2014-12-08 21:44:04 -08:00
jbranchaud
c09defa070 Change 'Example' to 'Examples' throughout collections' rustdocs. 2014-12-08 23:28:07 -06:00
bors
50b6d01e1c 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
2014-12-09 05:01:53 +00:00
Corey Farwell
9af324a673 Remove Result and Option reexports
Brief note: This does *not* affect anything in the prelude

Part of #19253

All this does is remove the reexporting of Result and Option from their
respective modules. More core reexports might be removed, but these ones
are the safest to remove since these enums (and their variants) are included in
the prelude.

[breaking-change]
2014-12-08 21:40:16 -05:00
Alex Crichton
456ffcdc56 Revert "Register new snapshots"
This reverts commit 9b443289cf.
2014-12-08 14:30:13 -08:00