Commit graph

3664 commits

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