Commit graph

1022 commits

Author SHA1 Message Date
Brian Anderson
c9b16ac4c2 Add std::str::is_whitespace 2011-08-01 18:55:51 -07:00
Brian Anderson
1ad68eafd2 Add std::str::trim/trim_left/trim_right 2011-08-01 18:55:51 -07:00
Brian Anderson
598e25e091 Add std::char_slice 2011-08-01 18:55:51 -07:00
Brian Anderson
2f7ed33517 Ignore whitespace in argument lists in compiletest
Makes testing work with DEBUG=1
2011-08-01 16:41:20 -07:00
Eric Holk
939bca0d84 Added send and receive to comm library. 2011-08-01 15:58:39 -07:00
Eric Holk
b3d9d9b73c Objectified library chans and ports. 2011-08-01 15:58:30 -07:00
Eric Holk
5a673cc2c9 Started working on a library-based comm system. Creating and deleting ports work. 2011-08-01 15:58:30 -07:00
Marijn Haverbeke
4837a57df5 Add tests for destructuring locals 2011-08-01 17:52:43 +02:00
Brian Anderson
ec46f07e6e Add a task spawning benchmark
This is the kind of workload that the test runner generates - lots of tiny
little tasks - and currently it leaves the CPU underutilized.
2011-07-29 22:45:01 -07:00
Graydon Hoare
0c9b749d20 Enable kind checking on typarams, fix kind constraints in library and comp. 2011-07-29 18:48:15 -07:00
Lindsey Kuper
6ba4e34959 Reduced test case for current backwarding bug.
Still working on getting backwarding to play nicely with self and
overriding.  Currently can't fix issue #702 without breaking how self
and overriding interact.
2011-07-29 18:30:27 -07:00
Tim Chevalier
766e939857 Test case for previous commit 2011-07-29 18:00:10 -07:00
Brian Anderson
57e4efb894 Fix long lines 2011-07-29 15:20:24 -07:00
Brian Anderson
d4616725ad Add issue numbers to FIXMEs in compiletest 2011-07-29 15:11:14 -07:00
Brian Anderson
d03af073b4 Close pipes under failure scenario in compiletest 2011-07-29 14:37:00 -07:00
Brian Anderson
b306a0d714 Get compile tests to run in parallel
Takes a lot of workarounds. The biggest problem is that boxes still don't seem
to be moved across channels and bad things happen when the receiver destroys
them. So there's all sorts of defensive cloning and scoping going on here to
make the box lifetimes come out right.
2011-07-29 14:36:56 -07:00
Lindsey Kuper
3595f1f966 Disallow overloading a method with one of different type. Closes #703. 2011-07-29 13:44:34 -07:00
Graydon Hoare
f3c05b9fae Turn on kind propagation for typarams. Annotate a bunch of typarams in rustc and libstd. 2011-07-29 12:58:52 -07:00
Marijn Haverbeke
b1d2a00b4a Remove support for obj dtors 2011-07-29 14:03:24 +02:00
Marijn Haverbeke
30d2e358be Replace obj dtors with resources in stdlib and rustc 2011-07-29 14:03:24 +02:00
Marijn Haverbeke
5adf87a2c6 Fix iter_structural_ty_full for resource types
The compiler would blow up when compiling a structural type
containing a resource.
2011-07-29 11:44:29 +02:00
Brian Anderson
3896524750 Drop the previous reference when receiving. Closes #763 2011-07-28 18:22:15 -07:00
Brian Anderson
021bfb4b9b Reenable expr-scope test. Disable under check-fast 2011-07-28 14:14:29 -07:00
Paul Stansifer
86f337484e Change macro syntax to accept a single expr, not a sequence of exprs. 2011-07-28 12:12:08 -07:00
Eric Holk
5302cde188 Made task threads wait instead of sleep, so they can be woken up. This appears to give us much better parallel performance.
Also, commented out one more unsafe log and updated rust_kernel.cpp to compile under g++
2011-07-28 10:47:28 -07:00
Eric Holk
e697a52359 Adding a function to stdlib to set the min stack size, for programs
that absolutely will not succeed with a large default stack. This
should be removed once we have stack grown working.

Also updated word-count to succeed under the new test framework.
2011-07-28 10:47:28 -07:00
Eric Holk
117e251733 Re-removing a test case that was moved during the big test suite overhaul. 2011-07-28 10:47:28 -07:00
Eric Holk
62bc6b5113 Per-thread scheduling. Closes #682.
Tasks are spawned on a random thread. Currently they stay there, but
we should add task migration and load balancing in the future. This
should drammatically improve our task performance benchmarks.
2011-07-28 10:47:28 -07:00
Lindsey Kuper
c15871ac51 Test case for issue #435. 2011-07-28 10:37:46 -07:00
Graydon Hoare
acac6abc85 Parse, store and print type parameter kind constraints. 2011-07-28 17:22:59 +00:00
Marijn Haverbeke
1836f59d9a Disable expr-scope test, since it break windows 2011-07-28 12:02:08 +02:00
Josh Matthews
f0e29c92aa :: is allowed to start an expression. Close #762. 2011-07-28 02:33:24 -04:00
Brian Anderson
e81d6d28e7 Don't stop at first test failure
Since compiletest is setting up its own test tasks it needs to configure them
the correct way, which means allowing them to leak.
2011-07-27 19:04:57 -07:00
Brian Anderson
51ef7a3676 Clean up output a bit when running verbose compile tests 2011-07-27 19:04:56 -07:00
Brian Anderson
e9dd971129 Capture stderr when running compile tests. Closes #755 2011-07-27 19:04:56 -07:00
Brian Anderson
278d360525 Refactor compiletest 2011-07-27 19:04:56 -07:00
Michael Sullivan
d1298f768c Have bind support non-alias parametric non-bound arguments.
This was previously disallowed by the typechecker and not properly handled
in trans. I removed the typechecker check (replacing it with a simpler
check that spawned functions don't have type params) and fixed trans.
Closes #756.
2011-07-27 18:46:46 -07:00
Michael Sullivan
4de0b3d947 Allow already bound functions to be bound again.
This commit just disables the check. All of the real work was in previous
commits that moved the target function into the bindings part of the closure
that is tracked by the tydesc.
Closes #754.
2011-07-27 18:46:46 -07:00
Michael Sullivan
04611a3e56 Remove the bind-alias test, since binding to aliases is fine. 2011-07-27 16:14:57 -07:00
Brian Anderson
80d6ee9ae7 Remove task::worker harder 2011-07-27 16:07:31 -07:00
Brian Anderson
92e9382193 Remove task::worker
It was too unsafe to live. It already apeared to be causing problems with
eholk's incoming task changes, so I'm killing it now before it can spread.
2011-07-27 15:53:47 -07:00
Brian Anderson
0923d67096 Fix comment placement in compiletest 2011-07-27 11:17:03 -07:00
Marijn Haverbeke
edd1a0230e Fix nil pattern case to handle for parser adjustment 2011-07-27 16:55:49 +02:00
Marijn Haverbeke
6e2a7bff7f Fix damage done by the pretty-printer 2011-07-27 15:54:33 +02:00
Marijn Haverbeke
df7f21db09 Reformat for new syntax 2011-07-27 15:54:33 +02:00
Brian Anderson
bcb5c4d54f Run compile tests in a way that's safe in a multithreaded environment
In theory. There's still something leaking but I hope it's no longer due to
the test runner doing unsafe things.

This is a pretty nasty patch, working around limitations in the type and task
systems, and it makes the std::test API a little uglier.
2011-07-26 18:39:55 -07:00
Brian Anderson
1c780b4203 Make the setenv tests threadsafe(ish) 2011-07-26 17:47:36 -07:00
Brian Anderson
d52169686b Dump all subprocess output to stdout when running verbose compiler tests 2011-07-26 15:36:58 -07:00
Michael Sullivan
4c17cb73a2 Add a bunch of tests for blocks. 2011-07-26 12:34:38 -07:00
Brian Anderson
e37dd2646a Clone all data before before putting it in a test closure
Putting shared boxes into a closure then running that closure in parallel
tasks seems like a recipe for refcounting disaster.

This doesn't completely fix the problems when running in parallel, but I'm
working on it.
2011-07-26 11:12:20 -07:00
Brian Anderson
f110c20609 Join the process server after running all compile tests 2011-07-26 11:12:20 -07:00
Brian Anderson
067cb6d537 Run test process from a dedicated task
This avoids a race wherein test tasks could run processes that stole the
environment of other tasks's processes.
2011-07-26 11:12:20 -07:00
Paul Stansifer
d11c887382 Add basic support for blocks and types in macros. 2011-07-26 11:09:37 -07:00
Marijn Haverbeke
2509a3dcae Resolve loop collection expressions in the right scope
Closes #745
2011-07-26 15:52:59 +02:00
Marijn Haverbeke
bc9db454a0 Fixup test changes 2011-07-26 14:56:24 +02:00
Marijn Haverbeke
c0976ad70b Properly parse 'auto' for loop variable types 2011-07-26 14:53:01 +02:00
Marijn Haverbeke
f8968d1e71 Remove uses of tuples from the test suite 2011-07-26 14:49:40 +02:00
Brian Anderson
ac2424dd22 Run test tasks in parallel according to RUST_THREADS. Issue #734 2011-07-25 16:36:38 -07:00
Brian Anderson
2de43c220c Disable task-comm-15. Fails with multiple threads. 2011-07-25 16:34:49 -07:00
Brian Anderson
758c11b22c Ignore various files that are probably not tests when searching for tests
Closes #732
2011-07-25 12:20:23 -07:00
Marijn Haverbeke
beab6ba8aa Add a pass that checks for unreachable alt arms 2011-07-25 13:52:59 +02:00
Brian Anderson
bd81adabff Add task::send and task::recv 2011-07-24 16:18:31 -07:00
Brian Anderson
73fed01108 Add task::worker. Spawns a task and returns a channel to it
It takes a lot of boilerplate to create a task and establish a way to talk to
it. This function simplifies that, allowing you to write something like
'worker(f).chan <| start'. Implementation is very unsafe and only works for a
few types of channels, but something like this is very useful.
2011-07-24 16:18:05 -07:00
Brian Anderson
b82bedb28e Reindent lib-task.rs 2011-07-24 16:17:25 -07:00
Brian Anderson
2573fe7026 The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test
runners. I believe that all existing functionality has been
preserved. The primary objective is to dogfood the Rust test
framework.

A few main things happen here:

1) The run-pass/lib-* tests are all moved into src/test/stdtest. This
is a standalone test crate intended for all standard library tests. It
compiles to build/test/stdtest.stageN.

2) rustc now compiles into yet another build artifact, this one a test
runner that runs any tests contained directly in the rustc crate. This
allows much more fine-grained unit testing of the compiler. It
compiles to build/test/rustctest.stageN.

3) There is a new custom test runner crate at src/test/compiletest
that reproduces all the functionality for running the compile-fail,
run-fail, run-pass and bench tests while integrating with Rust's test
framework. It compiles to build/test/compiletest.stageN.

4) The build rules have been completely changed to use the new test
runners, while also being less redundant, following the example of the
recent stageN.mk rewrite.

It adds two new features to the cfail/rfail/rpass/bench tests:

1) Tests can specify multiple 'error-pattern' directives which must be
satisfied in order.

2) Tests can specify a 'compile-flags' directive which will make the
test runner provide additional command line arguments to rustc.

There are some downsides, the primary being that Rust has to be
functioning pretty well just to run _any_ tests, which I imagine will
be the source of some frustration when the entire test suite
breaks. Will also cause some headaches during porting.

Not having individual make rules, each rpass, etc test no longer
remembers between runs whether it completed successfully. As a result,
it's not possible to incrementally fix multiple tests by just running
'make check', fixing a test, and repeating without re-running all the
tests contained in the test runner. Instead you can filter just the
tests you want to run by using the TESTNAME environment variable.

This also dispenses with the ability to run stage0 tests, but they
tended to be broken more often than not anyway.
2011-07-24 15:34:34 -07:00
Eric Holk
63e77a3de1 Attempt to put out burning Windows tinderbox. 2011-07-23 13:01:30 -07:00
Eric Holk
8878b128ba More work on word-count.
Updated the MapReduce protocol so that it's correct more often. It's
still not perfect, but the bugs repro less often now.

Also found a race condition in channel sending. The problem is that
send and receive both need to refer to the _unread field in
circular_buffer. For now I just grabbed the port lock to send. We can
probably get around this by using atomics instead.
2011-07-22 18:45:34 -07:00
Eric Holk
404d4e0528 Adding test case dealing with communication and hashmaps. 2011-07-22 18:45:34 -07:00
Eric Holk
c7e967148c Task-ified the word count program.
This meant most of the generic-ness of it had to go away, since our
type system doesn't quite support it yet. Hopefully someday...

This version has lots of memory management errors. My next commit will
hopefully fix these.
2011-07-22 18:45:34 -07:00
Paul Stansifer
e18d70fe12 Implement Macro By Example. 2011-07-22 16:53:43 -07:00
Eric Holk
4a6ccf3b0f Adding test case for #687.
The test no longer repros after a lot of my recent channel work.

Closes #687.
2011-07-22 16:22:20 -07:00
Eric Holk
54be5b044f Fixing (or at least improving) translation of move semantics for send and receive. This let's us run all of the task-comm tests. 2011-07-22 16:05:51 -07:00
Lindsey Kuper
e71f261e3f Exercise self-calls and overriding together a bit more. 2011-07-22 13:29:46 -07:00
Lindsey Kuper
fefeebce24 Getting rid of obsolete comments. 2011-07-22 13:10:44 -07:00
Eric Holk
898083f8fc Commenting out the huge-memory-using lines in pfib. 2011-07-22 11:55:07 -07:00
Brian Anderson
07732545d2 Add xfail-stage3 directives to tests
The new test runners run stage 3
2011-07-22 10:18:28 -07:00
Marijn Haverbeke
bc33897525 Revert "Enable run-pass/lib-run on win32. Closes #714"
This reverts commit 1348a383c3.

Seems that this test is still broken on win.
2011-07-22 09:59:27 +02:00
Marijn Haverbeke
93ffed4c16 Fix unboxing in alias pass
The alias checker would only deref once for autoderef, and only deref
boxes. It should now do the right thing. Closes #725.
2011-07-22 09:29:01 +02:00
Brian Anderson
1348a383c3 Enable run-pass/lib-run on win32. Closes #714 2011-07-21 19:52:27 -07:00
Brian Anderson
ed25dfe2ca Disable run-pass/lib-io.rs on mac 2011-07-21 19:36:55 -07:00
Brian Anderson
06a6005447 Use correct win file open constants, per MinGW 2011-07-21 18:23:15 -07:00
Tim Chevalier
a9a1392b2c Instantiate function preconditions inside the function body
so that if we have a function like:
f(...) : p(x) {
  ...
}

p(x) is true inside the body of f.

Closes #694.
2011-07-21 16:11:34 -07:00
Lindsey Kuper
451e438ed0 Un-xfail tests. 2011-07-21 15:28:00 -07:00
Eric Holk
d79afd7916 Improving move semantics for channel operations.
This lets us un-XFAIL task-comm-10.rs.
2011-07-21 11:51:22 -07:00
Eric Holk
3ae4dcd41e Lots of work on memory tracking and channels.
We're trying to get closer to doing correct move semantics for channel
operations. This involves a lot of cleanup (such as removing the
unused sched parameter from rust_vec constructor) and making
circular_buffer kernel_owned.

Added tagging for memory allocations. This means we give a string tag
to everything we allocate. If we leak something and TRACK_ALLOCATIONS
is enabled, then it's much easier now to tell exactly what is leaking.
2011-07-21 11:51:22 -07:00
Tim Chevalier
8a7f2e0fe5 Parse nil literals (including in patterns)
Closes #622.
2011-07-20 16:02:53 -07:00
Lindsey Kuper
431cb9a345 Test method overriding a little more. 2011-07-20 15:49:33 -07:00
Lindsey Kuper
336949a590 Test case for issue #718. 2011-07-20 15:47:29 -07:00
Lindsey Kuper
7a919da04e Method overriding tests suddenly pass valgrind for some reason.
I'm not sure if this is because of changes to glue generation in the
last few days while I've been working on other things, or if it's a
side effect of the improvements I made to typechecking for anonymous
objects, or something else, but I guess I'll take it!

Closes issue #543.
2011-07-20 12:49:54 -07:00
Lindsey Kuper
94f2a7b9a7 'Overriding' is a more accurate name than 'overloading' for these. 2011-07-20 12:22:55 -07:00
Lindsey Kuper
2eb4762936 Typechecking self-calls in anon objs. Closes #540. 2011-07-19 19:52:21 -07:00
Tim Chevalier
bd4aeef78b Beginnings of support for constrained types
Programs with constrained types now parse and typecheck, but
typestate doesn't check them specially, so the one relevant test
case so far is XFAILed.

Also rewrote all of the constraint-related data structures in the
process (again), for some reason. I got rid of a superfluous
data structure in the context that was mapping front-end constraints
to resolved constraints, instead handling constraints in the same
way in which everything else gets resolved.
2011-07-19 18:57:28 -07:00
Brian Anderson
652214d7f9 Fix calculation of sizeof boxed ivec of str in rt. Closes #712 2011-07-19 16:55:45 -07:00
Brian Anderson
00e017f60e Disable run-pass/lib-run on win32. Issue #714
Trying to get the tinderbox green again. Will pursue later.
2011-07-19 15:55:15 -07:00
Lindsey Kuper
18162d3261 Some progress on issue #540. 2011-07-19 14:30:53 -07:00
Lindsey Kuper
a33bc56e43 Reduced test case for issue #540. 2011-07-19 12:48:06 -07:00
Erick Tryzelaar
b82c9c9e79 xfail simple-qsort.rs test at stage0. 2011-07-19 11:39:04 -07:00
Brian Anderson
fb9a117743 Fix an invalid memory access in run_program and friends 2011-07-19 10:15:16 -07:00
Brian Anderson
7e55061def Add str::replace 2011-07-18 16:16:48 -07:00
Brian Anderson
689f5f487c Add str::is_empty, is_not_empty preds 2011-07-18 16:16:48 -07:00
Lindsey Kuper
b6fc86ae5a Sane error message for self-call in non-obj context. Closes #707. 2011-07-18 15:58:36 -07:00
Michael Sullivan
71909a64bc Fix qsort to not skip the right side when the pivot element gets put at index 0.
Closes #705.
2011-07-18 15:03:31 -07:00
Brian Anderson
ad1c0e6308 Reformulate x86stdcall test so it works with check-fast
Hopefully this puts out the burning win32 tinderbox
2011-07-18 14:59:44 -07:00
Brian Anderson
b78eee8732 Fix native-type-mismatch test on win32 2011-07-18 13:56:19 -07:00
Brian Anderson
cc7ae32ba1 Add setenv to standard library 2011-07-18 13:56:19 -07:00
Brian Anderson
c40d6265ce Support x86 stdcall convention
This allows rust to call the Win32 API
2011-07-18 13:56:15 -07:00
Brian Anderson
20a3adbc08 Revert "Add setenv to standard library"
This reverts commit 6fb168b3db.
2011-07-17 19:16:18 -07:00
Brian Anderson
6fb168b3db Add setenv to standard library 2011-07-17 18:50:01 -07:00
Brian Anderson
4b7884e1fa Removing error logging from test 2011-07-16 19:56:12 -07:00
Brian Anderson
64d43be647 Sort tests before running them. Issue #428 2011-07-16 17:58:32 -07:00
Brian Anderson
8c4f1652ec Add ivec::zip/unzip 2011-07-16 17:36:11 -07:00
Brian Anderson
a52c3e0444 Remove unused variable from test tests 2011-07-16 16:48:33 -07:00
Lindsey Kuper
69abf0a5ff Revised plan of attack for backwarding functions. 2011-07-15 17:23:20 -07:00
Lindsey Kuper
c4265209a6 More tests for anonymous objects. Issues #702, #703. 2011-07-15 15:33:40 -07:00
Brian Anderson
ced8393f20 Modify task::join to indicate how the task terminated
This involves sticking yet another field into the task structure
2011-07-15 10:07:29 -07:00
Brian Anderson
ed6f9bb677 Add tests for unsupervise 2011-07-14 18:50:22 -07:00
Brian Anderson
20e94de392 Add a flag to run ignored tests. Issue #428 2011-07-14 17:13:12 -07:00
Brian Anderson
81acf69f97 Add head and tail functions to std::ivec
They even have typestate preconditions
2011-07-14 17:13:12 -07:00
Brian Anderson
139aaa1616 Add is_empty, is_not_empty preds to std::ivec 2011-07-14 17:13:12 -07:00
Brian Anderson
b3dee95514 Add a facility for ignoring tests. Issue #428
Adding the #[ignore] attribute will cause the test not to be run, though it
will still show up in the list of tests.
2011-07-14 13:51:30 -07:00
Brian Anderson
f4beac4a43 Revert "Allow main to return int"
This reverts commit 8c94d8fd54.

There's no mechanism to actually return the value from main, so all this does
is allow main -> int to compile. Per #688, the program returns non-zero on
failure, so it's not obvious that this change is appropriate at this time.
2011-07-14 10:37:28 -07:00
Brian Anderson
fc67dddb9b XFAIL some tests in stage 0 2011-07-14 10:27:02 -07:00
Brian Anderson
8c94d8fd54 Allow main to return int 2011-07-13 19:22:53 -07:00
Tim Chevalier
f26ca025de Make resolve and the typechecker check for a main fn of the
correct type

This means if a non-library program leaves out the main program,
the error gets caught earlier than link.

Closes #626.
2011-07-13 18:30:53 -07:00
Graydon Hoare
39151f2ad8 Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases. 2011-07-13 15:44:09 -07:00
Tim Chevalier
6b86dcde67 Add test case from issue #675. The previous fix actually fixes this too. 2011-07-13 15:04:29 -07:00
Tim Chevalier
5e1a6dac44 Parse nullary ret correctly
ret is similar to fail: if not followed by an expression, it
should be parsed as a ret without an argument. The old version would
fail if ret was followed by a close paren (for example). Fixed it.

Closes #676.
2011-07-13 15:00:59 -07:00
Marijn Haverbeke
be4f7354b4 Add box patterns
An @ can now be prepended to a pattern to unbox something during
pattern matching.

Closes #661
2011-07-13 11:11:43 +02:00
Graydon Hoare
e53cfb979b Fix fast-check target by disabling code snippet printing on warnings (broken on .rc files) and adding an xfail-fast flag for global-scope.rs. 2011-07-12 17:36:57 -07:00
Brian Anderson
41a3888da7 Fix type inference of fn tail expressions. Closes #680 2011-07-12 16:54:46 -07:00
Eric Holk
1ea449e2f6 Updating and unXFAILing somet communication tests. 2011-07-12 15:27:36 -07:00
Patrick Walton
27834c2a65 test: Switch lib-either over to interior vectors. Puts out burning tinderbox. 2011-07-12 15:09:44 -07:00
Tim Chevalier
f7a1006a07 Make resolve check for type-variable name-shadowing
Capturing a type argument in the enclosing scope should be an error --
this commit implements that check in resolve, avoiding a potential
assertion failure in trans.

Closes #648.
2011-07-12 13:42:05 -07:00
Tim Chevalier
21b94d57d5 Change typestate to use visit instead of walk
Typestate was failing to check some code because if it saw an item,
it would quit immediately. This was to avoid checking nested items
in the same context as the lexically enclosing item, but it was
having the wrong effect: not checking the code after the item at all.

Fixed by switching to visit and skipping over items in a proper
nested fashion. Closes #668.
2011-07-12 11:22:31 -07:00
Paul Stansifer
9a0e85a920 Change "etc" syntax for record patterns from {a:b ...} to {a:b, _}. 2011-07-11 18:52:50 -07:00
Paul Stansifer
425732311a Move macro expansion to a separate phase, change macro syntax, and add parse_sess to session. 2011-07-11 18:52:50 -07:00
Tim Chevalier
1870e97559 Visit the type argument in a port expression
This closes #664.
2011-07-11 18:12:00 -07:00
Tim Chevalier
e1620def9f In typeck, check for dynamically sized by-value arguments to thunks
A check in trans didn't have a corresponding check in typeck, causing
some programs (to wit, compile-fail/chan-parameterized-args.rs - part of this
commit) to fail with an assertion failure in trans instead of a type error.
Fixed it. In short, arguments that are future thunk arguments (any spawn
arguments, and _ arguments in bind) need to either not contain type params
or type vars, or be by-reference.

Closes #665.
2011-07-11 17:32:00 -07:00
Patrick Walton
05390b4b38 rustc: Implement explicit global scope resolution via leading "::"; add a test case 2011-07-11 16:02:16 -07:00
Tim Chevalier
9427864f33 Unify the rhs and lhs types in a send
Closes #662.

One-line fixes are always the best :-D
2011-07-11 15:24:47 -07:00
Patrick Walton
79ce5a4614 rustc: Implement pointer dereference; add a test case 2011-07-11 15:19:16 -07:00
Michael Sullivan
4618e802db Fix comparisons of the nil type to do something sensible.
Closes #576.
2011-07-11 14:45:21 -07:00
Eric Holk
a84310aa48 Started working on MapReduce.
Currently it's only sequential, but it can do word frequency
counting. In an ideal world it would all be polymorphic, but that
pushes the limits of our type system right now. We can generalize it
later.
2011-07-11 14:05:09 -07:00
Michael Sullivan
7340824cbc Fix autoderef of function calls when the function is not an lval.
As it turns out, the correct way to handle this is much simpler than what I
did originally.
Also add more tests.
2011-07-11 11:38:01 -07:00
Michael Sullivan
418aa52510 Add a test that exercises these cases in bind. 2011-07-11 11:37:56 -07:00
Marijn Haverbeke
7595fe5153 Implement record patterns
Closes #469.
2011-07-11 15:32:41 +02:00
Marijn Haverbeke
86ee3454a1 Implement or-patterns in case clauses
You can now say

    expr_move(?dst, ?src) | expr_assign(?dst, ?src) { ... }

to match both expr_move and expr_assign. The names, types, and number
of bound names have to match in all the patterns.

Closes #449.
2011-07-11 11:01:54 +02:00
Patrick Walton
d30f22eb65 rt: Remove the _2 prefix from intrinsics; all rust-intrinsics now use explicit return pointers 2011-07-10 01:20:18 -07:00
Patrick Walton
f42c94740a rustc: Make rust-intrinsics take an explicit return pointer 2011-07-09 21:13:25 -07:00
Brian Anderson
9af59f9d81 Add sha1 and int tests to stdtest. Issue #428 2011-07-09 12:35:30 -07:00
Brian Anderson
45b00935f3 Begin running the test for int::pow
Somehow this has been disabled forever
2011-07-09 12:35:30 -07:00
Tim Chevalier
9ec5e90608 Tests for constraint propagation 2011-07-08 22:25:57 -07:00
Brian Anderson
7498d03693 Improve the error message for import glob collisions. Closes #482
Instead of noting where the imported things were defined, note where they were
imported. This is more useful and avoids issue #482.
2011-07-08 18:55:01 -07:00
Brian Anderson
394b8fcd1c Add test case for issue #333. Closes #333
This has been fixed by a mystery hacker.
2011-07-08 17:43:44 -07:00
Eric Holk
79ca673af7 Adding more support for working with u64s. 2011-07-08 14:02:26 -07:00
Patrick Walton
7c66894a71 rustc: Do dynamic size calculations properly when concatenating interior vectors. Closes #640. 2011-07-08 11:29:29 -07:00
Marijn Haverbeke
c7bfef43c8 Ignore current scope when resolving self-shadowing imports
That is, for example, import x::y::x, which defines a local x,
and thus wouldn't be able to find x::y anymore.

Closes issue #624
2011-07-08 16:04:40 +02:00
Marijn Haverbeke
022363a674 Auto-bind generic functions when their value is taken in non-call context
trans::trans_lval will now autobind if the given expression was the
name of a generic functions. Those callees (trans_call and trans_bind)
that are interested in the generics information call trans_lval_gen
now.
2011-07-08 14:28:46 +02:00
Eric Holk
2d57b25f6b Added a stress test mode to pfib. 2011-07-07 18:22:27 -07:00
Lindsey Kuper
e7111fe147 Un-xfail a test. 2011-07-07 17:39:35 -07:00
Lindsey Kuper
3243144046 Fix a bug that was interfering with method overriding. Issue #543.
Previously, we were creating both a normal vtable entry and a
forwarding function for overriding methods, when they should have just
gotten a vtable entry.  This patch fixes that.
2011-07-07 17:29:15 -07:00
Marijn Haverbeke
3bdbf74d47 Make moving of temporaries do the right thing, use it to optimize
This adds support for dropping cleanups for temporary values when they
are moved somewhere else. It then adds wraps most copy operations
(return, put in data structure, box, etc) in a way that will fall back
to a move when it is safe.

This saves a lot of taking/dropping, shaving over a megabyte off the
stage2/rustc binary size.

In some cases, most notably function returns, we could detect that the
returned value is a local variable, and can thus be safely moved even
though it is not a temporary. This will require putting some more
information in lvals.

I did not yet handle function arguments, since the logic for passing
them looked too convoluted to touch. I'll probably try that in the
near future, since it's bound to be a big win.
2011-07-07 15:54:01 +02:00
Lindsey Kuper
130006cdda Tie the knot for self-calls inside extended objects. Closes #539. 2011-07-06 18:39:01 -07:00
Brian Anderson
2f7bc90514 Add a stdtest crate to hold the standard library tests
This will link to std and compile with the --test flag. Eventually the
run-pass/lib* tests will move here.

We could also put the std tests directly into the library and compile both a
library version and a test version, but I think this way will make for faster
builds.

Issue #428
2011-07-06 14:39:40 -07:00
Brian Anderson
0eac640fdd Swap the expected/actual for typechecking fields of updated records
In 'rec(a = b with c)', if a exists in c then the expected type for b is the
type of c.
2011-07-06 14:04:52 -07:00
Lindsey Kuper
6bd80d0121 Add a compile-fail test for attempts to extend non-objects. 2011-07-06 10:47:36 -07:00
Marijn Haverbeke
8e585e7008 Support paren-free and lightweight-case syntax
(The old syntax is still supported as well, for now.)

It is now possible to leave out the parens around if, while, and
do/while conditions, and around alt expressions. Cases in an alt block
can now leave off the case keyword and parens around the pattern.

After the next snapshot, we can start migrating our code to use the
new alt syntax, probably with a pretty-printer pass. The paren-free
syntax will remain optional (you may always parenthesize expressions),
but the old case syntax will no longer be supported in the future.
2011-07-06 17:50:52 +02:00
Tim Chevalier
f279e0d76e Handle pattern-bound upvars
If a closure inside a case alternative (for example, a for each loop)
referenced a pattern-bound variable, this would cause an assertion
failure in trans. Changed trans::collect_upvars to handle pattern-bound
vars correctly.

Incidentally, eliminated all direct uses of option::get in trans.
2011-07-05 19:58:49 -07:00
Patrick Walton
1bba585044 stdlib: Implement ivec::foldl 2011-07-05 18:29:47 -07:00
Brian Anderson
2cb129355b Change ast::meta_name_value to accept any literal, not just string
This isn't useful for much of anything yet, since metadata::encoder doesn't
know how to handle the non-string variants.

Issue #611
2011-07-05 17:25:18 -07:00
Patrick Walton
8261d2e6fb stdlib: Add filter_map to ivec 2011-07-05 17:22:02 -07:00
Brian Anderson
375f0b2211 Require that the meta items in a use statement have unique names 2011-07-05 16:12:24 -07:00
Tim Chevalier
a793b85fbd Handle fail inside a for-each loop properly 2011-07-05 16:05:38 -07:00
Brian Anderson
b79ea489e3 Support conditional compilation of native items. Closes #610 2011-07-05 13:30:00 -07:00
Brian Anderson
8499c77cee Parse attributes for native items. Closes #609 2011-07-05 12:43:44 -07:00
Brian Anderson
6f8bc404f8 Error if the link attribute has duplicate items. Issue #614 2011-07-05 11:46:02 -07:00
Marijn Haverbeke
c59ebf0f01 Add a test file for distinct ty_native types
This should have gone into patch
77f5d14f14, had I not forgotten to add
the file.
2011-07-05 11:50:41 +02:00
Patrick Walton
001397da3c stdlib: Add ivec::any() and ivec::all(); put out burning tinderbox 2011-07-04 23:52:47 -07:00
Patrick Walton
f71c8dd918 stdlib: Implement interior vector map 2011-07-04 22:48:42 -07:00
Patrick Walton
d3a4102bc1 stdlib: Add an inefficient implementation of ivec::pop 2011-07-04 21:20:18 -07:00
Josh Matthews
a2775a5b72 Make non-str fail expression a type checking failure instead of a translation one. 2011-07-03 21:46:17 -07:00
Tim Chevalier
b110bbf886 Un-XFAIL fail-arg 2011-07-03 11:56:23 -07:00
Tim Chevalier
046c25dbc0 Handle fail as an argument; parse fail expressions unambiguously
An expression like:

foo(1, fail, 2)

was failing to parse, because the parser was interpreting the comma
as the start of an expression that was an argument to fail, rather
than recognizing that the fail here has no arguments

Fixed this by using can_begin_expr to determine whether the next
token after a fail token suggests that this is a nullary fail or a
unary fail.

In addition, when translating calls, check before translating each
argument that the block still isn't terminated. This has the effect
that if an argument list includes fail, the back-end won't keep trying
to generate code for successive arguments and trip the !*terminated
assertion.
2011-07-03 11:51:47 -07:00
Tim Chevalier
c425a422ed Manipulate contexts correctly in trans_fail_expr
This fixes Issue #617
2011-07-03 02:38:11 -07:00
Tim Chevalier
9349826909 XFAILing the new test case...
...because the parsing of fail got changed out from under me.
Will fix shortly.
2011-07-03 01:15:41 -07:00
Tim Chevalier
7426252549 Generate code properly for calls with _|_ - typed arguments
The code for translating a fail (for example) would call
Unreachable(), which terminates the block; if a fail appeared as an
argument, this would cause an LLVM assertion failure. Changed
trans_call to handle this situation correctly.
2011-07-02 22:02:59 -07:00
Josh Matthews
a4421cc4e8 Fix assertion failure when syntax extension name is missing. 2011-07-02 00:06:58 -07:00
Brian Anderson
7c8ee712be Fix the error-pattern on compile-fail/fail-simple
Recent changes to the fail statement changed the way the parser errors in this
scenario.
2011-07-02 00:06:58 -07:00
Josh Matthews
d485e0d15a Allow any string expression to be used with fail. 2011-07-02 00:06:58 -07:00
Brian Anderson
22be98264e Add a test for mismatched crate metadata in use statements 2011-07-01 12:26:57 -07:00
Marijn Haverbeke
d863cdb98f Add tests for newtype-style tags 2011-07-01 17:51:49 +02:00
Michael Sullivan
7b1b5d5a8a Implement autoderef for function calls.
This is important since we are going to be making functions noncopyable
soon, which means we'll be seeing a lot of boxed functions.
(*f)(...) is really just too heavyweight.

Doing the autodereferencing was a very little bit tricky since
trans_call works with an *lval* of the function whereas existing
autoderef code was not for lvals.
2011-07-01 12:39:58 +02:00
Patrick Walton
4c76bfdc1f stdlib: Add an interior vector version of sort and a test case 2011-06-30 19:09:52 -07:00
Patrick Walton
b773f8d22b rustc: Duplicate heap data of interior vectors when passing them by value 2011-06-30 19:09:52 -07:00
Brian Anderson
50b1953f9b Pretty-print view items in mod items
For mods that aren't defined at the file level we were forgetting to print the
view items so, e.g. 'mod { use std; }' would not print correctly.
2011-06-30 16:08:28 -07:00
Graydon Hoare
1e63d5303f Restore some functionality that got stripped out of the export tests while last reformatting. 2011-06-30 15:39:25 -07:00
Brian Anderson
39fccf3bc7 Conditionally compile items declared as statements. Issue #489 2011-06-30 13:04:35 -07:00
Brian Anderson
6346a67cbd Add more tests for conditional compilation. Issue #489 2011-06-30 13:04:35 -07:00
Tim Chevalier
7fd04a21a1 remove an unused variable 2011-06-30 12:45:50 -07:00
Eric Holk
e1927553a5 Added a new version of pfib that's better suited for benchmarking the task system. It generates gnuplot output. 2011-06-30 11:32:16 -07:00