about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2014-12-10Update sample code to use `getopts::usage` in `print_usage`Arthur Liao-5/+4
2014-12-10auto merge of #19638 : barosl/rust/typeck-tupled-arguments-ice, r=jakubbors-1/+22
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-10auto merge of #19628 : jbranchaud/rust/add-string-as-string-doctest, ↵bors-0/+13
r=steveklabnik
2014-12-10auto merge of #19648 : mquandalle/rust/patch-1, r=alexcrichtonbors-66/+0
2014-12-10typeck: Make the supplied parameters to be a tupleBarosl Lee-1/+22
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-10auto merge of #19573 : apasel422/rust/sized_fn_once, r=alexcrichtonbors-2/+2
- 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-09auto merge of #19563 : alexcrichton/rust/issue-19501, r=pnkfelixbors-3/+36
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-09auto merge of #19665 : alexcrichton/rust/rollup, r=alexcrichtonbors-309/+793
2014-12-09Test fixes and rebase conflicts from the rollupAlex Crichton-60/+62
2014-12-09rollup merge of #19653: frewsxcv/rm-reexportsAlex Crichton-3/+6
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-09rollup merge of #19642: aaronweiss74/masterAlex Crichton-0/+7
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-09rollup merge of #19626: bluss/string-extend-strAlex Crichton-0/+44
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-09rollup merge of #19623: rustyrazorblade/patch-1Alex Crichton-1/+1
Docs said from_utf8 accepts a vector when it actually accepts an array of bytes.
2014-12-09rollup merge of #19622: steveklabnik/fix_ringbuf_docAlex Crichton-5/+1
https://botbot.me/mozilla/rust/2014-12-07/?msg=27003846&page=20
2014-12-09rollup merge of #19620: retep998/memorymapAlex Crichton-39/+35
2014-12-09rollup merge of #19616: steveklabnik/gh19556Alex Crichton-0/+49
Closes #19556.
2014-12-09rollup merge of #19615: steveklabnik/gh19595Alex Crichton-7/+11
Fixes #19595.
2014-12-09rollup merge of #19614: steveklabnik/gh19599Alex Crichton-75/+75
Fixes #19599
2014-12-09rollup merge of #19608: jbranchaud/add-missing-semicolon-in-introAlex Crichton-1/+1
2014-12-09rollup merge of #19604: vadimcn/gcc-lessAlex Crichton-9/+22
- 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-09rollup merge of #19598: japaric/ordAlex Crichton-7/+28
cc #18755 r? @alexcrichton cc @bjz
2014-12-09rollup merge of #19594: Arcterus/masterAlex Crichton-32/+64
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-09rollup merge of #19592: jbranchaud/add-btreemap-iter-doctestAlex Crichton-0/+18
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-09rollup merge of #19589: huonw/unboxed-closure-elisionAlex Crichton-44/+117
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-09rollup merge of #19588: nodakai/libstd-fix-zombie-children-finderAlex Crichton-40/+28
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.
2014-12-09rollup merge of #19587: huonw/closure-feature-gateAlex Crichton-14/+199
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-09rollup merge of #19585: mdinger/guide_typoAlex Crichton-3/+3
@steveklabnik r?
2014-12-09rollup merge of #19584: CaptainHayashi/patch-1Alex Crichton-4/+4
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:
2014-12-09rollup merge of #19581: luqmana/ducAlex Crichton-11/+48
Fixes #19575.
2014-12-09rollup merge of #19577: aidancully/masterAlex Crichton-1/+17
pthread_key_create can be 0. addresses issue #19567.
2014-12-09rollup merge of #19576: nhoss2/masterAlex Crichton-2/+2
There was a link to a non existing guide
2014-12-09Add a doctest for the std::string::as_string method.jbranchaud-0/+13
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-09Delete the outdated source layout READMEMaxime Quandalle-66/+0
2014-12-09serialize: base64: remove some .as_bytes() from the testsArcterus-6/+6
2014-12-09serialize: base64: improve newline handling speedArcterus-15/+13
2014-12-09serialize: base64: allow LF in addition to CRLF and optimize slightlyArcterus-30/+64
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-09auto merge of #19466 : nikomatsakis/rust/recursion-limit, r=eddybbors-294/+126
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-09auto merge of #19249 : barosl/rust/json-type-safety, r=alexcrichtonbors-169/+169
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-09auto merge of #19644 : pcwalton/rust/oibit3, r=nikomatsakisbors-512/+2250
2014-12-08Add some missing Copy implementationsPatrick Walton-0/+6
2014-12-09auto merge of #19645 : alexcrichton/rust/old-snap, r=brsonbors-12/+53
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-08Remove Result and Option reexportsCorey Farwell-3/+6
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-08Revert "Register new snapshots"Alex Crichton-12/+53
This reverts commit 9b443289cf32cbcff16768614340f0c844675340.
2014-12-08rustc: Prepend a length to all metadataAlex Crichton-3/+36
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-08Implemented BorrowFrom<Rc<T>> for T.Aaron Weiss-0/+7
2014-12-08auto merge of #19456 : nikomatsakis/rust/reborrow-closure-arg, r=pnkfelixbors-6/+49
Otherwise region inference can fail when closure arguments include `ref` bindings. Test case included in the PR.
2014-12-08Link regions in `ref` bindings from fn arguments.Niko Matsakis-6/+49
2014-12-08Stop masking overflow and propagate it out more aggressively; also improve ↵Niko Matsakis-17/+37
error reporting to suggest to user how to fix.
2014-12-08Kill dead codeNiko Matsakis-279/+0
2014-12-08Add ability to configure recursion limit.Niko Matsakis-0/+91
Fixes #19318.