]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #8459 : thestinger/rust/checked, r=graydon
bors [Mon, 19 Aug 2013 19:42:48 +0000 (12:42 -0700)]
auto merge of #8459 : thestinger/rust/checked, r=graydon

10 years agoauto merge of #8619 : pnkfelix/rust/fsk-visitor-vpar-defaults-step3, r=nmatsakis
bors [Mon, 19 Aug 2013 16:12:03 +0000 (09:12 -0700)]
auto merge of #8619 : pnkfelix/rust/fsk-visitor-vpar-defaults-step3, r=nmatsakis

Follow up to #8539 (step 2 of 5).

(See  #8527, which was step 1 of 5, for the full outline.)

Part of #7081.

10 years agoauto merge of #8539 : pnkfelix/rust/fsk-visitor-vpar-defaults-step2, r=graydon,nikoma...
bors [Mon, 19 Aug 2013 13:52:03 +0000 (06:52 -0700)]
auto merge of #8539 : pnkfelix/rust/fsk-visitor-vpar-defaults-step2, r=graydon,nikomatsakis

r? @nikomatsakis

Follow up to #8527 (which was step 1 of 5).  See that for overall description

Part of #7081

10 years agoauto merge of #8535 : nikomatsakis/rust/issue-3678-wrappers-be-gone-2, r=graydon
bors [Mon, 19 Aug 2013 11:32:04 +0000 (04:32 -0700)]
auto merge of #8535 : nikomatsakis/rust/issue-3678-wrappers-be-gone-2, r=graydon

Long-standing branch to remove foreign function wrappers altogether. Calls to C functions are done "in place" with no stack manipulation; the scheme relies entirely on the correct use of `#[fixed_stack_segment]` to guarantee adequate stack space. A linter is added to detect when `#[fixed_stack_segment]` annotations are missing. An `externfn!` macro is added to make it easier to declare foreign fns and wrappers in one go: this macro may need some refinement, though, for example it might be good to be able to declare a group of foreign fns. I leave that for future work (hopefully somebody else's work :) ).

Fixes #3678.

10 years agoAdd externfn macro and correctly label fixed_stack_segments
Niko Matsakis [Thu, 15 Aug 2013 01:41:40 +0000 (21:41 -0400)]
Add externfn macro and correctly label fixed_stack_segments

10 years agoIssue #3678: Remove wrappers and call foreign functions directly
Niko Matsakis [Tue, 21 May 2013 19:25:44 +0000 (15:25 -0400)]
Issue #3678: Remove wrappers and call foreign functions directly

10 years agoauto merge of #8564 : alexcrichton/rust/ifmt+++, r=graydon
bors [Mon, 19 Aug 2013 08:42:05 +0000 (01:42 -0700)]
auto merge of #8564 : alexcrichton/rust/ifmt+++, r=graydon

See discussion in #8489, but this selects option 3 by adding a `Default` trait to be implemented by various basic types.

Once this makes it into a snapshot I think it's about time to start overhauling all current use-cases of `fmt!` to move towards `ifmt!`. The goal is to replace `%X` with `{}` in 90% of situations, and this commit should enable that.

10 years agoauto merge of #8556 : sfackler/rust/quote, r=alexcrichton
bors [Mon, 19 Aug 2013 04:51:58 +0000 (21:51 -0700)]
auto merge of #8556 : sfackler/rust/quote, r=alexcrichton

They previously required one called "ext_cx" to be in scope.

Fixes part of #7727

10 years agoauto merge of #8565 : bblum/rust/select-bugfix, r=brson
bors [Mon, 19 Aug 2013 02:32:36 +0000 (19:32 -0700)]
auto merge of #8565 : bblum/rust/select-bugfix, r=brson

@brson grilled me about how this bugfix worked the first time around, and it occurred to me that it didn't in the case where the task is unwinding. Now it will.

10 years agoauto merge of #8561 : kballard/rust/do-block-internal-err-msg, r=thestinger
bors [Mon, 19 Aug 2013 00:12:02 +0000 (17:12 -0700)]
auto merge of #8561 : kballard/rust/do-block-internal-err-msg, r=thestinger

When using a `do` block to call an internal iterator, if you forgot to
return a value from the body, it would tell you

    error: Do-block body must return bool, but returns () here. Perhaps
    you meant to write a `for`-loop?

This advice no longer applies as `for` loops are now for external
iterators. Delete this message outright and let it use the default error
message

    error: mismatched types: expected `bool` but found `()`

r? @thestinger

10 years agoauto merge of #8560 : kballard/rust/reserve-yield, r=pcwalton
bors [Sun, 18 Aug 2013 22:02:04 +0000 (15:02 -0700)]
auto merge of #8560 : kballard/rust/reserve-yield, r=pcwalton

Rename task::yield() to task::deschedule().

Fixes #8494.

10 years agoauto merge of #8545 : blake2-ppc/rust/iterbytes, r=alexcrichton
bors [Sun, 18 Aug 2013 19:41:59 +0000 (12:41 -0700)]
auto merge of #8545 : blake2-ppc/rust/iterbytes, r=alexcrichton

Address issue #5257, for example these values all had the same hash value:

("aaa", "bbb", "ccc")
("aaab", "bb", "ccc")
("aaabbb", "", "ccc")

IterBytes for &[A] now includes the length, before calling iter_bytes on
each element.

IterBytes for &str is now terminated by a byte that does not appear in
UTF-8. This way only one more byte is processed when hashing strings.

10 years agoquote_*! macros take an ExtCtx
Steven Fackler [Thu, 15 Aug 2013 06:06:33 +0000 (02:06 -0400)]
quote_*! macros take an ExtCtx

They previously required one called "ext_cx" to be in scope.

Fixes part of #7727

10 years agoauto merge of #8558 : kballard/rust/xorshift-seed, r=cmr
bors [Sun, 18 Aug 2013 17:01:55 +0000 (10:01 -0700)]
auto merge of #8558 : kballard/rust/xorshift-seed, r=cmr

Fixes #8359.

10 years agostd::hash: Add testcase for colliding hashes of tuples
blake2-ppc [Sun, 18 Aug 2013 13:23:42 +0000 (15:23 +0200)]
std::hash: Add testcase for colliding hashes of tuples

Add a testcase that verifies that (s, t) and (u, v) don't collide even if
s + t == u + v (concatenation).

10 years agostd::to_bytes: Implement IterBytes on 1- to 8-tuples
blake2-ppc [Thu, 15 Aug 2013 21:51:39 +0000 (23:51 +0200)]
std::to_bytes: Implement IterBytes on 1- to 8-tuples

10 years agostd::to_bytes: Delimit sequences &[A] and ~str when hashing
blake2-ppc [Thu, 15 Aug 2013 03:23:33 +0000 (05:23 +0200)]
std::to_bytes: Delimit sequences &[A] and ~str when hashing

Address issue #5257, for example these values all had the same hash value:

("aaa", "bbb", "ccc")
("aaab", "bb", "ccc")
("aaabbb", "", "ccc")

IterBytes for &[A] now includes the length, before calling iter_bytes on
each element.

IterBytes for &str is now terminated by a byte that does not appear in
UTF-8. This way only one more byte is processed when hashing strings.

10 years agoauto merge of #8555 : chris-morgan/rust/time-clone, r=huonw
bors [Sun, 18 Aug 2013 14:21:58 +0000 (07:21 -0700)]
auto merge of #8555 : chris-morgan/rust/time-clone, r=huonw

I need `Clone` for `Tm` for my latest work on [rust-http](https://github.com/chris-morgan/rust-http) (static typing for headers, and headers like `Date` are a time), so here it is.

@huonw recommended deriving DeepClone while I was at it.

I also had to implement `DeepClone` for `~str` to get a derived implementation of `DeepClone` for `Tm`; I did `@str` while I was at it, for consistency.

10 years agoauto merge of #8551 : huonw/rust/speling, r=alexcrichton
bors [Sun, 18 Aug 2013 12:11:58 +0000 (05:11 -0700)]
auto merge of #8551 : huonw/rust/speling, r=alexcrichton

(This doesn't add/remove `u`s or change `ize` to `ise`, or anything like that.)

10 years agoauto merge of #8550 : kballard/rust/token-start-err-msg, r=catamorphism
bors [Sun, 18 Aug 2013 09:51:59 +0000 (02:51 -0700)]
auto merge of #8550 : kballard/rust/token-start-err-msg, r=catamorphism

The span was fixed at some point to point to the correct character, but
the error message is still bad. Update it to emit the actual character
in question (potentially escaped).

Fixes #3747.

10 years agoauto merge of #8547 : kballard/rust/trait-parse-err-msg, r=alexcrichton
bors [Sun, 18 Aug 2013 05:52:00 +0000 (22:52 -0700)]
auto merge of #8547 : kballard/rust/trait-parse-err-msg, r=alexcrichton

When parsing a trait function, the function must end with either `;` or
`{` (signifying a default implementation). The error message incorrectly
stated that it must be `;` or `}`.

Fixes #6610.

10 years agoauto merge of #8544 : dim-an/rust/fix-match-pipes, r=pcwalton
bors [Sun, 18 Aug 2013 03:12:02 +0000 (20:12 -0700)]
auto merge of #8544 : dim-an/rust/fix-match-pipes, r=pcwalton

Pointers to bound variables shouldn't be stored before checking pattern,
otherwise piped patterns can conflict with each other (issue #6338).

Closes #6338.

10 years agoMore spelling corrections.
Huon Wilson [Sat, 17 Aug 2013 22:28:04 +0000 (08:28 +1000)]
More spelling corrections.

10 years agoauto merge of #8554 : michaelwoerister/rust/generics, r=brson
bors [Sat, 17 Aug 2013 22:22:04 +0000 (15:22 -0700)]
auto merge of #8554 : michaelwoerister/rust/generics, r=brson

This pull request includes support for generic functions and self arguments in methods, and combinations thereof. This also encompasses any kind of trait methods, regular and static, with and without default implementation. The implementation is backed up by a felt ton of test cases `:)`

This is a very important step towards being able to compile larger programs with debug info, since practically any generic function caused an ICE before.

One point worth discussing is that activating debug info now automatically (and silently) sets the `no_monomorphic_collapse` flag. Otherwise debug info would show wrong type names in all but one instance of the monomorphized function.

Another thing to note is that the handling of generic types does not strictly follow the DWARF specification. That is, variables with type `T` (where `T=int`) are described as having type `int` and not as having type `T`. In other words, we are losing information whether a variable has been declared with a type parameter as its type. In practice this should not make much of difference though since the concrete type is mostly what one is interested in. I'll post an issue later so this won't be forgotten.

Also included are a number of bug fixes:
* Closes #1758
* Closes #8513
* Closes #8443
* Fixes handling of field names in tuple structs
* Fixes and re-enables test case for option-like enums that relied on undefined behavior before
* Closes #1339 (should have been closed a while ago)

Cheers,
Michael

10 years agoauto merge of #8433 : brson/rust/rm-more-oldrt-crud, r=brson
bors [Sat, 17 Aug 2013 19:51:57 +0000 (12:51 -0700)]
auto merge of #8433 : brson/rust/rm-more-oldrt-crud, r=brson

Just deleting more stuff.

10 years agoauto merge of #8441 : erickt/rust/deny-warnings, r=erickt
bors [Sat, 17 Aug 2013 17:12:04 +0000 (10:12 -0700)]
auto merge of #8441 : erickt/rust/deny-warnings, r=erickt

This patch makes sure that code is warning-free for all of the rust libraries.

10 years agoDeny warnings in stage1+ libsyntax/librustc/librustdoc/librusti/librust
Erick Tryzelaar [Sat, 17 Aug 2013 15:37:12 +0000 (08:37 -0700)]
Deny warnings in stage1+ libsyntax/librustc/librustdoc/librusti/librust

10 years agoFix warnings it tests
Erick Tryzelaar [Sat, 17 Aug 2013 15:37:42 +0000 (08:37 -0700)]
Fix warnings it tests

10 years agoFix warnings in librustc and libsyntax
Erick Tryzelaar [Sat, 17 Aug 2013 15:37:07 +0000 (08:37 -0700)]
Fix warnings in librustc and libsyntax

10 years agoFix warnings in tests
Erick Tryzelaar [Sat, 17 Aug 2013 15:40:53 +0000 (08:40 -0700)]
Fix warnings in tests

10 years agoauto merge of #8272 : DaGenix/rust/digest-md5-impl-not-unrolled, r=cmr
bors [Sat, 17 Aug 2013 14:42:01 +0000 (07:42 -0700)]
auto merge of #8272 : DaGenix/rust/digest-md5-impl-not-unrolled, r=cmr

An MD5 implementation was originally included in #8097, but, since there are a couple different implementations of that digest algorithm (@alco mentioned his implementation on the mailing list just before I opened that PR), it was suggested that I remove it from that PR and open up a new PR to discuss the different implementations and the best way forward. If anyone wants to discuss a different implementation, feel free to present it here and discuss and compare it to this one. I'll just discuss my implementation and I'll leave it to others to present details of theirs.

This implementation relies on the FixedBuffer struct from cryptoutil.rs for managing the input buffer, just like the Sha1 and Sha2 digest implementations do. I tried manually unrolling the loops in the compression function, but I got slightly worse performance when I did that.

Outside of the #[test]s, I also tested the implementation by generating 1,000 inputs of up to 10MB in size and checking the MD5 digest calculated by this code against the MD5 digest calculated by Java's implementation.

On my computer, I'm getting the following performance:

```
test md5::bench::md5_10 ... bench: 52 ns/iter (+/- 1) = 192 MB/s
test md5::bench::md5_1k ... bench: 2819 ns/iter (+/- 44) = 363 MB/s
test md5::bench::md5_64k ... bench: 178566 ns/iter (+/- 4927) = 367 MB/s
```

10 years agoauto merge of #8053 : gavinb/rust/uuid_std, r=alexcrichton
bors [Sat, 17 Aug 2013 12:12:03 +0000 (05:12 -0700)]
auto merge of #8053 : gavinb/rust/uuid_std, r=alexcrichton

Addresses part of #7104

This module adds the ability to generate UUIDs (on all Rust-supported platforms).

I reviewed the existing UUID support in libraries for a range of languages; Go, D, C#, Java and Boost++. The features were all very similar, and this patch essentially covers the union.  The implmentation is quite straightforward, and uses the underlying rng support which is assumed to be sufficiently strong for this purpose.

This patch is not complete, however I have put this up for review to gather feedback before finalising. It has tests for most features and documentation for most functions.

Outstanding issues:

* Only generates V4 (Random) UUIDs. Do we want to support the SHA-1 hash based flavour as well?
* Is it worth having the field-based struct public as well as the byte array?
* Formatting the string with '-' between groups not done yet.
* Parsing full string not done as there appears to be no regexp support yet. I can write a simple manual parser for now?
* D has a generator as well. This would be easy to add. However, given the simple interface for creating a new one, and the presence of the macro, is this useful?
* Is it worth having a separate UUID trait and specific implementation? Or should it just have a struct+impl with the same name? Currently it feels weird to have the trait (which can't be named UUID so as to conflict) a separate thing.
* Should the macro be visible at the top level scope?

As this is a first attempt, some code may not be idiomatic. Please comment below...

Thanks for all feedback!

10 years agoauto merge of #8531 : brson/rust/test-waitpid-workaround, r=graydon
bors [Sat, 17 Aug 2013 07:22:05 +0000 (00:22 -0700)]
auto merge of #8531 : brson/rust/test-waitpid-workaround, r=graydon

...er

I believe the calls to waitpid are interacting badly with the message passing that goes
on between schedulers and causing us to have very little parallelism in
the test suite. I don't fully understand the sequence of events that causes
the problem here but clearly blocking on waitpid is something that a
well-behaved task should not be doing.

Unfortunately this adds quite a bit of overhead to each test: one thread, two
tasks, three stacks, so there's a tradeoff. The time to execute run-pass on
my 4-core machine goes from ~750s to ~300s.

This should have a pretty good impact on cycle times.

cc @toddaaro

10 years agoCrypto: Add tests for add_bytes_to_bits functions.
Palmer Cox [Wed, 14 Aug 2013 00:26:04 +0000 (20:26 -0400)]
Crypto: Add tests for add_bytes_to_bits functions.

10 years agoCrypto: update checked addition functions to use CheckedAdd intrinsic.
Palmer Cox [Mon, 12 Aug 2013 03:14:27 +0000 (23:14 -0400)]
Crypto: update checked addition functions to use CheckedAdd intrinsic.

The shift_add_check_overflow and shift_add_check_overflow_tuple functions are
re-written to be more efficient and to make use of the CheckedAdd instrinsic
instead of manually checking for integer overflow.

* The invokation leading_zeros() is removed and replaced with simple integer
  comparison. The leading_zeros() method results in a ctpop LLVM instruction
  and it may not be efficient on all architectures; integer comparisons,
  however, are efficient on just about any architecture.
* The methods lose the ability for the caller to specify a particular shift
  value - that functionality wasn't being used and removing it allows for the
  code to be simplified.
* Finally, the methods are renamed to add_bytes_to_bits and
  add_bytes_to_bits_tuple to reflect their very specific purposes.

10 years agoMD5: Create an implementation of MD5.
Palmer Cox [Fri, 2 Aug 2013 01:58:01 +0000 (21:58 -0400)]
MD5: Create an implementation of MD5.

10 years agoCrypto: Add little-endian versions of existing functions: read_u32v_le and write_u32_le.
Palmer Cox [Fri, 2 Aug 2013 02:07:36 +0000 (22:07 -0400)]
Crypto: Add little-endian versions of existing functions: read_u32v_le and write_u32_le.

10 years agoDelegate `{}` to Default instead of Poly
Alex Crichton [Thu, 15 Aug 2013 03:40:15 +0000 (20:40 -0700)]
Delegate `{}` to Default instead of Poly

By using a separate trait this is overridable on a per-type basis and makes room
for the possibility of even more arguments passed in for the future.

10 years agoImplement `{:s}` for ~str and @str as well
Alex Crichton [Wed, 14 Aug 2013 23:47:14 +0000 (16:47 -0700)]
Implement `{:s}` for ~str and @str as well

10 years agoRemove obsolete error message regarding do-blocks with internal iters
Kevin Ballard [Fri, 16 Aug 2013 20:55:26 +0000 (13:55 -0700)]
Remove obsolete error message regarding do-blocks with internal iters

When using a `do` block to call an internal iterator, if you forgot to
return a value from the body, it would tell you

    error: Do-block body must return bool, but returns () here. Perhaps
    you meant to write a `for`-loop?

This advice no longer applies as `for` loops are now for external
iterators. Delete this message outright and let it use the default error
message

    error: mismatched types: expected `bool` but found `()`

10 years agodebuginfo: Added test cases for static struct and enum methods.
Michael Woerister [Fri, 16 Aug 2013 09:16:00 +0000 (11:16 +0200)]
debuginfo: Added test cases for static struct and enum methods.

10 years agodebuginfo: Test cases for [generic][default][static] methods and functions:
Michael Woerister [Thu, 15 Aug 2013 16:24:05 +0000 (18:24 +0200)]
debuginfo: Test cases for [generic][default][static] methods and functions:

* closure-in-generic-function
* generic-functions-nested
* generic-method-on-generic-struct
* generic-trait-generic-static-default-method
* method-on-generic-struct
* self-in-generic-default-method
* trait-generic-static-default-method

Also, fixed an 'unused variable' warning in debuginfo.rs

10 years agodebuginfo: Support for combinations of Self type and type parameters.
Michael Woerister [Thu, 15 Aug 2013 16:21:16 +0000 (18:21 +0200)]
debuginfo: Support for combinations of Self type and type parameters.

10 years agodebuginfo: Add test case for issue #8513.
Michael Woerister [Thu, 15 Aug 2013 10:35:08 +0000 (12:35 +0200)]
debuginfo: Add test case for issue #8513.

10 years agodebuginfo: Implemented support for Self type parameter in trait methods with default...
Michael Woerister [Thu, 15 Aug 2013 10:25:35 +0000 (12:25 +0200)]
debuginfo: Implemented support for Self type parameter in trait methods with default implementation.

10 years agodebuginfo: Added test cases for methods on structs, enums, traits, and tuple-structs.
Michael Woerister [Thu, 15 Aug 2013 10:23:54 +0000 (12:23 +0200)]
debuginfo: Added test cases for methods on structs, enums, traits, and tuple-structs.

Also new test cases for tuple structs and by-value parameter passing.

10 years agodebuginfo: Added support for self parameter in methods.
Michael Woerister [Thu, 15 Aug 2013 07:56:05 +0000 (09:56 +0200)]
debuginfo: Added support for self parameter in methods.

10 years agodebuginfo: Fixed crash occuring for parameterless closures.
Michael Woerister [Wed, 14 Aug 2013 13:45:38 +0000 (15:45 +0200)]
debuginfo: Fixed crash occuring for parameterless closures.

10 years agodebuginfo: Added test cases for generic structs and enums.
Michael Woerister [Tue, 13 Aug 2013 14:31:42 +0000 (16:31 +0200)]
debuginfo: Added test cases for generic structs and enums.

Also, always set no_monomorphic_collapse flags if debuginfo is generated.

10 years agodebuginfo: Properly handle monomorphization of generic functions.
Michael Woerister [Tue, 13 Aug 2013 10:52:39 +0000 (12:52 +0200)]
debuginfo: Properly handle monomorphization of generic functions.

10 years agodebuginfo: Generate template type parameters for generic functions.
Michael Woerister [Thu, 8 Aug 2013 16:33:06 +0000 (18:33 +0200)]
debuginfo: Generate template type parameters for generic functions.

Conflicts:
src/librustc/lib/llvm.rs
src/librustc/middle/trans/debuginfo.rs
src/rustllvm/RustWrapper.cpp
src/rustllvm/rustllvm.def.in

10 years agodebuginfo: Fixed option-like-enum test case so it does not rely on undefined behavior.
Michael Woerister [Thu, 8 Aug 2013 12:14:52 +0000 (14:14 +0200)]
debuginfo: Fixed option-like-enum test case so it does not rely on undefined behavior.

10 years agoReserve 'yield' keyword
Kevin Ballard [Fri, 16 Aug 2013 19:49:40 +0000 (12:49 -0700)]
Reserve 'yield' keyword

Rename task::yield() to task::deschedule().

Fixes #8494.

10 years agort: Remove unused uv helpers
Brian Anderson [Sat, 10 Aug 2013 07:34:28 +0000 (00:34 -0700)]
rt: Remove unused uv helpers

10 years agort: Remove empty rust_upcall.h
Brian Anderson [Sat, 10 Aug 2013 06:41:17 +0000 (23:41 -0700)]
rt: Remove empty rust_upcall.h

10 years agort: Remove unused rust_clone_type_desc declaration
Brian Anderson [Sat, 10 Aug 2013 06:39:29 +0000 (23:39 -0700)]
rt: Remove unused rust_clone_type_desc declaration

10 years agort: Remove rust_stack
Brian Anderson [Sat, 10 Aug 2013 06:35:51 +0000 (23:35 -0700)]
rt: Remove rust_stack

10 years agort: Remove rust_refcount.h
Brian Anderson [Sat, 10 Aug 2013 06:16:51 +0000 (23:16 -0700)]
rt: Remove rust_refcount.h

10 years agort: Remove unused parts of rust_log
Brian Anderson [Sat, 10 Aug 2013 06:15:19 +0000 (23:15 -0700)]
rt: Remove unused parts of rust_log

10 years agort: Remove unused parts of rust_globals.h
Brian Anderson [Sat, 10 Aug 2013 06:09:36 +0000 (23:09 -0700)]
rt: Remove unused parts of rust_globals.h

10 years agort: Remove rust_signal.h
Brian Anderson [Sat, 10 Aug 2013 06:04:59 +0000 (23:04 -0700)]
rt: Remove rust_signal.h

10 years agoRemove the annihilate lang item
Brian Anderson [Sat, 10 Aug 2013 06:04:28 +0000 (23:04 -0700)]
Remove the annihilate lang item

10 years agort: Remove rust_env
Brian Anderson [Sat, 10 Aug 2013 05:21:01 +0000 (22:21 -0700)]
rt: Remove rust_env

10 years agoGive XorShiftRng::new() a random seed
Kevin Ballard [Fri, 16 Aug 2013 19:11:34 +0000 (12:11 -0700)]
Give XorShiftRng::new() a random seed

Fixes #8359.

10 years agoauto merge of #8534 : huonw/rust/tls-key-macro, r=alexcrichton
bors [Fri, 16 Aug 2013 15:05:10 +0000 (08:05 -0700)]
auto merge of #8534 : huonw/rust/tls-key-macro, r=alexcrichton

This allows the internal implementation details of the TLS keys to be
changed without requiring the update of all the users. (Or, applying
changes that *have* to be applied for the keys to work correctly, e.g.
forcing LLVM to not merge these constants.)

10 years agoauto merge of #8532 : kballard/rust/cstr-cleanup, r=erickt
bors [Fri, 16 Aug 2013 13:02:14 +0000 (06:02 -0700)]
auto merge of #8532 : kballard/rust/cstr-cleanup, r=erickt

Implement interior null checking in `.to_c_str()`, among other changes.

10 years agoAdd UUID support to libextra
Gavin Baker [Wed, 24 Jul 2013 13:10:15 +0000 (23:10 +1000)]
Add UUID support to libextra
- generate random UUIDs
- convert to and from strings and bytes
- parse common string formats
- implements Zero, Clone, FromStr, ToStr, Eq, TotalEq and Rand
- unit tests and documentation
- parsing error codes and strings
- incorporate feedback from PR review

10 years agoauto merge of #8530 : brson/rust/rt-backtrace, r=alexcrichton
bors [Fri, 16 Aug 2013 10:59:14 +0000 (03:59 -0700)]
auto merge of #8530 : brson/rust/rt-backtrace, r=alexcrichton

The new scheduler didn't preserve this behavior.

10 years agoImplement Clone and DeepClone for time types.
Chris Morgan [Fri, 16 Aug 2013 10:17:27 +0000 (20:17 +1000)]
Implement Clone and DeepClone for time types.

10 years agoImplement DeepClone for str types.
Chris Morgan [Fri, 16 Aug 2013 10:17:02 +0000 (20:17 +1000)]
Implement DeepClone for str types.

10 years agoauto merge of #8526 : blake2-ppc/rust/either-result, r=catamorphism
bors [Fri, 16 Aug 2013 08:56:16 +0000 (01:56 -0700)]
auto merge of #8526 : blake2-ppc/rust/either-result, r=catamorphism

Retry of PR #8471

Replace the remaining functions marked for issue #8228 with similar functions that are iterator-based.

Change `either::{lefts, rights}` to be iterator-filtering instead of returning a vector.

Replace `map_vec`, `map_vec2`, `iter_vec2` in std::result with three functions:

* `result::collect` gathers `Iterator<Result<V, U>>` to `Result<~[V], U>`
* `result::fold` folds `Iterator<Result<T, E>>` to `Result<V, E>`
* `result::fold_` folds `Iterator<Result<T, E>>` to `Result<(), E>`

10 years agoauto merge of #8518 : catamorphism/rust/issue-8498-workaround, r=brson
bors [Fri, 16 Aug 2013 06:56:14 +0000 (23:56 -0700)]
auto merge of #8518 : catamorphism/rust/issue-8498-workaround, r=brson

r? @brson

10 years agodoc: convert remaining uses of core:: to std::.
Huon Wilson [Fri, 16 Aug 2013 05:54:14 +0000 (15:54 +1000)]
doc: convert remaining uses of core:: to std::.

10 years agodoc: correct spelling in documentation.
Huon Wilson [Fri, 16 Aug 2013 05:41:28 +0000 (15:41 +1000)]
doc: correct spelling in documentation.

10 years agosyntax: add a local_data_key macro that creates a key for access to the TLS.
Huon Wilson [Thu, 15 Aug 2013 13:16:59 +0000 (23:16 +1000)]
syntax: add a local_data_key macro that creates a key for access to the TLS.

This allows the internal implementation details of the TLS keys to be
changed without requiring the update of all the users. (Or, applying
changes that have to be applied for the keys to work correctly, e.g.
forcing LLVM to not merge these constants.)

10 years agoBetter error message for unknown start of token
Kevin Ballard [Fri, 16 Aug 2013 04:16:40 +0000 (21:16 -0700)]
Better error message for unknown start of token

The span was fixed at some point to point to the correct character, but
the error message is still bad. Update it to emit the actual character
in question (potentially escaped).

Fixes #3747.

10 years agoauto merge of #7917 : catamorphism/rust/resolve-and-testcases, r=catamorphism
bors [Fri, 16 Aug 2013 03:56:12 +0000 (20:56 -0700)]
auto merge of #7917 : catamorphism/rust/resolve-and-testcases, r=catamorphism

10 years agotestsuite: xfailed test cases
Tim Chevalier [Fri, 19 Jul 2013 20:25:48 +0000 (13:25 -0700)]
testsuite: xfailed test cases

10 years agoauto merge of #8503 : thestinger/rust/iterator, r=alexcrichton
bors [Fri, 16 Aug 2013 01:23:14 +0000 (18:23 -0700)]
auto merge of #8503 : thestinger/rust/iterator, r=alexcrichton

10 years agorm obsolete test
Daniel Micay [Fri, 16 Aug 2013 01:12:54 +0000 (21:12 -0400)]
rm obsolete test

10 years agovec: rm redundant is_empty implementations
Daniel Micay [Wed, 14 Aug 2013 02:06:10 +0000 (22:06 -0400)]
vec: rm redundant is_empty implementations

10 years agoiterator: cleanup
Daniel Micay [Wed, 14 Aug 2013 01:41:50 +0000 (21:41 -0400)]
iterator: cleanup

10 years agovec: rm obsolete zip and zip_slice
Daniel Micay [Wed, 14 Aug 2013 01:29:16 +0000 (21:29 -0400)]
vec: rm obsolete zip and zip_slice

These are obsoleted by the generic iterator `zip` adaptor. Unlike
these, it does not clone the elements or allocate a new vector by
default.

10 years agotuple: remove obsolete ExtendedTupleOps
Daniel Micay [Wed, 14 Aug 2013 01:00:58 +0000 (21:00 -0400)]
tuple: remove obsolete ExtendedTupleOps

replaced by iterators (generic composable `map` and `zip` adaptors)

10 years agoupdate the iterator tutorial
Daniel Micay [Tue, 13 Aug 2013 04:37:50 +0000 (00:37 -0400)]
update the iterator tutorial

10 years agokinds: update documentation
Daniel Micay [Wed, 14 Aug 2013 00:46:50 +0000 (20:46 -0400)]
kinds: update documentation

10 years agoptr: inline the Clone implementation
Daniel Micay [Wed, 14 Aug 2013 00:37:05 +0000 (20:37 -0400)]
ptr: inline the Clone implementation

10 years agoFix error message when trait method ends with wrong token
Kevin Ballard [Fri, 16 Aug 2013 00:58:56 +0000 (17:58 -0700)]
Fix error message when trait method ends with wrong token

When parsing a trait function, the function must end with either `;` or
`{` (signifying a default implementation). The error message incorrectly
stated that it must be `;` or `}`.

Fixes #6610.

10 years agoauto merge of #8485 : alexcrichton/rust/add-tests, r=catamorphism
bors [Thu, 15 Aug 2013 22:41:11 +0000 (15:41 -0700)]
auto merge of #8485 : alexcrichton/rust/add-tests, r=catamorphism

Closes #3907
Closes #5493
Closes #4464
Closes #4759
Closes #5666
Closes #5884
Closes #5926
Closes #6318
Closes #6557
Closes #6898
Closes #6919
Closes #7222

10 years agoPointers to bound variables are stored after all patterns are matched.
Dmitry Ermolov [Wed, 14 Aug 2013 21:28:49 +0000 (01:28 +0400)]
Pointers to bound variables are stored after all patterns are matched.

Pointers to bound variables shouldn't be stored before checking pattern,
otherwise piped patterns can conflict with each other (issue #6338).

Closes #6338.

10 years agoAdd even more tests
Alex Crichton [Thu, 15 Aug 2013 21:22:36 +0000 (14:22 -0700)]
Add even more tests

Closes #8248
Closes #8249
Closes #8398
Closes #8401

10 years agoFix a typo in the ifmt dox
Alex Crichton [Wed, 14 Aug 2013 04:33:09 +0000 (21:33 -0700)]
Fix a typo in the ifmt dox

10 years agoTest for issue #6338.
Dmitry Ermolov [Thu, 15 Aug 2013 20:56:04 +0000 (00:56 +0400)]
Test for issue #6338.

10 years agoCleanup: remove useless parameter
Dmitry Ermolov [Sat, 10 Aug 2013 22:26:40 +0000 (02:26 +0400)]
Cleanup: remove useless parameter

10 years agoauto merge of #8515 : kballard/rust/saturating-checked, r=thestinger
bors [Thu, 15 Aug 2013 20:50:10 +0000 (13:50 -0700)]
auto merge of #8515 : kballard/rust/saturating-checked, r=thestinger

r? @thestinger

10 years agoFix select deschedule environment race for real this time, in light of task killing.
Ben Blum [Tue, 13 Aug 2013 21:31:13 +0000 (17:31 -0400)]
Fix select deschedule environment race for real this time, in light of task killing.

10 years agoauto merge of #8499 : nickdesaulniers/rust/issue7169, r=graydon
bors [Thu, 15 Aug 2013 16:26:08 +0000 (09:26 -0700)]
auto merge of #8499 : nickdesaulniers/rust/issue7169, r=graydon

review? @brson
tests are green

10 years agoauto merge of #8491 : robertknight/rust/7722-reservoir_sampling, r=graydon
bors [Thu, 15 Aug 2013 13:56:06 +0000 (06:56 -0700)]
auto merge of #8491 : robertknight/rust/7722-reservoir_sampling, r=graydon

Fixes #7722

I had a couple of queries:
- Should this return an array or an iterator?
- Should this be a method on iterators or on the rng? I implemented it in RngUtils as it seemed to belong with shuffle().

10 years agoauto merge of #8527 : pnkfelix/rust/fsk-visitor-vpar-defaults-step1, r=nikomatsakis
bors [Thu, 15 Aug 2013 11:56:06 +0000 (04:56 -0700)]
auto merge of #8527 : pnkfelix/rust/fsk-visitor-vpar-defaults-step1, r=nikomatsakis

Rewriting visit.rs to operate on a borrowed `&mut V` where `<V:Visitor>`

r? @nikomatsakis
r? @pcwalton

This is the first in a planned series of incremental pull requests.  (There will probably be five pull requests including this one, though they can be combined or split as necessary.)

Part of #7081.  (But definitely does *not* complete it, not on its own, and not even after all five parts land; there are still a few loose ends to tie up or trim afterwards.)

The bulk of this change for this particular PR is pnkfelix@3d83010, which has the changes necessary to visit.rs to support everything else that comes later.  The other commits are illustrating the standard mechanical transformation that I am applying.

One important point for nearly *all* of these pull requests: I was deliberately *not* trying to be intelligent in the transformation.

 * My goal was to minimize code churn, and make the transformation as mechanical as possible.
 * For example, I kept the separation between the Visitor struct (corresponding to the earlier vtable of functions that were potentially closed over local state) and the explicitly passed (and clones) visitor Env.  I am certain that this is almost always unnecessary, and a later task will be to go through an meld the Env's into the Visitors as appropriate.  (My original goal had been to make such melding part of this task; that's why I turned them into a (Env, vtable) tuple way back when.  But I digress.)
 * Also, my main goal here was to get rid of the record of `@fn`'s as described by the oldvisit.rs API.  (This series gets rid of all but one such case; I'm still investigating that.)  There is *still* plenty of `@`-boxing left to be removed, I'm sure, and even still some `@fn`'s too; removing all of those is not the goal here; its just to get rid of the encoded protocol of `@fn`'s in the (old)visit API.

To see where things will be going in the future (i.e., to get a sneak-preview of future pull-requests in the series), see:

 * https://github.com/pnkfelix/rust/commits/fsk-visitor-vpar-defaults-step1 (that's this one)
 * https://github.com/pnkfelix/rust/commits/fsk-visitor-vpar-defaults-step2
 * https://github.com/pnkfelix/rust/commits/fsk-visitor-vpar-defaults-step3
 * https://github.com/pnkfelix/rust/commits/fsk-visitor-vpar-defaults-step4
 * https://github.com/pnkfelix/rust/commits/fsk-visitor-vpar-defaults-step5
    * Note that between step 4 and step 5 there is just a single commit, but its a doozy because its the only case where my mechanical transformation did not apply, and thus more serious rewriting was necessary.  See commit pnkfelix@da902b2ff3b1e0bee9fc63cf00c449cceea8abf7

10 years agoauto merge of #8490 : huonw/rust/fromiterator-extendable, r=catamorphism
bors [Thu, 15 Aug 2013 09:56:08 +0000 (02:56 -0700)]
auto merge of #8490 : huonw/rust/fromiterator-extendable, r=catamorphism

If they are on the trait then it is extremely annoying to use them as
generic parameters to a function, e.g. with the iterator param on the trait
itself, if one was to pass an Extendable<int> to a function that filled it
either from a Range or a Map<VecIterator>, one needs to write something
like:

    fn foo<E: Extendable<int, Range<int>> +
              Extendable<int, Map<&'self int, int, VecIterator<int>>>
          (e: &mut E, ...) { ... }

since using a generic, i.e. `foo<E: Extendable<int, I>, I: Iterator<int>>`
means that `foo` takes 2 type parameters, and the caller has to specify them
(which doesn't work anyway, as they'll mismatch with the iterators used in
`foo` itself).

This patch changes it to:

    fn foo<E: Extendable<int>>(e: &mut E, ...) { ... }