Commit graph

4451 commits

Author SHA1 Message Date
Brian Anderson
35e9e02066 Use ioivec::read_whole_file_str in a few places 2011-08-02 10:39:14 -07:00
Brian Anderson
a1a25969a0 Add ioivec::read_whole_file/read_whole_file_str 2011-08-02 10:39:14 -07:00
Brian Anderson
77be30fa73 Typecheck pretty-printing test results as libraries. Issue #789
After running source files through the pretty printer, we sanity check them by
running the results through the compiler with the --no-trans flag. Now also
use the --lib flag so that pretty-printer tests don't have to include a main
function.
2011-08-02 10:39:14 -07:00
Brian Anderson
0fbb6782bb Add dedicated pretty-printer tests with new pp-exact directive
Add a new src/test/pretty directory to hold just source files for testing the
pretty-printer.

Add a new pp-exact directive. When this directive is followed by a file name
it specifies a file containing the output that the pretty-printer should
generate. When pp-exact is not followed by a filename it says that the file
should pretty-print as written.
2011-08-02 10:39:13 -07:00
Brian Anderson
e13390a199 Pretty-print test the rfail tests. Issue #789 2011-08-02 10:39:13 -07:00
Brian Anderson
0a6e3362c6 Add xfail-pretty directives to tests that don't pretty-print correctly
Issue #789
2011-08-02 10:39:13 -07:00
Brian Anderson
166c73546a Remove test/run-pass/simple-qsort
This is part of stdtest now
2011-08-02 10:39:13 -07:00
Brian Anderson
67b8f8b13a Display the name of the test being waited for before the result is in
So the test runner displays the name of the test, then waits for it to finish,
then displays the result. It worked this way before things were parallelized
and it's just much friendlier this way.
2011-08-02 10:39:13 -07:00
Brian Anderson
1702b8507d Add xfail-pretty test directive. Issue #789
Indicates that this test should not be used to test the pretty-printer
2011-08-02 10:39:13 -07:00
Brian Anderson
ce8cac5d9a Use color to report the final test result, even when running in parallel
After the tests are run there is no more parallelism, so it should be less
likely that the control characters will introduce wierd artifacts.
2011-08-02 10:39:13 -07:00
Brian Anderson
a601eb169e Run pretty-printed sources through the compiler again for sanity
Just go as far as typechecking for speed sake.

Issue #789
2011-08-02 10:39:13 -07:00
Brian Anderson
1653f3f1a9 Implement test that pretty-printed code converges. Issue #789 2011-08-02 10:39:13 -07:00
Brian Anderson
4828d8f73f Remove unused procsrv::clone function from compiletest 2011-08-02 10:39:12 -07:00
Brian Anderson
291c43af31 Fix comment typo in compiletest 2011-08-02 10:39:12 -07:00
Brian Anderson
39d3b93a38 Pretty-print tests only run on .rs files. Issue #789
The pretty-printer can't handle .rc files currently
2011-08-02 10:39:12 -07:00
Brian Anderson
4e8ab8b3a8 Introduce pretty-print testing mode to compiletest. Issue #789 2011-08-02 10:39:12 -07:00
Brian Anderson
af2eecdabe Replace an open-coded conversion with ivec::from_vec 2011-08-02 10:39:12 -07:00
Brian Anderson
a8af13e784 Move compiletest modules into separate files 2011-08-02 10:39:12 -07:00
Brian Anderson
840a09c86e Add a --no-trans command line option
Runs all passes before translation. This will be used for pretty-printing
tests to verify that the results are still probably valid Rust code.
2011-08-02 10:39:12 -07:00
Brian Anderson
5f4b7e1ba7 Compiler accepts input from stdin when source file is called "-" 2011-08-02 10:39:09 -07:00
Marijn Haverbeke
2d5b651f49 Assign collection element ty to loop local tvar when checking loops
This makes the type declarationg for the loop variable optional in
most cases.

Closes #790
2011-08-02 15:09:29 +02:00
Marijn Haverbeke
78a0d380cc Do not try to save block result when the block is an iter body
Closes #791
2011-08-02 14:28:32 +02:00
Marijn Haverbeke
6c9b90d06a Be a little more clever about picking columns to match on in trans_alt
This should result in slightly more efficient matching of 'complex'
patterns with multiple discriminants in them.
2011-08-02 12:57:27 +02:00
Marijn Haverbeke
f8fa574864 Copy locals created by destructuring on the content of a box
This is required so that assigning to these locals doesn't clobber
the content of the box.

(A possible optimization would be to only do this copying for
locals that actually are assigned to.)
2011-08-02 12:09:15 +02:00
Marijn Haverbeke
043d95a2bd Move ppaux::ty_to_str to new record syntax 2011-08-02 12:09:15 +02:00
Marijn Haverbeke
8d8ff16dfe Improve handling of bottom type in alt arms 2011-08-02 10:24:06 +02:00
Tim Chevalier
5cf5f5024d Handle bang functions correctly in typestate
The logic for how the "returns" constraint was handled was always
dodgy, for reasons explained in the comments I added to
auxiliary::fn_info in this commit. Fixed it by adding distinct
"returns" and "diverges" constraints for each function, which
are both handled positively (that is: for a ! function, the
"diverges" constraint must be true on every exit path; for
any other function, the "returns" constraint must be true
on every exit path).

Closes #779
2011-08-01 20:58:16 -07:00
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
0c7a95fde5 Add std::char::is_whitespace 2011-08-01 18:55:51 -07:00
Brian Anderson
6f8f00d1af Add std::char module 2011-08-01 18:55:51 -07:00
Paul Stansifer
fcc32797de Fix incorrect uses of str::buf() 2011-08-01 18:51:56 -07:00
Eric Holk
286be2d94e Adding an intrinsic for recv. 2011-08-01 18:43:05 -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
6a6d5c669e Enabling logging in circular_buffer again. 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
Michael Sullivan
7a05f1db7c Fix closures over dynamically-sized polymorphic values. 2011-08-01 15:19:55 -07:00
Michael Sullivan
601c299d52 Fix closures over known-size polymorphic values. 2011-08-01 15:18:44 -07:00
Michael Sullivan
a32f287c8a Add a GEPi function that wraps GEP with integer arguments. 2011-08-01 15:18:44 -07:00
Brian Anderson
7b87fa3683 Replace a lock/unlock with scoped_lock in rust_scheduler::create_task 2011-08-01 11:01:59 -07:00
Marijn Haverbeke
4837a57df5 Add tests for destructuring locals 2011-08-01 17:52:43 +02:00
Marijn Haverbeke
92240eb25b Add check for irrefutable patterns in destructuring locals 2011-08-01 17:52:43 +02:00
Marijn Haverbeke
985c32ef4c Partially implement destructuring locals
You can now say

    let {bcx, val} = some_result_returner();

Similar for loop variables. Assigning to such variables is not safe
yet. Function arguments also remain a TODO.
2011-08-01 17:51:37 +02:00
Marijn Haverbeke
48ec25da42 Get rid of walk.rs
And we're down to a single AST walker again
2011-07-31 12:24:14 +02:00
Marijn Haverbeke
c7ef6d2866 Stop using walk.rs in the fuzzer 2011-07-31 12:23:42 +02:00
Tim Chevalier
2971cfb145 Remove unused imports 2011-07-31 00:06:25 -07:00
Tim Chevalier
28f7c6af24 Change bitvectors::relax_precond_block to use visit instead of walk 2011-07-31 00:06:25 -07:00
Brian Anderson
d552a0b959 Minimize scheduler locking on task creation
This takes my CPU utilization on task-perf-spawnalot from 35% to 55%
2011-07-29 23:02:51 -07: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
Brian Anderson
6657e729de Lock the new task's scheduler when creating a task
Previously we were locking the spawning task's scheduler. I couldn't
see that that was protecting anything. The newborn_task list in the new task's
scheduler though was unprotected from concurrent access. So now we're locking
the new task's scheduler.
2011-07-29 22:43:11 -07:00
Brian Anderson
96a629d2fa Base test concurrency on the number of scheduler threads.
Ideally we would just spawn every test and collect the results but I'm not
entirely comfortable doing that yet for reasons that I'm too tired to remember
right now. Urgh.
2011-07-29 21:07:03 -07:00
Brian Anderson
9dbe6941c4 Add sched_threads rt function to get the number of scheduler threads 2011-07-29 21:03:17 -07:00
Brian Anderson
b8c209cba1 Refactor std::test
Separate the console output from the running of tests
2011-07-29 19:54:05 -07:00
Eric Holk
d1dbb99984 Removing proxies and message queues. 2011-07-29 18:54:59 -07:00
Graydon Hoare
bc4e9afe25 Fix bug in typechecker counting occurrences of typarams in instantiation rather than checking formals list. 2011-07-29 18:48:15 -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
Michael Sullivan
a34f7c8cb3 Switch the heap build and load environment functions to use GEP_tup_like. 2011-07-29 18:22:41 -07:00
Michael Sullivan
56f0fbeafc Initial trans of lambdas. Doesn't work with polymorphism yet. 2011-07-29 18:22:41 -07:00
Tim Chevalier
766e939857 Test case for previous commit 2011-07-29 18:00:10 -07:00
Tim Chevalier
126cd44c38 Refactor typestate code involving stmt_decls
To handle multiple-LHS declarations with initializers properly,
I changed seq_states to take a list of expressions paired with optional
names, not just a list of expressions. Then, the same logic that handles
ordered lists of subexpressions everywhere else can handle multi-
declarations.
2011-07-29 18:00:10 -07:00
Graydon Hoare
59c441a66a Encode, decode, and thread through typechecking all the param kinds, not just the counts. 2011-07-29 16:40:30 -07:00
Michael Sullivan
a684f6078f Do some cleanup in load_environment. 2011-07-29 15:29:38 -07:00
Michael Sullivan
6a4d0ce829 Add in some missing cases for typestate with closures. 2011-07-29 15:29:38 -07:00
Lindsey Kuper
7efbad674a Don't confuse backwards and forwards.
Oops.  If we already have a backwarding vtable, that means that we are
currently building a forwarding fn.  (Progress toward issue #702.)
2011-07-29 15:21:40 -07:00
Lindsey Kuper
6423cc7b52 Comments and cleanup, in preparation for more work on issue #702. 2011-07-29 15:21:40 -07:00
Lindsey Kuper
f4eacbb3b4 Get rid of an obsolete comment now that obj dtors are gone. 2011-07-29 15:21:40 -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
Brian Anderson
f3df9f50ea Add ivec::from_vec and ivec::to_vec 2011-07-29 14:05:04 -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
c34d74315f Remove unreachable statements 2011-07-29 20:54:44 +02:00
Marijn Haverbeke
aa3b89610e Track failures in typeck, assign proper type to failing blocks
(and warn for unreachable statements)

Closes #727
2011-07-29 20:54:44 +02:00
Lindsey Kuper
9705f97ead Typechecking bugfix for anon objs. Removes duplicate methods in outer
object types.
2011-07-29 10:33:00 -07:00
Lindsey Kuper
a6151aa9a8 Formatting tweaks. 2011-07-29 10:33:00 -07:00
robarnold
bdf2daee1e Merge pull request #781 from robarnold/upstream-stable
More useful leak debugging output.
2011-07-29 09:13:20 -07:00
Marijn Haverbeke
48cc11631c Parse anonymous objs in statement position
Closes #761
2011-07-29 15:01:06 +02:00
Marijn Haverbeke
451ec03c2d Clean up old FIXME regarding or-patterns 2011-07-29 14:03:52 +02: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
ae46c154f0 Make sure resources always have their drop glue called
Even when their content does not contain pointers
2011-07-29 12:53:58 +02:00
Marijn Haverbeke
0ba34d873d Beginning of replacing drop with resources 2011-07-29 12:18:49 +02:00
Marijn Haverbeke
4c09d4a770 Missed another instance of walk in typeck 2011-07-29 12:18:26 +02:00
Marijn Haverbeke
2ef947b85c Register a snapshot 2011-07-29 12:18:26 +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
Jesse Ruderman
4642300683 Make the fuzzer check for obvious errors in the 'rest of the compiler', not just the parser. (Disabled by default because it's slow and messy.) 2011-07-29 10:39:15 +02:00
Jesse Ruderman
56d680ab79 Make program_output also return stderr 2011-07-29 10:39:14 +02:00
Michael Sullivan
2c0f4d51f9 Change the way freevars stores its information again. 2011-07-28 18:40:17 -07:00
Michael Sullivan
5068ae4771 Factor out a bunch of environment construction code from trans_bind. 2011-07-28 18:40:17 -07:00
Brian Anderson
3896524750 Drop the previous reference when receiving. Closes #763 2011-07-28 18:22:15 -07:00
Graydon Hoare
bf99573860 Register new snapshots. 2011-07-28 16:28:04 -07:00
Brian Anderson
3dd522b6b7 Add an assertion about the lock in rust_chan::disassociate 2011-07-28 16:04:49 -07:00
Michael Sullivan
d0cb62ac90 Factor out box initializing code into trans_malloc_boxed. 2011-07-28 15:49:06 -07:00
Lindsey Kuper
0ea5a8a6ed Updated alt indenting. 2011-07-28 15:01:12 -07:00
Lindsey Kuper
b24da1c2e5 The names 'outer' and 'inner' make more sense than 'self' and 'with'.
(Also, some formatting and long-string cleanup.)
2011-07-28 14:54:32 -07:00
Brian Anderson
73812cd3de Turn off TRACK_ALLOCATIONS 2011-07-28 14:52:50 -07:00
Brian Anderson
4b356097c2 Change the locking rules around channel disassociation again
This prevents port's destructor from accessing a deleted channel
2011-07-28 14:25:20 -07:00
Brian Anderson
12ab65107a Make combine-tests ignore temp files 2011-07-28 14:24:20 -07:00
Brian Anderson
021bfb4b9b Reenable expr-scope test. Disable under check-fast 2011-07-28 14:14:29 -07:00
Graydon Hoare
3e63fdc4c9 Thread kinds into the type system. Don't quite activate yet, since it breaks stdlib and snapshot isn't ready to compile modified stdlib. 2011-07-28 13:29:39 -07:00
Brian Anderson
5c0fd045ce Fiddle with the locking around channel disassociation
This still looks a bit sketchy to me (why isn't there locking in
port::destroy?) but this manages to get rid of a problem with channels
accessing their task after it's NULL.
2011-07-28 12:53:44 -07:00
Brian Anderson
b54eb0480d No strnlen on mac 2011-07-28 12:53:14 -07:00
Brian Anderson
0fcd72c932 When using the allow leaks hack don't even print a warning about the leak
This is only used for the test runner and in that case it just makes the test
output confusing
2011-07-28 12:23:01 -07:00
Brian Anderson
4ef1ec580a Do all runtime calls to getenv at initialization
getenv is not threadsafe and (maybe as a result) it's randomly crashing with
CFLAGS=-g and RUST_THREADS=32. Calls from rust code are still on their
own.
2011-07-28 12:23:01 -07:00
Brian Anderson
75985ab75e Remove color-related code from rust_log
This is all dead. If someone decides they want color it will be easy to redo.
2011-07-28 12:23:00 -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
3d7016ae95 Updating to work on Windows. 2011-07-28 10:47:29 -07:00
Eric Holk
9618ab67ae Re-enabled the rest of the asserts and things in rust_chan.cpp 2011-07-28 10:47:29 -07:00
Eric Holk
b85dee8d5b Resurrecting some of the logging in rust_chan.cpp 2011-07-28 10:47:28 -07:00
Eric Holk
9ea8476faa Removed outdated comment. 2011-07-28 10:47:28 -07:00
Eric Holk
279844ce9f Atomic reference counting for tasks. 2011-07-28 10:47:28 -07:00
Eric Holk
a5fe66e706 Adding upcalls to to ref() and deref() tasks. This is the first step towards atomic reference counting of tasks. 2011-07-28 10:47:28 -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
Eric Holk
b51f5c395c Made root_task no longer special. 2011-07-28 10:47:28 -07:00
Lindsey Kuper
c15871ac51 Test case for issue #435. 2011-07-28 10:37:46 -07:00
Jesse Ruderman
0268cb7c96 Get expr-moving fuzzer working again 2011-07-28 10:28:50 -07:00
Graydon Hoare
acac6abc85 Parse, store and print type parameter kind constraints. 2011-07-28 17:22:59 +00:00
Rob Arnold
f45ac8db07 More useful leak debugging output.
When printing out leaked allocations, print the allocation tag and address of
the returned pointer.
2011-07-28 08:28:32 -07:00
Marijn Haverbeke
1836f59d9a Disable expr-scope test, since it break windows 2011-07-28 12:02:08 +02:00
Graydon Hoare
2749ef5ede Fix stale 'copy' occurrences to 'move' in comments. 2011-07-27 23:43:17 -07:00
Josh Matthews
f0e29c92aa :: is allowed to start an expression. Close #762. 2011-07-28 02:33:24 -04:00
Marijn Haverbeke
c141718952 Replace walk with visit in the typechecker 2011-07-28 08:05:04 +02:00
Marijn Haverbeke
757b7ec534 Remove walk instance from kind.rs 2011-07-28 07:42:51 +02:00
Marijn Haverbeke
c78ac29002 Show millisecond precision for time_passes times
Closes #713
2011-07-28 07:22:16 +02:00
Graydon Hoare
a11bb404a5 Further refinement to kind system lattice and type-kind rules; first successful caught kind error (prohibits copying a pinned resource, though trans already caught it later). 2011-07-27 21:23:54 -07:00
Lindsey Kuper
7073ee4e31 Some work on backwarding for issue #702. 2011-07-27 19:43:21 -07:00
Brian Anderson
54c1c07ab1 Add std::io::stderr 2011-07-27 19:04:57 -07: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
90a79b9951 Print a newline before displaying test output 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
63fa765e0e Fix binding a bare fn argument with type parameters.
Closes #642.
2011-07-27 18:46:46 -07:00
Graydon Hoare
63f74f3771 Remove vestiges of "layers", insert skeletal do-nothing "kind" pass plus cached calculation of kind for each type. 2011-07-27 17:49:00 -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
Michael Sullivan
55a65a51aa Eliminate "target" field in closures. 2011-07-27 15:22:11 -07:00
Michael Sullivan
b977b5c508 Put the bound function in bind in the bindings, not in a distinguished spot. 2011-07-27 15:22:11 -07:00
Michael Sullivan
db19231596 Mess around with the casting in trans_bind. 2011-07-27 14:43:35 -07:00
Michael Sullivan
e3f9648096 Some cleanup in trans. 2011-07-27 14:41:08 -07:00
Michael Sullivan
1c612ebdcc Associate names with taskptr and tydesc types for better debugging. 2011-07-27 14:30:16 -07:00
Michael Sullivan
ab8d91dcfd Make trand_bind_1 use create_real_fn_pair. 2011-07-27 14:28:07 -07:00
Marijn Haverbeke
73e8e49897 More thorough check for interior-ness in str_from_ivec
Closes #750
2011-07-27 21:46:14 +02:00
Marijn Haverbeke
0186176ae9 Stop outputting spurious spaces in ivec types and empty mutable vecs
(in the pretty-printer)
2011-07-27 21:20:51 +02:00
Marijn Haverbeke
a4cf804671 (belatedly) register a new stable snapshot
This is to make it more likely that our build can be replayed/reconstructed later.
2011-07-27 20:46:08 +02:00
Brian Anderson
0923d67096 Fix comment placement in compiletest 2011-07-27 11:17:03 -07:00
Marijn Haverbeke
7647cf73d1 Another attempt at fixing fast check for the win tinderbox 2011-07-27 19:02:45 +02:00
Marijn Haverbeke
f379c97913 Don't allow globals or immutable locals to be passed by mut alias
Closes #747
2011-07-27 17:19:46 +02:00
Marijn Haverbeke
06e1d8b745 Remove superfluous spaces in pretty-printing of loops
(And extra parens around else-if tests)
2011-07-27 17:18:53 +02:00
Marijn Haverbeke
8365a79c7c Some more obj dtor reformatting 2011-07-27 17:05:34 +02:00
Marijn Haverbeke
edd1a0230e Fix nil pattern case to handle for parser adjustment 2011-07-27 16:55:49 +02:00
Marijn Haverbeke
66b84e3f55 Make the pretty-printer output whitespace before obj drop clause 2011-07-27 16:54:48 +02:00
Marijn Haverbeke
2593c50e75 Re-format some obj dtors that were messed up by the pretty-printer 2011-07-27 16:52:49 +02:00
Marijn Haverbeke
0334faef1f Improve pretty-printing of constraints
(Methods still don't seem to have constraints associated with them.
Method types do, so I guess this is a TODO.)
2011-07-27 16:50:51 +02:00
Marijn Haverbeke
30377a0d05 Fix python script for fast-check to output valid syntax 2011-07-27 16:34:35 +02:00
Marijn Haverbeke
19394a50e7 Make printing of comments inside bindings slightly less broken 2011-07-27 16:24:41 +02:00
Marijn Haverbeke
e3552da0e6 No longer allow 'case' keyword before patterns 2011-07-27 16:01:31 +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
Marijn Haverbeke
930e2cfc74 Register transitional snapshot 2011-07-27 15:42:43 +02:00
Marijn Haverbeke
f45524d0d4 This time, I'm almost sure it'll work
(Tinderbox workaround kludge)
2011-07-27 15:19:31 +02:00
Marijn Haverbeke
66c1ca857b Update the parser to accept the new syntax 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
300eb30113 Output native_name field for native mods when needed 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
e9b2487db7 Have the pretty-printer parentesize unary ops when needed 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
a6260ebaa2 Update the pretty-printer to output the new syntax 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
557c2a380a Parenthesize ivec types as needed 2011-07-27 15:19:31 +02:00
Marijn Haverbeke
b0059bd357 Hack to make snap-stage1 actually build incompatible changes
You can't build libstd both with stage0 and stage1 if the two are incompatible

This is probably temporary
2011-07-27 15:19:31 +02:00
Marijn Haverbeke
95b926f675 Add missing case for view_item_use in resolve.rs
Closes #748
2011-07-27 10:01:21 +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
Graydon Hoare
797cd9fd0e Try to keep the local and its type together when wrapping a long decl. 2011-07-26 16:28:16 -07:00
Graydon Hoare
4070b75914 Prohibit breaking between "let" and "=" in local decls. 2011-07-26 15:58:50 -07:00
Lindsey Kuper
e1769ab76f Clean up long strings and indentation. 2011-07-26 15:53:00 -07:00
Graydon Hoare
821c1e7a44 Trailing whitespace. 2011-07-26 15:41:43 -07:00
Graydon Hoare
7a1e656ba6 Tidy up fuzzer logic a bit. 2011-07-26 15:41:43 -07:00
Graydon Hoare
ba626779de Handle printing 'auto' occurring in loop-variable context. 2011-07-26 15:41:42 -07:00
Graydon Hoare
1c97510a16 Improve printing of mod and native mod. 2011-07-26 15:41:42 -07:00
Graydon Hoare
69f8d0e787 Handle hardbreaks at bol slightly better, including break_offset calls (tuck offset into previous hardbreak). 2011-07-26 15:41:42 -07:00
Graydon Hoare
0a69196ef3 Handle column-zero \n explicitly rather than looking for \n\n. 2011-07-26 15:41:42 -07:00
Graydon Hoare
63aa869405 Consume EOL after line comment. 2011-07-26 15:41:42 -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
a17735cfb5 Some simple cleanup of trans_bind. 2011-07-26 14:47:44 -07:00
Michael Sullivan
be0629d880 Convert a bunch of cx.fcx.lcx... paths into bcx_...(cx) 2011-07-26 13:02:26 -07:00
Michael Sullivan
4c17cb73a2 Add a bunch of tests for blocks. 2011-07-26 12:34:38 -07:00
Michael Sullivan
9ca0ce91bf Initial implementation of typestate for closures.
There are still things not handled properly: relying on other preconditions
of upvars is likely to cause bad things to happen. We probably want to
disallow it.
2011-07-26 12:30:14 -07:00
Michael Sullivan
166d4f5fe9 Translate anonymous block closures. 2011-07-26 12:30:14 -07:00
Michael Sullivan
ac948b4ccd Resolve and typecheck alias-environment-capturing blocks. 2011-07-26 12:30:14 -07:00
Michael Sullivan
8c8fa79312 Add block and closure protos and parse/pp block and lambda exprs. 2011-07-26 12:30:14 -07:00
Michael Sullivan
eaab0db4ea Fix the freevars pass to actually work on top of visit. 2011-07-26 12:30:14 -07:00
Brian Anderson
49a98f1508 Base scheduler threads on number of cores. Closes #739 2011-07-26 11:12:20 -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
bca34d11ef Oops, left whitespace. 2011-07-26 11:11:25 -07:00
Paul Stansifer
d11c887382 Add basic support for blocks and types in macros. 2011-07-26 11:09:37 -07:00
Marijn Haverbeke
e133f929b7 Convert all code that uses walk.rs in the straightforward way to simple_visit
Code that needs the keep_going functionality is still using walk. I will
add an equivalent to visit.rs later.
2011-07-26 17:13:48 +02:00
Marijn Haverbeke
473a03a214 Add 'simple' visiting to visit.rs 2011-07-26 16:35:31 +02:00
Marijn Haverbeke
2509a3dcae Resolve loop collection expressions in the right scope
Closes #745
2011-07-26 15:52:59 +02:00
Marijn Haverbeke
41d27ddcc2 Fix win tinderbox breaking typo 2011-07-26 15:39:18 +02:00
Marijn Haverbeke
bfaa85b735 Detect duplicate field names in record literals and types
Closes #746
2011-07-26 15:32:16 +02:00
Marijn Haverbeke
2c1250780d Remove tuple support from the compiler 2011-07-26 15:19:56 +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
Marijn Haverbeke
aea537779e Remove all uses of tuples from the compiler and stdlib 2011-07-26 14:06:02 +02:00
Marijn Haverbeke
e123366bff Make the pretty-printer output new-style syntax for records 2011-07-26 10:53:24 +02:00
Marijn Haverbeke
ce808bbc6f Make the pretty-printer output new-style syntax for local decls 2011-07-26 10:40:28 +02:00
Marijn Haverbeke
252b8ffe42 Add support for new-style local decls
let x = 5;
    let y: int = 10;
    // as soon as a typestate bug is fixed:
    let x: str = foo, y <- 20u;

'auto' and 'type-first let' will soon be dropped.
2011-07-26 10:27:26 +02:00
Graydon Hoare
5ab213a464 Correct input coordinate tracking on block-opening brace. 2011-07-25 17:35:40 -07:00
Graydon Hoare
f639085a42 Tidy fuzzer a bit. 2011-07-25 17:10:08 -07:00
Graydon Hoare
1243ce271e Recognize and preserve first blank line if first line of file. 2011-07-25 17:10:08 -07: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
Michael Sullivan
25a89e068d Rename the block type to be blk also. Sorry. 2011-07-25 14:18:07 -07:00
Graydon Hoare
552bff8a21 Adjust pp interface to that printing a crate (an reproducing literals/comments) takes a reader, not just a filename. Fixes first big pp-fuzzer bug. 2011-07-25 14:04:49 -07:00
Graydon Hoare
5749a2deac Fix signature and add string_reader to ioivec. 2011-07-25 14:04:49 -07:00
Michael Sullivan
6bcdb48e35 Disallow block as a variable name in preparation for it becoming a keyword. 2011-07-25 13:42:38 -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
Graydon Hoare
42e57f64b7 remove datalayout from the intrinsics.ll.in file, silence linkage warning. 2011-07-25 11:50:09 -07:00
Marijn Haverbeke
19507787a9 Add support for bracey record types and literals
type foo = {mutable x: int, y: int};
    auto myfoo = {mutable x: 10, y: 20u};

The old syntax is also still supported.
2011-07-25 17:41:00 +02:00
Marijn Haverbeke
cce1b4667b Add look-ahead to parser object 2011-07-25 17:16:41 +02:00
Marijn Haverbeke
dca67f95cb Make the lexer slightly less stateful 2011-07-25 16:46:08 +02:00
Marijn Haverbeke
e949aab10a Remove some rustboot-isms
Closes #464
2011-07-25 15:07:48 +02:00
Marijn Haverbeke
48013db5c5 Tie up the ends needed to get external consts working
Closes #658
2011-07-25 14:58:59 +02:00
Marijn Haverbeke
f0be65cb50 Fix span information returned by parser::parse_seq
Its hi pos used to be the end of the token after the sequence. It now
properly reports the end of the closing token.
2011-07-25 14:04:37 +02: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
Paul Stansifer
e6e53aff63 Add --expand option to rustc to pretty-print expanded code. 2011-07-23 14:33:12 -07:00
Eric Holk
63e77a3de1 Attempt to put out burning Windows tinderbox. 2011-07-23 13:01:30 -07:00
Graydon Hoare
ad954fcecc Add an NSIS script for building a win32 installer. Closes #522. 2011-07-23 12:27:06 -07:00
Eric Holk
57459ec8ae Fixed another concurrency issue in channels. 2011-07-23 12:21:23 -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
Michael Sullivan
0cacbe901d Overhaul how we handle freevars. 2011-07-22 17:46:52 -07:00
Michael Sullivan
2bf50114eb Simple cleanup of the freevars pass. 2011-07-22 17:46:52 -07:00
Michael Sullivan
f2f8943a85 Add a "fake" def_upvar and mechanisms to create it. 2011-07-22 17:46:52 -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
Eric Holk
75ee817713 Fixing a use of uninitialized memory error in valgrind. 2011-07-22 16:05:51 -07:00
Eric Holk
838511e3aa Folding recv_val into trans_recv, since this is its only use. 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
Marijn Haverbeke
5cdb010fae Remove typechecker work-arounds now that I know how 2011-07-22 20:15:46 +02: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
Brian Anderson
e891e0b992 Print a list of test failures in the test summary. Issue #428 2011-07-22 10:18:28 -07:00
Marijn Haverbeke
b9b674abe7 Start adding support for multiple variable declarations per stmt
This adds parser support and most of the machinery for

    auto x = 10, y = 20;

However, the above still goes wrong somewhere in typestate, causing
the state checker to believe only the last variable in the list is
initialized after the statement.

Tim, if you have a moment, could you go over the changes to the tstate
code in this patch and see where I'm going wrong?

Multi-var-decls without the typestate extension

Add a loop
2011-07-22 17:51:26 +02:00
Marijn Haverbeke
b45d973552 Rewrite trans_cast, float->float and float->int casts 2011-07-22 13:10:59 +02:00
Marijn Haverbeke
5864d4e13a Report unresolved names only once per function
Closes #708
2011-07-22 11:38:30 +02: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
Lindsey Kuper
5566e0c3f1 Removing unnecessary argument from process_fwding_mthd(). 2011-07-21 18:41:30 -07:00
Brian Anderson
06a6005447 Use correct win file open constants, per MinGW 2011-07-21 18:23:15 -07:00
Michael Sullivan
a0a2cee896 Clean up build_environment by having it return a rec with usefully named fields. 2011-07-21 18:19:07 -07:00
Michael Sullivan
4170390cb6 Add some useful functions to freevars. 2011-07-21 18:18:59 -07:00
Michael Sullivan
4b59ae0aa9 Add some support for using a map like a set. 2011-07-21 18:14:39 -07:00
Michael Sullivan
f3149b2f57 Merge branch 'use-new-rustrt' 2011-07-21 18:00:02 -07:00
Michael Sullivan
bdbac006dc Build the stage1 compiler against the newly built librustrt. 2011-07-21 17:55:47 -07:00
Michael Sullivan
3b2d23b2cd Move a bunch of trans into trans_common, including the context structures.
Probably more should be moved or split off into other files. My algorithm
was something along the lines of: move the contexts and their transitive
dependencies along with some functions to work with them. I stopped when
I was going to have to start pulling glue generation, which really
should go into a trans_glue file.
2011-07-21 17:39:06 -07:00
Michael Sullivan
f8bb5a3b58 Make ty::ctxt be boxed.
Arguably we should leave ty_ctxt as a bare rec and just always work with
boxes of it. This winds up being simpler and prettier, though.
2011-07-21 17:39:06 -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
Tim Chevalier
2261ddc717 Move ast_constr_to_constr from typeck to ty
so that it can be used in places that import ty.
2011-07-21 16:09:55 -07:00
Michael Sullivan
c62a9fec77 Grab librustrt.so instead of lib/librustrt.so in the snapshot. 2011-07-21 16:09:10 -07:00
Lindsey Kuper
075a094c1f Now with more type inference. 2011-07-21 15:46:03 -07:00
Lindsey Kuper
451e438ed0 Un-xfail tests. 2011-07-21 15:28:00 -07:00
Lindsey Kuper
879b6392d9 Comments and cleanup. 2011-07-21 15:12:27 -07:00
Lindsey Kuper
8ebd292253 Consolidate obj_field_from_anon_obj_field(). 2011-07-21 15:12:27 -07:00
Lindsey Kuper
55acc737a8 Remove vestiges of typarams from anon objs. 2011-07-21 15:12:27 -07:00
Michael Sullivan
f33309502a Bump the stack size and make the RUST_MIN_STACK env variable accept hex values. 2011-07-21 14:05:51 -07:00
Michael Sullivan
d9286c8bdd Build stage0/lib/libstd.so using the stage0 compiler.
This essentially starts the bootstrapping one step earlier by building
the stdlib from source using the stage0 compiler and then using that
stdlib to build the stage1 compiler. (Instead of starting by building
the stage1 compiler and then building a stdlib with it).

This means we should now be able to add features to the stdlib and use
them in the compiler without having to do a snapshot. (On the flip
side, this means that we now need to do a snapshot if we want to use a
new language feature in the stdlib, but that doesn't really seem too
burdensome (we already need to snapshot if we want to use a new
language feature in the compiler)).
2011-07-21 12:15:36 -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
Patrick Walton
a44fb04d57 Revert "rustc: Avoid SHA-1 hashing every type, since they're interned"
This reverts commit df90f57a5f.
2011-07-21 11:44:12 -07:00
Patrick Walton
b49bdad499 rustc: Box raw types. Shaves about 5 seconds off compilation. 2011-07-21 11:43:52 -07:00
Patrick Walton
df90f57a5f rustc: Avoid SHA-1 hashing every type, since they're interned 2011-07-21 11:24:20 -07:00
Marijn Haverbeke
c32f525f73 Make the pretty-printer output paren-free and case-free code
We should probably do another pretty-printing pass soon.
2011-07-21 15:37:14 +02:00
Patrick Walton
45748a3be4 rustc: Implement ptr_eq in Rust. Shaves 4 s off compile time. 2011-07-20 19:34:52 -07:00
Patrick Walton
355f77ef87 rustc: Remove cnames for now 2011-07-20 19:13:55 -07:00
Patrick Walton
3ec3b02ed0 rustc: Strip cnames before generating glue to avoid duplicates 2011-07-20 19:04:45 -07:00
Patrick Walton
142ff3bb4e rustc: Translate functions only once 2011-07-20 18:43:05 -07:00
Michael Sullivan
1b9dbcc5b4 Box the vec of freevars we store in the freevars cache. 2011-07-20 18:15:56 -07:00
Michael Sullivan
430cafbe50 Use new snapshot. 2011-07-20 17:48:16 -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
00f54b4a42 Refactoring and cleaning up. 2011-07-20 12:22:55 -07:00
Rafael Ávila de Espíndola
94c91382cd Fix typo. 2011-07-20 15:14:13 -04:00
Rafael Ávila de Espíndola
b7a7120804 give rust_metadata internal linkage but mark it as used. This allows
multiple static crates to be used.
2011-07-20 14:55:01 -04:00
Brian Anderson
a467e8e4e6 Add a huge hack to allow the test runner to continue if a single task leaks
This is just until unwinding works. Adds a flag to the runtime to turn
the memory leak checks on task destruction into warnings instead of fatal
errors. I am so sorry.

Issue #428
2011-07-20 10:22:18 -07:00
Brian Anderson
3fb33008ce Test runner should fail if any tests fail. Issue #428 2011-07-20 10:19:22 -07:00
Tim Chevalier
41212792c6 Add missing case in tyencode for ty_constr
Fixes the Windoze breakage, I hope.
2011-07-19 20:16:03 -07:00
Michael Sullivan
1a2a8b6b17 Have fn_to_str use proto_to_str. 2011-07-19 20:11:48 -07:00
Lindsey Kuper
2eb4762936 Typechecking self-calls in anon objs. Closes #540. 2011-07-19 19:52:21 -07:00
Lindsey Kuper
64fb39cdd3 Clean up formatting. 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
Michael Sullivan
da2a7e5bd2 Simple refactoring in the pretty printer.
Introduce a proto_to_str function to find the string representation of a given
proto instead of casing on the proto in multiple places.
2011-07-19 18:30:08 -07:00
Brian Anderson
9bd945639b Register new snapshots
Update snapshot scripts to complete transition of intrinsics.bc to lib dir
2011-07-19 18:26:08 -07:00
Brian Anderson
0ff76eb41f Update snapshot scripts for new location of intrinsics.bc 2011-07-19 17:22:32 -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
Lindsey Kuper
19a17b3d1d Style and indentation cleanups. 2011-07-19 16:08:49 -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
Brian Anderson
c51f5f18dd Fix color term detection in std::termivec
Pretty error messages to be restored
2011-07-19 15:02:18 -07:00
Lindsey Kuper
18162d3261 Some progress on issue #540. 2011-07-19 14:30:53 -07:00
Brian Anderson
a14e5e7046 Avoid double-closing pipes in std::run::start_program
Linux and mac seem fine with it, Windows does not
2011-07-19 14:01:21 -07:00
Lindsey Kuper
a33bc56e43 Reduced test case for issue #540. 2011-07-19 12:48:06 -07:00
Lindsey Kuper
a0c6d0a27f Comments and cleanup. 2011-07-19 12:33:45 -07:00
Lindsey Kuper
61ee22dc84 Wrapping long strings. 2011-07-19 12:33:45 -07:00
Brian Anderson
9334fb4459 Remove cwriter.rs
This file isn't actually in the crate
2011-07-19 12:13:06 -07:00
Michael Sullivan
f8c6d282f8 Add a pass that finds all of the free variables. 2011-07-19 12:01:14 -07:00
Michael Sullivan
c4bcd0a44d Move collect_upvars into its own file. 2011-07-19 12:01:13 -07:00
Patrick Walton
2e6197aa95 rustc: Report how much time was spent to translate each function when --stats is on 2011-07-19 11:57:15 -07:00
Erick Tryzelaar
b82c9c9e79 xfail simple-qsort.rs test at stage0. 2011-07-19 11:39:04 -07:00
Brian Anderson
b022dde587 Refactor std::run 2011-07-19 10:15:16 -07:00
Brian Anderson
fb9a117743 Fix an invalid memory access in run_program and friends 2011-07-19 10:15:16 -07:00
Marijn Haverbeke
a0ab57b3f6 Fix trans_alt to handle unreachable branches without blowing up 2011-07-19 17:07:51 +02:00
Patrick Walton
ce3d6339e0 rustc: Translate locals in DPS style 2011-07-18 18:28:36 -07:00
Patrick Walton
242ec22032 rustc: Remove obsolete TODO 2011-07-18 18:02:11 -07:00
Patrick Walton
07a68df3b7 rustc: Skip null when translating string concatenation 2011-07-18 18:00:45 -07:00
Patrick Walton
08eabde97b rustc: First stab at implementing interior vector concat in the DPS engine 2011-07-18 17:43:24 -07:00
Lindsey Kuper
7d4903544e Don't use 'obj_info' as an identifier for things not of type obj_info. 2011-07-18 17:05:41 -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
Patrick Walton
682875929e rustc: Stub binary operator translation 2011-07-18 00:24:21 -07:00
Patrick Walton
437b776100 rustc: Simplify the destination format in the DPS backend; optimize aliases to interior strings to require no allocation at all 2011-07-17 22:30:13 -07:00
Brian Anderson
09ca57adb0 Revert "Revert "Rename Passes2.cpp to Passes.cpp""
This reverts commit 52507f406e.
2011-07-17 19:16:23 -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
52507f406e Revert "Rename Passes2.cpp to Passes.cpp"
This reverts commit c18127b913.
2011-07-17 19:15:27 -07:00
Brian Anderson
6fb168b3db Add setenv to standard library 2011-07-17 18:50:01 -07:00
Brian Anderson
c18127b913 Rename Passes2.cpp to Passes.cpp
The original Passes.cpp is dead so Passes2 gets promoted
2011-07-17 14:57:28 -07:00
Brian Anderson
13f5de0671 Remove Passes.cpp from rustllvm
Upstreamed
2011-07-17 14:57:28 -07:00
Brian Anderson
b7699b7889 Remove Object.h from rustllvm
This file appears to be upstream now
2011-07-17 14:57:28 -07:00
Patrick Walton
22db8b1d53 rustc: Use memmove instructions more aggressively in DPS mode. LLVM converts these to optimized block transfer instructions, significantly reducing code size. 2011-07-17 14:02:39 -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
f010f79a61 Add std::ivec::to_mut, from_mut 2011-07-16 17:36:11 -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
Josh Matthews
a411c865b2 Make clear the differentiation between char pos and byte pos in filemaps. Fix up error printing for files with multi-byte characters. 2011-07-16 15:57:24 -07:00
Josh Matthews
3ce43f37d2 Fix pre-existing problem with filemap line positions always starting at 0. Fix error line output to only retrieve up to the nearest newline. 2011-07-16 15:56:31 -07:00
Josh Matthews
a5ac8f16db Use the actual start position of the file in the codemap rather than the position of the first newline. 2011-07-16 15:56:31 -07:00
Josh Matthews
63598248e4 Reenable error line printing. 2011-07-16 15:56:31 -07:00
Josh Matthews
df74f2cde9 Fix error line display slicing. 2011-07-16 15:56:28 -07:00
Patrick Walton
652da4ca55 rustc: Implement immediates in the DPS engine; it should now always be at least as efficient as the original engine (and typically much more). 2011-07-16 10:54:12 -07:00
Patrick Walton
88574c3cea rustc: Implement interior string logging in DPS 2011-07-15 18:37:57 -07:00
Patrick Walton
f6f7f61908 rustc: Implement logging in DPS 2011-07-15 18:00:59 -07:00
Lindsey Kuper
69abf0a5ff Revised plan of attack for backwarding functions. 2011-07-15 17:23:20 -07:00
Patrick Walton
0bd7b803f6 rustc: Translate literals in DPS style; no constification of strings yet. 2011-07-15 16:40:55 -07:00
Patrick Walton
6e114a367f rustc: Write names of local variables into the LLVM IR when debug mode is on 2011-07-15 16:40:55 -07:00
Graydon Hoare
fafb42e6b1 Merge the stage1,2,3.mk files into a common definition in stageN.mk, more rearrangement of host/target libs. 2011-07-15 16:16:51 -07:00
Lindsey Kuper
c4265209a6 More tests for anonymous objects. Issues #702, #703. 2011-07-15 15:33:40 -07:00
Michael Sullivan
c610d027d9 gather_locals shouldn't descend down into fns and items. 2011-07-15 14:42:59 -05:00
Michael Sullivan
7caf8a0929 Convert gather_locals to use visit. 2011-07-15 14:24:09 -05:00
Patrick Walton
9fadab64a2 rustc: Introduce a stub destination-passing-style translation engine, accessible via the --dps switch for now 2011-07-15 11:38:46 -07:00
Patrick Walton
917afa4cc9 rustc: Remove a bunch of exterior vectors 2011-07-15 11:38:46 -07:00
Lindsey Kuper
a716eb28ec Getting rid of unnecessary casts for objects.
Now that all objects are of rust_object_type in the wake of the LLVM
type system rewrite, we don't need this cast anymore.
2011-07-15 10:55:31 -07:00
Brian Anderson
47052ce19e Refactor std::test 2011-07-15 10:07:32 -07:00
Brian Anderson
4a347760ed Run test functions in isolated tasks. Issue #428
Each test is run in its own task so that the failure can be trapped and the
test runner can continue. The easiest way to get the test functions into tasks
currently is by treating them as unsafe pointers.
2011-07-15 10:07:32 -07:00
Brian Anderson
7d475530a0 Remove task_unsupervise from rt builtin functions
This was an exact duplicate of the unsupervise function
2011-07-15 10:07:32 -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
f634ab45bc Add task_unsupervise to rustrt.def.in 2011-07-14 19:14:36 -07:00
Brian Anderson
ed6f9bb677 Add tests for unsupervise 2011-07-14 18:50:22 -07:00
Brian Anderson
c99e110119 Modify upcall_fail so that failing tasks relinquish control to the scheduler
This is sufficient to let unsupervised tasks that don't allocate fail without
crashing or leaking.
2011-07-14 18:49:18 -07:00
Brian Anderson
01a52d728c Add an unsupervise builtin and function to std::task
Calling task::unsupervise de-parents the current task, with the result
that failures do not propogate up the task tree.
2011-07-14 17:56:59 -07:00
Brian Anderson
4738cf83b0 Move the responsibility for process failure from tasks to the scheduler
When the root task fails the process fails. Failures on other tasks propagate
up the task tree. Failures on non-root tasks without parents just
(theoretically) unwind and disappear.
2011-07-14 17:44:39 -07:00
Eric Holk
827e300485 refactor: Move the task and communication-related translation functions to a new module. 2011-07-14 17:33:28 -07:00
Graydon Hoare
37b879bdf7 Fix fuzzer to compile with ivec-ized pp module. 2011-07-14 17:27:36 -07:00
Michael Sullivan
e9a6fc94d5 Make collect_upvars know about function args.
Closes #697.
2011-07-14 19:18:56 -05:00
Michael Sullivan
a3301f74f9 Generalize collect_upvars to work over any type of ast node. 2011-07-14 19:18:56 -05: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
Eric Holk
8afb1a7c63 refactor: Move the LLVM type and constant constructors into a new module. 2011-07-14 17:08:45 -07:00
Michael Sullivan
e2fcd29bbd Consolidate some arguments in typeck by just passing the record they came from. 2011-07-14 18:45:55 -05:00
Michael Sullivan
53c4cb6a2f Factor out build_environment's code to find a variable in a function context. 2011-07-14 18:45:02 -05:00
Michael Sullivan
759317ca8b Factor out closure construction from trans_for_each. 2011-07-14 18:45:01 -05:00
Michael Sullivan
0957525cc6 Fix array out of bounds index in load_environment.
Closes #696.
2011-07-14 18:34:43 -05:00
Patrick Walton
1a6419bd73 rustc: Move metadata::encoder over to interior vectors 2011-07-14 15:39:35 -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
Graydon Hoare
49da7da441 Fix long line. 2011-07-14 12:55:17 -07:00
Rafael Ávila de Espíndola
c124a025bf Move rustc to the new llvm type system. Requires an update to llvm trunk. 2011-07-14 15:19:17 -04:00
Patrick Walton
be489ee9e2 rustc: Move much of metadata reading over to interior vectors 2011-07-14 12:00:48 -07:00
Patrick Walton
4664b67ea2 snap: Register new snapshots 2011-07-14 11:54:35 -07:00
Patrick Walton
e76f44453b rustc: First stab at interior string literals, untested as of yet 2011-07-14 11:47:20 -07:00
Brian Anderson
4038010bc6 The test runner's main returns unit, not int. Issue #428
The appropriate way to indicate failure from main is to fail.
2011-07-14 10:51:38 -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
8d2706cca8 Flag --test implies '--cfg test'. Issue #428
So certain code can be conditionally compiled only when building for testing
2011-07-14 10:27:02 -07:00
Rafael Ávila de Espíndola
7376e751ae Keep a pointer to rust_object_type. 2011-07-14 12:07:51 -04:00
Rafael Ávila de Espíndola
40f617390d Main part of the type system rewrite:
Change the type of all objects to be { {}*, {}* }.
2011-07-14 00:34:45 -04: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
Patrick Walton
196753e4c3 rustc: Remove some interior vectors from ty, except the ones that I think were causing crashes before 2011-07-13 17:39:33 -07:00
Rafael Ávila de Espíndola
c94fc7aad8 Small cleanups that were missing in the last patch. 2011-07-13 20:21:17 -04:00
Graydon Hoare
b9635df6fe Slight enhancements to round-trip code (run kdiff3 on mismatch, remove hard-wired input dir) 2011-07-13 17:15:31 -07:00
Jesse Ruderman
7885bdc575 Add issue numbers 2011-07-13 17:15:31 -07:00
Jesse Ruderman
156458b3f6 Fuzzer: test round trips through the pretty printer and parser 2011-07-13 17:15:31 -07:00
Rafael Ávila de Espíndola
9036758191 Next step in the type system change. Add task_type to the context. 2011-07-13 20:07:16 -04:00
Patrick Walton
2a3ab10f20 rustc: Remove exterior vectors from resolve again
This reverts commit 6390c43dc4.
2011-07-13 16:44:39 -07:00
Rafael Ávila de Espíndola
3d353f76a9 First step in the typesystem rewrite:
Create the typedesc type in one place. That is where it will be named.
2011-07-13 19:37:19 -04: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
04b239f3cb Use more precise spans in error messages for bad FRU exprs
The type error message for an expression using FRU where a field
expression had the wrong type was using the span for the entire
expression. Fixed it to use the span for the individual field.

Closes #628.
2011-07-13 15:30:30 -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
Tim Chevalier
0c913e63d9 Add some missing cases to token::can_begin_expr 2011-07-13 15:00:23 -07:00
Graydon Hoare
d39f84d8ec Trim a few more fail(1)s, not sure how they slipped past. 2011-07-13 14:04:38 -07:00
Graydon Hoare
336a4df778 Remove 'Nop.' comments, add emacs lines, remove obsolete file. 2011-07-13 14:03:18 -07:00
Graydon Hoare
49116adbe9 Fix compile-command lines in rt. 2011-07-13 13:51:20 -07:00
Graydon Hoare
2e2951305d Remove obsolete nargs counts from runtime. 2011-07-13 13:43:35 -07:00
Graydon Hoare
01fc165517 Attempt to correct buggy win32 timer code (causing tinderbox failures). 2011-07-13 12:25:36 -07:00
Marijn Haverbeke
ece2d27205 Feeble attempt at putting out the win tinderbox 2011-07-13 11:36:09 +02:00
Marijn Haverbeke
8d68b0462a Refactor out some repetetive code in trans_alt 2011-07-13 11:33:46 +02: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
Marijn Haverbeke
6cb5c0980a box patterns, expect for the trans part 2011-07-13 10:50:16 +02:00
Marijn Haverbeke
6914d32acc Do not allow moving out of obj fields, properly check move inits
Closes #591
2011-07-13 10:23:13 +02:00
Patrick Walton
729fa81d3b Revert "rustc: Remove some exterior vectors from ty.rs"
This reverts commit 01ea0647bb.
2011-07-12 18:47:26 -07:00
Patrick Walton
6390c43dc4 Revert "rustc: Remove exterior vectors from resolve"
This reverts commit 0ffe8c81c3.
2011-07-12 18:42:58 -07:00
Patrick Walton
79ee267ef4 rustc: Remove the last few exterior vectors from typeck 2011-07-12 18:41:27 -07:00
Patrick Walton
f7ba28573f rustc: Remove a few scattered uses of exterior vectors from typestate 2011-07-12 18:34:22 -07:00
Patrick Walton
0ffe8c81c3 rustc: Remove exterior vectors from resolve 2011-07-12 18:29:03 -07:00
Patrick Walton
464d7c4480 stdlib: Fix vector index in linux_os::waitpid. Put out burning tinderbox. 2011-07-12 18:28:40 -07:00
Patrick Walton
01ea0647bb rustc: Remove some exterior vectors from ty.rs 2011-07-12 18:21:50 -07:00
Patrick Walton
cdda0fd6d6 rustc: Remove some useless std::vec imports 2011-07-12 18:07:12 -07:00
Patrick Walton
13c44f99ae stdlib: Make pipe and waitpid use interior vectors 2011-07-12 17:54:27 -07:00