Commit Graph

21228 Commits

Author SHA1 Message Date
Jan Kobler
c5c4a63aeb insert space
in the rust grammar

to avoid error messages like this:

  Exception: non-alpha apparent keyword: pub"

when using extract_grammar.py:

python2.7 src/etc/extract_grammar.py <doc/rust.md

Signed-off-by: Jan Kobler <eng1@koblersystems.de>
2013-08-18 08:00:23 +02:00
Jan Kobler
87761c1f99 extract_grammar symnames
add missing symnames

Signed-off-by: Jan Kobler <eng1@koblersystems.de>
2013-08-18 07:25:54 +02:00
bors
6a88415ed8 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.
2013-08-17 20:12:02 -07:00
bors
679102109f 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
2013-08-17 15:22:04 -07:00
bors
cb8a231eb8 auto merge of #8433 : brson/rust/rm-more-oldrt-crud, r=brson
Just deleting more stuff.
2013-08-17 12:51:57 -07:00
bors
7503396070 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.
2013-08-17 10:12:04 -07:00
Erick Tryzelaar
cc567085c0 Deny warnings in stage1+ libsyntax/librustc/librustdoc/librusti/librust 2013-08-17 08:42:39 -07:00
Erick Tryzelaar
ad5c676853 Fix warnings it tests 2013-08-17 08:42:35 -07:00
Erick Tryzelaar
e20d46056d Fix warnings in librustc and libsyntax 2013-08-17 08:41:42 -07:00
Erick Tryzelaar
be86bc81a7 Fix warnings in tests 2013-08-17 08:41:35 -07:00
bors
29a67d1dc2 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
```
2013-08-17 07:42:01 -07:00
bors
1942a7a3fb 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!
2013-08-17 05:12:03 -07:00
bors
8ac17731eb 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
2013-08-17 00:22:05 -07:00
Palmer Cox
b00aa12374 Crypto: Add tests for add_bytes_to_bits functions. 2013-08-17 00:22:27 -04:00
Palmer Cox
6386f887a7 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.
2013-08-17 00:22:27 -04:00
Palmer Cox
c707065325 MD5: Create an implementation of MD5. 2013-08-17 00:22:05 -04:00
Palmer Cox
a37f2844e0 Crypto: Add little-endian versions of existing functions: read_u32v_le and write_u32_le. 2013-08-17 00:22:04 -04:00
Michael Woerister
80fb2f2056 debuginfo: Added test cases for static struct and enum methods. 2013-08-16 22:30:43 +02:00
Michael Woerister
5abb7c3a67 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
2013-08-16 22:30:43 +02:00
Michael Woerister
0e7808c2e0 debuginfo: Support for combinations of Self type and type parameters. 2013-08-16 22:30:43 +02:00
Michael Woerister
024d644c68 debuginfo: Add test case for issue #8513. 2013-08-16 22:30:43 +02:00
Michael Woerister
c1734cef33 debuginfo: Implemented support for Self type parameter in trait methods with default implementation. 2013-08-16 22:30:43 +02:00
Michael Woerister
a36e53730f 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.
2013-08-16 22:30:43 +02:00
Michael Woerister
689929c51a debuginfo: Added support for self parameter in methods. 2013-08-16 22:30:42 +02:00
Michael Woerister
44557e7a33 debuginfo: Fixed crash occuring for parameterless closures. 2013-08-16 22:30:42 +02:00
Michael Woerister
5c9d7c2072 debuginfo: Added test cases for generic structs and enums.
Also, always set no_monomorphic_collapse flags if debuginfo is generated.
2013-08-16 22:30:42 +02:00
Michael Woerister
6c49c2df76 debuginfo: Properly handle monomorphization of generic functions. 2013-08-16 22:30:42 +02:00
Michael Woerister
907633b1bf 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
2013-08-16 22:27:38 +02:00
Michael Woerister
1dec27bed5 debuginfo: Fixed option-like-enum test case so it does not rely on undefined behavior. 2013-08-16 22:27:38 +02:00
Brian Anderson
a4d171e009 rt: Remove unused uv helpers 2013-08-16 13:24:25 -07:00
Brian Anderson
5052773ad8 rt: Remove empty rust_upcall.h 2013-08-16 13:24:25 -07:00
Brian Anderson
450f16eb25 rt: Remove unused rust_clone_type_desc declaration 2013-08-16 13:24:25 -07:00
Brian Anderson
da7d79dfbe rt: Remove rust_stack 2013-08-16 13:24:25 -07:00
Brian Anderson
8861ba6159 rt: Remove rust_refcount.h 2013-08-16 13:24:25 -07:00
Brian Anderson
cb89afc64e rt: Remove unused parts of rust_log 2013-08-16 13:24:25 -07:00
Brian Anderson
085dc55e13 rt: Remove unused parts of rust_globals.h 2013-08-16 13:24:24 -07:00
Brian Anderson
1b6292aaea rt: Remove rust_signal.h 2013-08-16 13:24:24 -07:00
Brian Anderson
9c71f4f1e0 Remove the annihilate lang item 2013-08-16 13:24:24 -07:00
Brian Anderson
5923cc3745 rt: Remove rust_env 2013-08-16 13:24:24 -07:00
bors
a1674b6150 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.)
2013-08-16 08:05:10 -07:00
bors
680eb71564 auto merge of #8532 : kballard/rust/cstr-cleanup, r=erickt
Implement interior null checking in `.to_c_str()`, among other changes.
2013-08-16 06:02:14 -07:00
Gavin Baker
328261aa54 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
2013-08-16 23:00:35 +10:00
bors
8caf517622 auto merge of #8530 : brson/rust/rt-backtrace, r=alexcrichton
The new scheduler didn't preserve this behavior.
2013-08-16 03:59:14 -07:00
bors
72b50e729d 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>`
2013-08-16 01:56:16 -07:00
bors
92af0db0a3 auto merge of #8518 : catamorphism/rust/issue-8498-workaround, r=brson
r? @brson
2013-08-15 23:56:14 -07:00
Huon Wilson
3ad23552fb 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.)
2013-08-16 14:37:24 +10:00
bors
253337de82 auto merge of #7917 : catamorphism/rust/resolve-and-testcases, r=catamorphism 2013-08-15 20:56:12 -07:00
Tim Chevalier
0266172eae testsuite: xfailed test cases 2013-08-15 19:22:26 -07:00
bors
1ad0cf5841 auto merge of #8503 : thestinger/rust/iterator, r=alexcrichton 2013-08-15 18:23:14 -07:00
Daniel Micay
3cec67bbf2 rm obsolete test 2013-08-15 21:12:54 -04:00