Commit graph

3962 commits

Author SHA1 Message Date
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
Patrick Walton
3275cad6d5 stdlib: Implement ivec::unsafe::set_len 2011-07-12 11:35:29 -07:00
Patrick Walton
d21228fce7 stdlib: Box data in EBML documents 2011-07-12 11:35:29 -07:00
Tim Chevalier
e1f9bfbac9 Add missing files
git add didn't, so this actually has the changes that should
have been in the previous commit
2011-07-12 11:26:14 -07:00
Tim Chevalier
21b94d57d5 Change typestate to use visit instead of walk
Typestate was failing to check some code because if it saw an item,
it would quit immediately. This was to avoid checking nested items
in the same context as the lexically enclosing item, but it was
having the wrong effect: not checking the code after the item at all.

Fixed by switching to visit and skipping over items in a proper
nested fashion. Closes #668.
2011-07-12 11:22:31 -07:00
Tim Chevalier
0e594939aa Fix potential use-before-init bug in trans
This was being masked by a bug in typestate (fixed in the next commit).
2011-07-12 11:21:14 -07:00
Marijn Haverbeke
bde52808f0 Update pretty-printing of '...' in record patterns to be ', _' instead 2011-07-12 17:58:40 +02:00
Brian Anderson
a5ec51d6a1 Fix pretty-printing of literals again. Issue #672
The pos variable is one character beyond where I thought it was.
2011-07-11 21:31:14 -07:00
Tim Chevalier
a8b1ea159c Make the parser add correct spans to view_items
Closes #650.
2011-07-11 19:12:02 -07:00
Brian Anderson
23d1520398 Support running a subset of tests from the command line. Issue #428 2011-07-11 19:01:54 -07:00
Brian Anderson
94e1b362f0 Pass command-line args to the test runner. Issue #428
This will let the test runner filter the tests it runs.
2011-07-11 19:01:53 -07:00
Paul Stansifer
2e46438507 So... I can't spell 'ellipsis'. 2011-07-11 18:52:50 -07:00
Paul Stansifer
9a0e85a920 Change "etc" syntax for record patterns from {a:b ...} to {a:b, _}. 2011-07-11 18:52:50 -07:00
Paul Stansifer
48dbee6b47 Add elipses, reorganize the macro components into their own AST node. 2011-07-11 18:52:50 -07:00
Paul Stansifer
425732311a Move macro expansion to a separate phase, change macro syntax, and add parse_sess to session. 2011-07-11 18:52:50 -07:00
Paul Stansifer
80cf4ecd3b Add nodes for embedding types and blocks in expressions for macros. 2011-07-11 18:52:10 -07:00
Josh Matthews
fd24fd5e31 Only print up to six lines on error. Print ^~~~~ to highlight error span. 2011-07-11 18:44:27 -07:00
Josh Matthews
b62fcdcc36 Hack to print lines when error spans are available. 2011-07-11 18:44:27 -07:00
Tim Chevalier
1870e97559 Visit the type argument in a port expression
This closes #664.
2011-07-11 18:12:00 -07:00
Brian Anderson
e45819ad70 Add parser::parse_crate_from_source_str
The fuzzer wants to be able to do stuff like this
2011-07-11 17:46:24 -07:00
Tim Chevalier
67ecda6342 remove some workarounds for old bugs 2011-07-11 17:32:00 -07:00
Tim Chevalier
e1620def9f In typeck, check for dynamically sized by-value arguments to thunks
A check in trans didn't have a corresponding check in typeck, causing
some programs (to wit, compile-fail/chan-parameterized-args.rs - part of this
commit) to fail with an assertion failure in trans instead of a type error.
Fixed it. In short, arguments that are future thunk arguments (any spawn
arguments, and _ arguments in bind) need to either not contain type params
or type vars, or be by-reference.

Closes #665.
2011-07-11 17:32:00 -07:00
Brian Anderson
9fe03b3c55 Pull lexer creation out of new_parser
This will allow custom lexers to be injected into the parser (for fuzzing)
2011-07-11 16:56:02 -07:00
Brian Anderson
08f8753d80 Pull file reading out of the lexer 2011-07-11 16:56:02 -07:00
Patrick Walton
05390b4b38 rustc: Implement explicit global scope resolution via leading "::"; add a test case 2011-07-11 16:02:16 -07:00
Rafael Ávila de Espíndola
99a95b3613 Use new snapshot. 2011-07-11 18:35:25 -04:00
Tim Chevalier
9427864f33 Unify the rhs and lhs types in a send
Closes #662.

One-line fixes are always the best :-D
2011-07-11 15:24:47 -07:00
Patrick Walton
79ce5a4614 rustc: Implement pointer dereference; add a test case 2011-07-11 15:19:16 -07:00
Michael Sullivan
4618e802db Fix comparisons of the nil type to do something sensible.
Closes #576.
2011-07-11 14:45:21 -07:00
Brian Anderson
7fc7ebd520 The lexer's get_mark_str should slice by byte position, not char. Closes #654 2011-07-11 14:41:55 -07:00
Patrick Walton
eef61a527d stdlib: Add addr_of() to the standard library 2011-07-11 14:25:35 -07:00
Patrick Walton
b6d774136b stdlib: Add interior vector-ified versions of ebml and term 2011-07-11 14:25:34 -07:00
Eric Holk
a84310aa48 Started working on MapReduce.
Currently it's only sequential, but it can do word frequency
counting. In an ideal world it would all be polymorphic, but that
pushes the limits of our type system right now. We can generalize it
later.
2011-07-11 14:05:09 -07:00
Rafael Ávila de Espíndola
d151e18633 Move llvm out of stageN/lib so that the host building stage 1+ can
have a newer and incompatible llvm with the bots.
2011-07-11 16:31:47 -04:00
Marijn Haverbeke
c893188549 Use some actual or-patterns in resolve.rs 2011-07-11 21:23:49 +02:00
Marijn Haverbeke
55e348280e Fix pretty-printing of record patterns 2011-07-11 21:23:49 +02:00
Michael Sullivan
7340824cbc Fix autoderef of function calls when the function is not an lval.
As it turns out, the correct way to handle this is much simpler than what I
did originally.
Also add more tests.
2011-07-11 11:38:01 -07:00
Michael Sullivan
418aa52510 Add a test that exercises these cases in bind. 2011-07-11 11:37:56 -07:00
Michael Sullivan
cd97f4eed0 Fix handling of derived tydescs in bind.
In trans_bind_thunk, we need to load the tydescs from the environment *before*
we try to construct derived tydescs from them.
2011-07-11 11:37:55 -07:00
Michael Sullivan
0beb271d8c Fix bind to work with boxed arguments with type parameters.
This still doesn't work with bare fn arguments with type parameters.
2011-07-11 11:37:55 -07:00
Rafael Ávila de Espíndola
15a670a1b1 Use new snapshot. 2011-07-11 14:32:18 -04:00
Brian Anderson
64ad5928e7 Actually run tests from the std runner. Issue #428 2011-07-11 11:19:32 -07:00
Rafael Ávila de Espíndola
f666c97e6d Step 1/n for moving to the new type system: include intrinsics.bc in the
snapshot.
2011-07-11 12:09:52 -04:00
Marijn Haverbeke
7595fe5153 Implement record patterns
Closes #469.
2011-07-11 15:32:41 +02:00
Marijn Haverbeke
12cb128a0a Move visit to newtype-style nominal type
This makes getting the function fields out of the visitor less
cumbersome and more efficient (no take/drop).
2011-07-11 13:53:50 +02:00
Marijn Haverbeke
5f544b1366 Output a meaningful error when too few or too many type parameters given
Closes #619
2011-07-11 13:19:34 +02:00
Marijn Haverbeke
86ee3454a1 Implement or-patterns in case clauses
You can now say

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

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

Closes #449.
2011-07-11 11:01:54 +02:00
Marijn Haverbeke
4d325b1a15 Spill instead of copy when binding a pattern that's only a var binding
The alias rules guarantee that the alt-ed value will outlive the binding's
last use, so this is safe.

This is a preparation for or-patterns. Joining scoped bindings seems like
it would get messy.
2011-07-11 10:33:19 +02:00
Jesse Ruderman
fa78fee4de Add uint::min 2011-07-10 17:05:25 -07:00
Jesse Ruderman
ea69f48eac Add a missing case so nbody.rs can pp 2011-07-10 17:05:25 -07:00
Jesse Ruderman
ab50da9445 Export noop_fold_expr so the fuzzer can use it 2011-07-10 17:05:25 -07:00
Jesse Ruderman
425b331dee fuzzer.rs is now a pseudo-fuzzer that takes an AST and replaces expressions inside it 2011-07-10 17:05:25 -07:00
Jesse Ruderman
b4781bf8dd Type-parameterize ivec_fuzz 2011-07-10 17:05:25 -07:00
Jesse Ruderman
3671cddcba Remove comments complaining about https://github.com/graydon/rust/issues/633 since it is fixed 2011-07-10 17:05:25 -07:00
Jesse Ruderman
e91f8b5db2 Pieces of a fuzzer, WIP 2011-07-10 17:05:25 -07:00
Brian Anderson
6d3513eaee Make #fmt work from inside std. Issue #175
At long last, this patch makes #fmt usable from inside the standard library.
The way it does it us very hackish, but at least it works now.
2011-07-10 17:00:28 -07:00
Brian Anderson
e494e73cdd Use more encapsulation for metadata::cstore 2011-07-10 15:44:11 -07:00
Patrick Walton
18ebef5bba stdlib: Remove FIXME that's more like a WONTFIX 2011-07-10 15:35:06 -07:00
Patrick Walton
4008cad044 stdlib: Remove the cast from ioivec 2011-07-10 13:22:29 -07:00
Patrick Walton
7871b55597 stdlib: Implement an interior-vector version of the io module 2011-07-10 12:47:51 -07:00
Patrick Walton
875c4622fb stdlib: Implement str::bytes_ivec() using pointers and casts 2011-07-10 02:05:52 -07:00
Patrick Walton
91dcc1d054 stdlib: Add missing unsafe.rs. Puts out burning tinderbox. 2011-07-10 01:32:35 -07:00
Patrick Walton
7efb942639 rt: Remove the now-unused upcall_ivec_resize and upcall_ivec_spill, which allocated from the wrong heap 2011-07-10 01:30:45 -07:00
Patrick Walton
0babfd9f98 stdlib: Add unsafe to the std.rc, now that it actually builds 2011-07-10 01:24:31 -07:00
Patrick Walton
d30f22eb65 rt: Remove the _2 prefix from intrinsics; all rust-intrinsics now use explicit return pointers 2011-07-10 01:20:18 -07:00
Patrick Walton
f02c998a8d snap: Register new snapshots 2011-07-10 01:13:00 -07:00
Patrick Walton
f42c94740a rustc: Make rust-intrinsics take an explicit return pointer 2011-07-09 21:13:25 -07:00
Patrick Walton
e823ca4965 stdlib: Implement casts. The horror. 2011-07-09 20:14:47 -07:00
Brian Anderson
75047ea87e Generate code to load a crate's tests into the std test runner. Issue #428 2011-07-09 19:30:04 -07:00
Brian Anderson
09982784c6 Begin adding some test runner types to std. Issue #428 2011-07-09 16:08:03 -07:00
Brian Anderson
f72dbec9b5 Collect functions that look like unit tests. Issue #428 2011-07-09 12:36:03 -07:00
Brian Anderson
5543404abe Track the path as we fold over the AST looking for unit tests. Issue #428 2011-07-09 12:35:30 -07:00
Brian Anderson
9af59f9d81 Add sha1 and int tests to stdtest. Issue #428 2011-07-09 12:35:30 -07:00
Brian Anderson
45b00935f3 Begin running the test for int::pow
Somehow this has been disabled forever
2011-07-09 12:35:30 -07:00
Tim Chevalier
9ec5e90608 Tests for constraint propagation 2011-07-08 22:25:57 -07:00
Tim Chevalier
182c413af1 Propagate constraints through copy, move, and swap
Assignments and moves with a simple local variable reference on the
RHS now propagate any typestate constraints the RHS was involved
in to the LHS. Swaps where both sides are local variables
exchange the constraints.

This was a pain in the butt and I'm still not proud of the resulting
code. Needs refactoring like whoa.
2011-07-08 22:25:57 -07:00
Tim Chevalier
be6febb46d Minor refactoring 2011-07-08 22:25:57 -07:00
Tim Chevalier
7060f4c89c Alias-ify some prettyprinting functions 2011-07-08 22:25:57 -07:00
Tim Chevalier
36c4cb37ad Improve impossible-case handling in ty::get_element_type 2011-07-08 22:25:57 -07:00
Patrick Walton
91d45b91e6 stdlib: Implement str::unsafe_from_bytes_ivec() 2011-07-08 22:23:11 -07:00
Patrick Walton
aa0f6f4961 stdlib: Add an offset function for simple pointer arithmetic on unsafe pointers 2011-07-08 21:56:15 -07:00
Brian Anderson
7498d03693 Improve the error message for import glob collisions. Closes #482
Instead of noting where the imported things were defined, note where they were
imported. This is more useful and avoids issue #482.
2011-07-08 18:55:01 -07:00
Brian Anderson
394b8fcd1c Add test case for issue #333. Closes #333
This has been fixed by a mystery hacker.
2011-07-08 17:43:44 -07:00
Patrick Walton
1ff426b89f rustc: Use interior vectors for the union-find in rustc 2011-07-08 17:00:21 -07:00
Patrick Walton
9b7984c250 snap: Register new snapshots 2011-07-08 16:51:25 -07:00
Patrick Walton
ccfbb74f11 rustc: Move maps over to interior vectors 2011-07-08 16:37:43 -07:00
Patrick Walton
8450ab9a2b rustc: Fix a level-of-indirection problem by using size_of() to compute dynamically sized interior vector element sizes instead of field_of_tydesc() 2011-07-08 16:37:43 -07:00
Brian Anderson
f5d604f0c3 Decode types across multiple crates. Closes #632 2011-07-08 15:07:14 -07:00
Lindsey Kuper
33ce1164e2 Nicer pretty-printing for anon objs. Closes #499.
(Incidentally, what's the right way to test changes to the
pretty-printer?  There has to be a better way than what I did, which
was to log_err the results of expr_to_str as exprs passed through
trans and glance at the output.)
2011-07-08 15:00:47 -07:00
Brian Anderson
4319e7a655 Recursively load dependencies of external crates. Issue #632 2011-07-08 14:07:41 -07:00
Brian Anderson
412e203b3c Refactor load_library_crate and resolve_crate 2011-07-08 14:07:41 -07:00
Brian Anderson
dd8ab24da2 Add a map from external cnums to local cnums in cstore::crate_metadata
Once populated, this will allow us to load type info for types defined in
external crates referenced by other external crates.
2011-07-08 14:07:41 -07:00
Brian Anderson
061bcb2e42 Extract resolve_crate from creader::visit_view_item 2011-07-08 14:07:41 -07:00
Eric Holk
79ca673af7 Adding more support for working with u64s. 2011-07-08 14:02:26 -07:00
Rafael Ávila de Espíndola
4c309321e0 Try to use static crate if we cannot find the dynamic one. This supports
the common case of wanting to link statically with the project's libraries
but dynamically with the system ones.
2011-07-08 15:39:44 -04:00
Rafael Ávila de Espíndola
94f0e9d956 Add just enough logic to the driver so that we can link std statically. 2011-07-08 15:05:32 -04:00
Patrick Walton
0864a22ace stdlib: Add an interior vector version of union-find for now 2011-07-08 11:44:38 -07:00
Eric Holk
d7db25e8f6 Added an environment variable to override the minimum stack size. Closes #637. 2011-07-08 11:36:56 -07:00
Brian Anderson
4c0a2ed378 Fix newlines when outputting crate attributes with --ls 2011-07-08 11:34:15 -07:00
Brian Anderson
3070439c00 Encode/decode a crate's externel dependencies. Issue #632
The encoding is very simple right now, just the crate name. Ultimately this
won't be enough for our versioning needs, but it should fill our immediate
need of being able to correlate encoded crate numbers to actual crates.
2011-07-08 11:34:15 -07:00
Patrick Walton
7c66894a71 rustc: Do dynamic size calculations properly when concatenating interior vectors. Closes #640. 2011-07-08 11:29:29 -07:00
Brian Anderson
d0a432f4bb Don't export tyencode from the metadata module
This involves pulling the type_abbrev cache out of crate_ctxt
2011-07-08 09:37:01 -07:00
Brian Anderson
00d54018f1 Cleanup decoding and crate searching 2011-07-08 09:37:01 -07:00
Brian Anderson
06391dda02 Make the interface to metadata::csearch more consistent 2011-07-08 09:37:01 -07:00
Brian Anderson
85212840c0 Remove unused functions from metadata::csearch 2011-07-08 09:37:01 -07:00
Brian Anderson
9ebb60d38b Extract various dependencies from metadata::decoder to metadata::csearch 2011-07-08 09:37:01 -07:00
Brian Anderson
7ae711fc03 Begin splitting metadata::decoder into decoding and crate search modules 2011-07-08 09:37:01 -07:00
Brian Anderson
cc2924068f Replace various ints with ast::crate_nums 2011-07-08 09:37:01 -07:00
Brian Anderson
29b766029c Move external crate/lib resolution to its own pass
The scope of external crate reading is beyond the resolve pass now, as it
builds up tables of information needed for several different purposes.
2011-07-08 09:37:01 -07:00
Brian Anderson
85535fc3e0 Move crate_map from resolve to cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
513b2276c2 Remove non-existant export from metadata::decoder 2011-07-08 09:37:00 -07:00
Brian Anderson
51e60b6565 Comment creader 2011-07-08 09:37:00 -07:00
Brian Anderson
639cf1a8ff Comment cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
58d288a4f7 Move used_link_args from session to cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
4bfa269fe7 Move used_libraries from session to cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
1386420cad Move used_crate_files from session to cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
82983e5005 Replace the crate cache in session with the one in cstore 2011-07-08 09:37:00 -07:00
Brian Anderson
b23ecd47ce Introduce metadata::cstore
I intend for this to be the location for storing all the data retrieved by
creader, most of which is currently in the session.
2011-07-08 09:37:00 -07:00
Marijn Haverbeke
c7bfef43c8 Ignore current scope when resolving self-shadowing imports
That is, for example, import x::y::x, which defines a local x,
and thus wouldn't be able to find x::y anymore.

Closes issue #624
2011-07-08 16:04:40 +02:00
Marijn Haverbeke
eeda0f4ab1 Don't unbox types in ty::is_binopable, do it on typeck side instead
Closes issue #631

Removes ty::strip_boxes entirely, since unboxing is now more complicated
anyway.
2011-07-08 15:52:54 +02:00
Marijn Haverbeke
381505f947 Remove useless return value in typeck::check_decl_local 2011-07-08 15:01:54 +02:00
Marijn Haverbeke
022363a674 Auto-bind generic functions when their value is taken in non-call context
trans::trans_lval will now autobind if the given expression was the
name of a generic functions. Those callees (trans_call and trans_bind)
that are interested in the generics information call trans_lval_gen
now.
2011-07-08 14:28:46 +02:00
Marijn Haverbeke
faec0d7799 Avoid superfluous take/drop for temp values passes as arguments 2011-07-08 13:46:29 +02:00
Marijn Haverbeke
b41fd61045 Make for-each bodies close over their parent's iterbody
Closes issue #639
2011-07-08 11:55:15 +02:00
Patrick Walton
7ed556cf8e rustc: Check iter return types. Closes #638. 2011-07-07 19:08:59 -07:00
Patrick Walton
2255eda625 rustc: Fix long line 2011-07-07 18:41:54 -07:00
Patrick Walton
edf8245273 rustc: Make trans use interior vectors 2011-07-07 18:39:05 -07:00
Patrick Walton
e1b107d74e rustc: Remove all exterior vectors from the AST 2011-07-07 18:39:05 -07:00
Eric Holk
3958c72cd8 Some cleanup 2011-07-07 18:32:45 -07:00
Eric Holk
4739953b84 Fixed two races.
The first is that the memory_region destructor would complain there is
still an outstanding allocation. This is because circular_buffer from
rust_chan wasn't refing its task, so the task was being destructed too
soon.

The second was where the program could deadlock while joining a
task. The target task would die in the time between checking whether
the task should block and then actually blocking. The fix is to use
the target task's lock.
2011-07-07 18:22:27 -07:00
Eric Holk
2d57b25f6b Added a stress test mode to pfib. 2011-07-07 18:22:27 -07:00
Eric Holk
f6e37f659c Made TRACK_ALLOCATIONS add only constant time overhead. This makes it
feasible to turn it on and run rustc.
2011-07-07 18:22:27 -07:00
Eric Holk
5d9a5b7d55 Tightened up the scoping for our various new operators, which should
make it harder to use the wrong one.
2011-07-07 18:22:27 -07:00
Eric Holk
8acadb17c2 Work on debugging race conditions.
Ports and channels have been moved to the kernel pool, since they've
been known to outlive their associated task. This probably isn't the
right thing to do, the life cycle needs fixed instead.

Some refactorying in memory_region.cpp. Added a helper function to
increment and decrement the allocation counter. This makes it easier
to switch between atomic and non-atomic increments. Using atomic
increments for now, although this still does not fix the problem.
2011-07-07 18:22:27 -07:00
Eric Holk
dcd2563a3a Removing the synchronized memory region from tasks. 2011-07-07 18:22:27 -07:00
Eric Holk
a0f45f4456 Removing most of the locks in rust_upcall.cpp and elsewhere. 2011-07-07 18:22:27 -07:00
Lindsey Kuper
e7111fe147 Un-xfail a test. 2011-07-07 17:39:35 -07:00
Lindsey Kuper
3243144046 Fix a bug that was interfering with method overriding. Issue #543.
Previously, we were creating both a normal vtable entry and a
forwarding function for overriding methods, when they should have just
gotten a vtable entry.  This patch fixes that.
2011-07-07 17:29:15 -07:00
Brian Anderson
94f782e6a1 Register new snapshots
New snapshots also include rt and rustllvm
2011-07-07 16:40:58 -07:00
Brian Anderson
64595a53f8 Add rt and rustllvm to the snapshot 2011-07-07 15:40:27 -07:00
Patrick Walton
deca79f372 Merge pull request #634 from robarnold/upstream-stable
Allocate ivecs out of the kernel pool
2011-07-07 15:18:07 -07:00
Rafael Ávila de Espíndola
5547e5dd21 Use new snapshot. 2011-07-07 17:36:23 -04:00
Brian Anderson
6ee1ffe4ac Rename encoder::ty_str to encoded_str 2011-07-07 13:31:12 -07:00
Brian Anderson
de88739350 Don't expert def_to_str from metadata::encoder 2011-07-07 13:31:12 -07:00
Brian Anderson
7d26d1d67b Move tyencode::ty_str to metadata::encoder 2011-07-07 13:31:12 -07:00
Brian Anderson
73963eae9a Refactor tyencode::ty_str to not require a tyencode::ctxt
All users were constructing the context the same way.
2011-07-07 13:31:11 -07:00
Brian Anderson
4304f8d4f6 Remove duplicate definition of def_to_str from middle::ty 2011-07-07 13:31:11 -07:00
Brian Anderson
e29ef1bec2 Refactor a few things in the metadata module
Rename metadata::tags to metadata::common. Move some utility functions from
metadata::encoder to metadata::common.
2011-07-07 13:31:11 -07:00
Brian Anderson
b723082cdb Rename hash_def_id to hash_node_id 2011-07-07 13:31:11 -07:00
Brian Anderson
d2362599d6 Remove metadata::encoder's dependence on trans::node_id_type 2011-07-07 13:31:11 -07:00
Rafael Ávila de Espíndola
83991c4c95 Add the static std library in the next snapshot. 2011-07-07 16:25:25 -04:00
Patrick Walton
0e2fff5337 rustc: Change lots of AST nodes to use interior vectors 2011-07-07 12:53:17 -07:00
Rafael Ávila de Espíndola
77c708cdbf Implement --lib --static. 2011-07-07 15:25:09 -04:00
Rafael Ávila de Espíndola
b13527735e Use an early exit to reduce indentation. 2011-07-07 14:59:18 -04:00
Rafael Ávila de Espíndola
6d6c4c2a76 Command line changes for adding support for static libraries. 2011-07-07 14:42:50 -04:00
Marijn Haverbeke
16f82dce1c Clean up trans_arg_expr
As a preparation for implementing the temporary-move optimization for
argument passing. The optimization itself isn't in yet, since it
mysteriously corrupts memory.
2011-07-07 17:54:58 +02:00
Marijn Haverbeke
3bdbf74d47 Make moving of temporaries do the right thing, use it to optimize
This adds support for dropping cleanups for temporary values when they
are moved somewhere else. It then adds wraps most copy operations
(return, put in data structure, box, etc) in a way that will fall back
to a move when it is safe.

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

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

I did not yet handle function arguments, since the logic for passing
them looked too convoluted to touch. I'll probably try that in the
near future, since it's bound to be a big win.
2011-07-07 15:54:01 +02:00
Marijn Haverbeke
007a736642 Improve handling of move and swap by alias checker
Closes issue #541.
Closes issue #591
2011-07-07 10:37:19 +02:00
Rob Arnold
f6117173c9 Allocate rust_ivec buffers out of the kernel pool
The duplication of upcalls is due to the fact that the runtime is
shared between stage0/rustc and stage1/rustc. Once snapshots are
updated, they should be de-duplicated.
2011-07-06 20:41:24 -07:00
Rob Arnold
2e2e1f7cb3 Add realloc method to rust_kernel 2011-07-06 20:37:27 -07:00