Commit Graph

17981 Commits

Author SHA1 Message Date
bors
cf0f760560 auto merge of #6333 : bjz/rust/cond-macro, r=thestinger
Addressing issue #6037, this Scheme-style conditional helps to improve code clarity in instances where the `if`, `else if`, and `else` keywords obscure predicates undesirably.

Here is an example:

~~~rust
let clamped =
    if x > mx { mx }
    else if x < mn { mn }
    else { x };
~~~

Using `cond!`, the above could be written as:

~~~rust
let clamped = cond!(
    (x > mx) { mx }
    (x < mn) { mn }
    _        { x  }
);
~~~

The optional default case is denoted by `_`.

I have altered `std::fun_treemap` to demonstrate it in use. I am definitely interested in using it for some of the numeric functions, but I will have to wait for it to reach `stage0` first.
2013-05-14 18:11:00 -07:00
Brendan Zabarauskas
7e4a176dd3 Use parentheses for cond! macro instead of preceding pipes
This is temporary. Once the macro parser has improved or been re-written these can be removed.
2013-05-15 11:02:17 +10:00
bors
c30414f980 auto merge of #6471 : gifnksm/rust/reform-rational, r=brson
`std::ratio` module contains `BigRational` type, but the type is not usable by following reasons.
* `Ratio::new` requires `T: Copy + Num + Ord`, but `BigInt` is not implicitly copyable, because it contains unique vector.
* `BigInt` is not implements `Num`

So, I rewrite `Ratio` as follows.
* `Ratio` requires `T: Clone + Integer + Ord`.
  * `Copy` -> `Clone`: to be able to use `BigRational`
  * `Num` -> `Integer`: It is incorrect that a rational number constructed by two non-integer numbers.
* `BigInt` implements `Num` and `Orderable` which are required by `Integer` bound
2013-05-14 15:28:59 -07:00
bors
043d02213e auto merge of #6468 : gifnksm/rust/rposition-immutable, r=brson
`position` and `rposition` belonged to `ImmutableCopyableVector`, but they don't need the value is copyable.
2013-05-14 14:05:07 -07:00
Brendan Zabarauskas
b9824e18c2 Add Scheme-style cond! macro to syntax::ext::expand
Addresses issue #6037
2013-05-15 07:02:43 +10:00
bors
d217174987 auto merge of #6479 : brson/rust/flatpipes, r=brson 2013-05-14 12:25:54 -07:00
Brian Anderson
133aabc5bb Ignore two failing flatpipes tests 2013-05-14 11:35:10 -07:00
bors
06c46d5142 auto merge of #6467 : alexcrichton/rust/better-rusti, r=bstrie
These few commits address a few existing issues:

* #5469 - adding regression tests for `rusti`. This adds unit tests to the `rusti.rc` file (which needed some reorganization of the Makefile, see the first commit message). These are super-simple right now, and sadly can't test the output of the tests. I worked for a bit on making a compiletest version of the rusti tests, but I ended up hitting something which blocked me, although I've forgotten it by this point.
* #5937 - regression test added, and it's fixed
* #5803 - just doesn't appear to happen any more
* #5784 - it's no longer broken, and it no longer spits out warnings about unused variables.

I also did some investigation into #5774, and you may want to read the comment I left on the bug. The gist of the situation is that C++ exceptions across JIT code don't look like they're working, even though they [should be working](3aa1122ec2/src/rustllvm/RustWrapper.cpp (L387)). If anyone has any insight on this, that would be awesome!
2013-05-14 11:22:51 -07:00
Alex Crichton
2ab1da5b01 Fix rustpkg tests now that they're in a different location 2013-05-14 14:11:30 -04:00
Alex Crichton
8b87fd7ec0 Don't emit common warnings in rusti 2013-05-14 14:11:29 -04:00
Alex Crichton
9af04f3e77 Add regression tests for various other rusti issues 2013-05-14 14:11:08 -04:00
Alex Crichton
4a9d8ff1a7 Fix use statements with rusti 2013-05-14 14:11:07 -04:00
Alex Crichton
54f2147e8e Get unit tests for rusti working
* They didn't work before, because the location of the tests caused the
  'sysroot' option to crate lookup to be wrong for finding the correct stage's
  core/std libraries. This moves the compiled tests from the $host/test
  directory into a $host/$stage/test directory. This means that the sysroot will
  be correct and the core/std libraries can actually be found
* The LLVM bindings apparently aren't threadsafe, so we can't run multiple tests
  in parallel.
2013-05-14 14:11:07 -04:00
bors
767e3ae86c auto merge of #6434 : alexcrichton/rust/less-implicit-vecs, r=bstrie
This closes #5204 and #6421.

This also removes the `vecs_implicitly_copyable` lint (although now reading #6421, this may not be desired?). If we want to leave it in, it at least removes it from the compiler.
2013-05-14 10:10:54 -07:00
Alex Crichton
ffcc680f9c Fix test fallout from removing vecs_implicitly_copyable 2013-05-14 12:25:19 -04:00
Alex Crichton
5614e83e81 Remove vecs_implicitly_copyable from the compiler 2013-05-14 12:25:18 -04:00
Alex Crichton
ccfb3ebf03 rusti: Remove #[allow(vecs_implicitly_copyable)] 2013-05-14 12:25:18 -04:00
Alex Crichton
92d39fe4d5 syntax: Remove #[allow(vecs_implicitly_copyable)] 2013-05-14 12:24:43 -04:00
Alex Crichton
2951527528 compiletest: Remove #[allow(vecs_implicitly_copyable)] 2013-05-14 12:24:43 -04:00
Alex Crichton
9f104d4213 rustpkg: Remove #[allow(vecs_implicitly_copyable)] 2013-05-14 12:23:46 -04:00
bors
27c228fad7 auto merge of #6357 : dotdash/rust/fixfmt, r=bstrie
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 08:11:01 -07:00
Marvin Löbel
04de8f852c Fix cosmetics for fail!() calls 2013-05-14 16:36:24 +02:00
Björn Steinbrink
bdc182cc41 Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00
gifnksm
da9c1fbf27 libstd: Add tests for BigRational 2013-05-14 21:59:13 +09:00
gifnksm
76ecce0e0c libstd: Ratio requires Clone instead of Copy
This allows creating `Ratio<T>` which `T` is non-implicitly copyable types
such as `BigInt`.
2013-05-14 21:59:08 +09:00
gifnksm
41eaa97372 libstd: Rational requires Integer as type bounds instead of Num 2013-05-14 21:55:42 +09:00
gifnksm
e3695468b7 libstd: impl Orderable for BigUint/BigInt 2013-05-14 21:20:27 +09:00
gifnksm
5ce0795de5 libstd: impl Num for BigUint/BigInt 2013-05-14 19:27:20 +09:00
gifnksm
4e1fac89bb Move position and rposition methods to ImmutableVector trait 2013-05-14 18:10:50 +09:00
bors
84745b483f auto merge of #6463 : bjz/rust/numeric-traits, r=thestinger
This is part of the numeric trait reform tracked on issue #4819
2013-05-14 01:55:42 -07:00
bors
5a2f65fb50 auto merge of #6441 : alexcrichton/rust/issue-5531, r=luqmana
Also fix up all the fallout elsewhere throughout core. It's really nice being
able to have the prelude.

I'm not quite sure how resolution works with traits, but it seems to me like the public imports at the top-level of the core crate were leaking into the sub-crates, but that could also be working as intended. Regardless, things compile without the re-exports now.
2013-05-14 00:46:48 -07:00
bors
3aa1122ec2 auto merge of #6461 : thestinger/rust/fix_priority_queue, r=pcwalton
uninit() would result in potentially running a destructor on arbitrary
memory if the Ord implementation throws
2013-05-13 21:31:42 -07:00
bors
62640f5c05 auto merge of #6456 : brson/rust/libuv, r=brson
This includes 26fa6f8 which fixes #6258

@ILyoan I ported your patches forward and confirmed that they build but you should be aware of this upgrade.
2013-05-13 20:28:44 -07:00
Brian Anderson
d0da21d4ca Upgrade libuv 2013-05-13 19:29:19 -07:00
Brendan Zabarauskas
3515b4996a Remove unnecessary infinity check 2013-05-14 11:47:44 +10:00
Brendan Zabarauskas
44cb46f7bf Add ldexp and frexp functions 2013-05-14 11:24:55 +10:00
bors
7d81c80c65 auto merge of #6388 : recrack/rust/each2_mut, r=pcwalton
- vec.rs :add 'each2_mut function'
- testsuit : run-pass/vec-each2_mut.rs
2013-05-13 17:40:46 -07:00
Daniel Micay
e1a1992276 revert PriorityQueue to using init()
uninit() would result in potentially running a destructor on arbitrary
memory if the Ord implementation throws
2013-05-13 19:46:20 -04:00
Alex Crichton
66e1e51701 Remove re-exports from libcore/core.rc
Also fix up all the fallout elsewhere throughout core. It's really nice being
able to have the prelude.
2013-05-13 18:51:40 -04:00
bors
ad5bfd600d auto merge of #6387 : brson/rust/unstable, r=brson
r? @pcwalton

* Move `SharedMutableState`, `LittleLock`, and `Exclusive` from `core::unstable` to `core::unstable::sync`
* Modernize the `SharedMutableState` interface with methods
* Rename `SharedMutableState` to `UnsafeAtomicRcBox` to match `RcBox`.
2013-05-13 14:49:48 -07:00
bors
3abc5b3ffb auto merge of #6417 : pcwalton/rust/exprs-in-patterns, r=pcwalton
r? @graydon
2013-05-13 13:25:42 -07:00
Brian Anderson
369231beb4 core: Rename SharedMutableState to UnsafeAtomicRcBox 2013-05-13 12:13:56 -07:00
Brian Anderson
fa1d0477ed core: Move locks, atomic rc to unstable::sync 2013-05-13 12:13:56 -07:00
Brian Anderson
4f44624415 core: Move unstable to unstable/mod.rs 2013-05-13 12:13:33 -07:00
Patrick Walton
26a28dac86 test: Fix broken benchmark test 2013-05-13 11:26:15 -07:00
bors
1b883365bc auto merge of #6452 : alexcrichton/rust/fix-deps, r=bstrie
I changed the dependencies of librust in #6438, but I forgot to update the dependencies in the Makefile, this should have the dependencies right now.
2013-05-13 11:10:44 -07:00
Alex Crichton
ae07170bd8 Update make dependencies of librust 2013-05-13 13:47:05 -04:00
bors
935b7ba516 auto merge of #6443 : cmr/rust/resolution, r=bstrie
When trying to import nonexistent items from existing modules, specify that
that is what happened, rather than just reporting "unresolved name".

Ideally the error would be reported on the span of the import... but I do not see a way to get a span there. Help appreciated 😄
2013-05-13 09:28:46 -07:00
Patrick Walton
56a1ee8f84 librustdoc: Remove old-style extern mods from rustdoc tests. 2013-05-13 09:23:32 -07:00
Brendan Zabarauskas
8d4d2b00c5 Add inverse hyperbolic functions 2013-05-14 00:11:35 +10:00