Commit graph

4121 commits

Author SHA1 Message Date
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
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
Patrick Walton
2e827eab24 stdlib: Port most of getopts over to interior vectors 2011-07-12 17:33:17 -07:00
Patrick Walton
3427a41272 stdlib: Add interior vector methods to sha1 2011-07-12 17:18:53 -07:00
Patrick Walton
032c4deefe stdlib: Implement ivec::count 2011-07-12 17:00:44 -07:00
Brian Anderson
b97318bb80 Simplify the code for generating tests. Issue #428 2011-07-12 16:54:47 -07:00
Brian Anderson
ed83f28076 Log the synthesized __test module. Issue #428 2011-07-12 16:54:46 -07:00
Brian Anderson
73e6a4f9e5 Elide existing main function when building a test runner. Issue #428
This prevents any defined main function from colliding with the one
synthesized for the test runner. This is not the best solution since it
doesn't compile a function the user defined, but I don't think it's likely to
be a problem in the near term.
2011-07-12 16:54:46 -07:00
Brian Anderson
41a3888da7 Fix type inference of fn tail expressions. Closes #680 2011-07-12 16:54:46 -07:00
Brian Anderson
ed556ab094 Improve test runner summary message. Issue #428 2011-07-12 16:54:46 -07:00
Patrick Walton
f06fdd5ca1 stdlib: Use the right upcall in win32_fs. Maybe puts out burning tinderbox? 2011-07-12 16:53:16 -07:00
Patrick Walton
a3add84909 rustc: Remove some interior vectors from typestate and some useless vec-related imports 2011-07-12 16:44:57 -07:00
Patrick Walton
ccd0fffcce stdlib: Implement str::split_ivec() 2011-07-12 16:36:47 -07:00
Patrick Walton
e038e8e52b rustc: Move ppaux away from exterior vectors 2011-07-12 16:35:02 -07:00
Patrick Walton
60cffd7116 rustc: Complete the transition of pprust to interior vectors 2011-07-12 16:13:30 -07:00
Patrick Walton
a190a2c68e rustc: Remove exterior vectors from front::attr 2011-07-12 15:39:48 -07:00
Marijn Haverbeke
12d5532166 Use switches rather than chained conditionals to compile alt matches
This also moves the alt-related trans code into its own file.

Closes #467
2011-07-13 00:38:24 +02:00
Eric Holk
1ea449e2f6 Updating and unXFAILing somet communication tests. 2011-07-12 15:27:36 -07:00
Patrick Walton
598b50e10a stdlib: Move fs over to interior vectors by introducing a rust_list_files_ivec builtin 2011-07-12 15:14:57 -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
Patrick Walton
ab579e1c9f stdlib: Port std::either over to interior vectors 2011-07-12 14:28:11 -07:00
Patrick Walton
b062bbdb8e stdlib: Switch lib::deque over to interior vectors 2011-07-12 14:28:11 -07:00
Patrick Walton
f2d847ec7a stdlib: Move bit vectors over to interior vectors 2011-07-12 14:28:11 -07:00
Patrick Walton
043096ea0a stdlib: Remove exterior vectors from termivec 2011-07-12 14:28:11 -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
Lindsey Kuper
0d9c08af2a Remove some obsolete comments. 2011-07-12 12:01:02 -07:00
Lindsey Kuper
a0b78e649e "Narrow scope forgives many sins." -- M. Schwern 2011-07-12 12:01:02 -07:00
Patrick Walton
a9b77a5011 rt: Remove the locks around upcall_shared_malloc and upcall_shared_free 2011-07-12 11:53:45 -07:00
Patrick Walton
0be1a0b500 rustc: Simplify tritv::copy; shaves a couple of seconds off typestate. 2011-07-12 11:47:32 -07:00
Patrick Walton
4b23ea51bc stdlib: Remove obsolete FIXME about state fns 2011-07-12 11:36:01 -07:00
Patrick Walton
c15aa5e3a3 stdlib: EBML API fixes 2011-07-12 11:35:29 -07:00