Commit graph

3664 commits

Author SHA1 Message Date
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