Commit graph

1572 commits

Author SHA1 Message Date
Tim Chevalier
3060eadcba Check well-formedness of constraints
Check that the operand in a constraint is an explicit name,
and that the operands are all local variables or literals. Still need
to check that the name refers to a pure function.
2011-05-05 11:26:07 -07:00
Tim Chevalier
4f892dd9d7 Check that the operand in a check is a call
In addition, fix bug in fold that was turning asserts into checks.

More typechecking still needs to be done.
2011-05-05 11:26:07 -07:00
Marijn Haverbeke
1f45dda9d2 Remove 'deprecated mutable...' from our code
This should make compilation a bit less noisy.
2011-05-05 20:19:43 +02:00
Marijn Haverbeke
3d738e9e06 Return a fresh, unreachable context after ret, break, and cont
This ensures we don't get compile errors on unreachable code (see
test/run-pass/artificial-block.rs for an example of sane code that
wasn't compiling). In the future, we might want to warn about
non-trivial code appearing in an unreachable context, and/or avoid
generating unreachable code altogether (though I'm sure LLVM will weed
it out as well).
2011-05-05 20:19:43 +02:00
Marijn Haverbeke
9432626b68 Eradicate fold from capture.rs
The pass now uses walk.
2011-05-05 20:19:43 +02:00
Patrick Walton
fea623211f rustc: Add a Link module; move crate writing to it to slim down trans slightly 2011-05-05 10:48:02 -07:00
Patrick Walton
729648282b rustllvm: Add bindings to the LLVM linker 2011-05-04 21:27:00 -07:00
Patrick Walton
bde44a03a9 rustc: Detect the system root and allow the user to override if necessary 2011-05-04 19:27:54 -07:00
Graydon Hoare
d55fa2a9a3 Add #env syntax extension for plucking strings out of the compilation environment. 2011-05-04 19:05:32 -07:00
Marijn Haverbeke
898e089d7b Fix and re-enable destructors
There was some confusion on whether the destructors took their
argument by pointer or direct value. They now take it directly, just
like other methods. You no longer get a segfault when a constructor
actually does something with its self value.
2011-05-05 02:16:49 +02:00
Graydon Hoare
cdb6822405 Add a structure for passing option flags around the compiler, put it in session, and use it. 2011-05-04 16:59:21 -07:00
Brian Anderson
bd34770a92 Add missing ret statements to check_mod
Un-XFAIL compile-fail export tests
2011-05-04 19:29:27 -04:00
Graydon Hoare
ce9468761c Support new -g flag, only mangle glue names by type when it's passed. 2011-05-04 15:36:42 -07:00
Patrick Walton
ac8eb20224 rustc: Stub support for Rust intrinsics 2011-05-03 18:03:59 -07:00
Patrick Walton
2bc17adc29 Revert "Rename the "llvm" API to "llvm-intrinsic"" due to tinderbox bustage
This reverts commit 6871c245a6.
2011-05-03 17:50:37 -07:00
Graydon Hoare
b453c3c728 Start sketching --depend support in rustc. 2011-05-03 15:56:00 -07:00
Patrick Walton
6871c245a6 Rename the "llvm" API to "llvm-intrinsic" 2011-05-03 15:55:01 -07:00
Patrick Walton
e43729ccf2 rustc: Refactor metadata.Encode.* to not require a type abbreviation table if abbreviation isn't enabled 2011-05-03 14:41:05 -07:00
Patrick Walton
3f317ede41 rustc: Name type glue properly 2011-05-03 14:41:05 -07:00
Brian Anderson
ed40c85af5 Extract ast.is_exported from the resolve module 2011-05-02 22:07:36 -04:00
Patrick Walton
ebc236e91c rustc: Time the Rust translation and LLVM passes separately 2011-05-02 17:50:46 -07:00
Patrick Walton
a833f152ba rustc: Remove the artificial block in ty.rs. Fixes self-hosting. Add a test case for this, XFAIL'd. 2011-05-02 17:50:46 -07:00
Patrick Walton
147a2d655f Un-revert "Use different syntax for checks that matter to typestate", fixing the problem.
This reverts commit d08b443fff.
2011-05-02 17:50:46 -07:00
Graydon Hoare
d08b443fff Revert "Use different syntax for checks that matter to typestate"
This reverts commit aa25f22f19. It broke stage2, not sure why yet.
2011-05-02 17:35:33 -07:00
Patrick Walton
9d21cf3b61 rustc: Allocate tydescs on the stack when it's safe to do so. 60% compile speed increase. 2011-05-02 15:28:59 -07:00
Tim Chevalier
aa25f22f19 Use different syntax for checks that matter to typestate
This giant commit changes the syntax of Rust to use "assert" for
"check" expressions that didn't mean anything to the typestate
system, and continue using "check" for checks that are used as
part of typestate checking.

Most of the changes are just replacing "check" with "assert" in test
cases and rustc.
2011-05-02 12:16:29 -07:00
Patrick Walton
870435caf5 rustc: Add a "fat tydesc" LLVM type to trans 2011-05-02 12:05:21 -07:00
Brian Anderson
1dd63ff42d Remove the search direction from resolve's fold environment
It's not actually involved in the fold so it can just be passed between the
functions that need it.
2011-05-01 16:57:36 -04:00
Brian Anderson
a697210234 Hide unexported tag variants 2011-05-01 16:57:36 -04:00
Brian Anderson
459b0ec833 Implement simple module export 2011-05-01 16:57:36 -04:00
Brian Anderson
d88776726a rustc: Preserve dots in input path when using an implicit output path
This avoids outputing, e.g. /test.bc for ../test.rs
2011-05-01 14:42:45 -04:00
Ralph Giles
46fd8dfe21 Fix a typo in the documentation. 2011-05-01 00:16:00 -07:00
Patrick Walton
b101e26d92 rustc: Run scope cleanups in the implicit block created by log statements. Fixes a leak. 2011-04-29 19:19:54 -07:00
Patrick Walton
64a5afadf3 rustc: Add constants for LLVM function attributes 2011-04-29 16:58:49 -07:00
Patrick Walton
f6c472d816 rustc: Emit pure native glue; we don't call it yet 2011-04-29 16:40:30 -07:00
Patrick Walton
593fb195a4 rustc: Start threading a purity flag through upcalls 2011-04-29 15:39:48 -07:00
Graydon Hoare
b9babe47da Temporarily disable dtors; they broke self-hosting. 2011-04-29 15:06:53 -07:00
Patrick Walton
1acf404361 rustc: First steps to determine whether tydescs escape 2011-04-29 15:01:07 -07:00
Graydon Hoare
7b95b5c033 Don't emit metadata unless compiling -shared. 2011-04-29 19:20:20 +00:00
Marijn Haverbeke
c39a95da90 Implement destructors in rustc
Unlike rustboot, rustc keeps it destructors in vtables. Entry 0 holds
either the destructor for the obj or a NULL pointer. The method
offsets start at 1.
2011-04-29 21:19:50 +02:00
Patrick Walton
9aeb67987c rustc: Temporarily add a switch and a corresponding makefile variable to disable typestate 2011-04-29 12:16:14 -07:00
Patrick Walton
adfacc5031 rustc: Add a --time-passes option 2011-04-29 11:55:20 -07:00
Patrick Walton
f0d24ff49e rustc: Handle alias parameters in native functions properly 2011-04-29 11:54:41 -07:00
Patrick Walton
c52fb52fbc rustc: Remove the wrong-compiler warning; we're self-hosting now. 2011-04-29 10:23:53 -07:00
Graydon Hoare
a2f68b2d58 Intern metadata while writing, shrink stage1 from 12mb to 5.7mb. 2011-04-29 15:26:28 +00:00
Patrick Walton
6daf440037 rustc: Fix vec append glue for strings. Add a test case. 2011-04-28 20:16:32 -07:00
Patrick Walton
3e08609ed7 rustc: Add some value names to the vec append glue function. Un-XFAIL vec-growth.rs. 2011-04-28 18:45:56 -07:00
Graydon Hoare
1f44887761 More attempts at fixing broken vec-append glue. 2011-04-28 18:39:12 -07:00
Graydon Hoare
cd8cf44d1d Make the no-growth path (previously never exercised) in rustc *work*. 2011-04-28 18:11:00 -07:00
Graydon Hoare
bcad52451c Actually hit the no-growth path on vec-append. 2011-04-28 17:45:35 -07:00
Graydon Hoare
e300b8047f Consider unop deref as an lval. Un-XFAIL vec-push. 2011-04-28 16:37:18 -07:00
Patrick Walton
171883f437 rustc: Only use color if it's supported 2011-04-28 14:59:16 -07:00
Graydon Hoare
c9e601b31d Drop args in native stubs too. 2011-04-28 14:35:12 -07:00
Tim Chevalier
2c3808b511 Enable typestate_check
This was supposed to be in a previous commit. I don't know what happened.
2011-04-28 13:26:19 -07:00
Tim Chevalier
34dae82b48 Add a session field to ty_ctxt and change an err to span_err
I changed instantiate to print out a more helpful error message,
which required passing it a session argument. To avoid
threading extra arguments through a lot of functions,
I added a session field to ty_ctxt.
2011-04-28 13:26:19 -07:00
Tim Chevalier
f61e77e745 Reindented things and removed superfluous comments, nothing to see here 2011-04-28 13:26:19 -07:00
Tim Chevalier
844fe20720 Fix some nested patterns in rustc
In rustc, nested patterns were potentially matching when they shouldn't
match, because a loop index wasn't being incremented. Fixed it and added
one test case.
2011-04-28 13:26:19 -07:00
Tim Chevalier
25694582d9 Fix bug in handling of expr_alt (postcond for alts was being intersected with postcond for scrutinee) 2011-04-28 13:26:19 -07:00
Tim Chevalier
707cd0281d Fixed bug in typeck that wasn't filling in anns for stmts
(needed for typestate_check).

Also changed a (log; fail) to (log_err; fail) in typestate_check,
and added some more logging funs in util.common.
2011-04-28 13:26:19 -07:00
Tim Chevalier
0190ebfe07 Support all expression forms in typestate
Added support for self_method, cont, chan, port, recv, send, be,
do_while, spawn, and ext; handled break and cont correctly.
(However, there are no non-xfailed test cases for ext or spawn in
stage0 currently.)

Although the standard library compiles and all test cases pass with
typestate enabled, I left typestate checking disabled as rustc
terminates abnormally when building the standard library if so,
even though it does generate code correctly.
2011-04-28 13:26:19 -07:00
Tim Chevalier
7c4f8cb459 Further work on typestate_check
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.

* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)

* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.

* Pass poststate correctly through a stmt_decl.

* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)

* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias

* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)

* Update logging to reflect log_err vs. log

* Fixed find_locals so as to return all local decls and exclude
function arguments.

* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)

* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones

* Added two test cases.
2011-04-28 13:26:19 -07:00
Rafael Ávila de Espíndola
b0980b7d79 Add a very minimal set of .cfi_* statements to get part of backtraces
working (on hello world at least):

~/inst/gdb/bin/gdb --args ./foo
(gdb) b write
...
(gdb) r
...
Breakpoint 1, 0xf7f04270 in write () from /lib32/libc.so.6
(gdb) bt
0  0xf7f04270 in write () from /lib32/libc.so.6
1  0x0804931a in rust_native_cdecl_3 ()
2  0x080487d7 in _rust_wrapper3_ ()
3  0x0804890a in _rust_fn5_main ()
4  0x08049440 in rust_native_cdecl_7 ()
2011-04-28 16:19:20 -04:00
Graydon Hoare
6daca7ea8d Actually perform take/drop on args (oh my!) 2011-04-28 11:24:29 -07:00
Patrick Walton
91fe4ae090 rustc: Joseph and the Amazing Technicolor Error Messages 2011-04-28 10:51:12 -07:00
Graydon Hoare
776255695a Use cnames when present in ty.ty_to_str. 2011-04-27 13:36:39 -07:00
Graydon Hoare
12925505fb Cache sha1 values of types, use seq-based mangling for glue as it's private anyways. 2011-04-27 13:36:23 -07:00
Graydon Hoare
031e86ca2d Partly disable simplified-type glue optimization due to compile-time cost. 2011-04-27 16:03:45 +00:00
Patrick Walton
05587ebdff rustc: Ignore the return value of native functions that return nil. stage1 can build libstd now, though it leaks. 2011-04-26 19:01:30 -07:00
Patrick Walton
532a65485d rustc: Actually write the optimized bitcode when --save-temps is on 2011-04-26 19:01:24 -07:00
Brian Anderson
2e12fbfc06 Support octal #fmt conversions 2011-04-26 20:20:17 -04:00
Graydon Hoare
e77f5b1561 Speed up calls to get_tydesc and kill cname-redundant glue generation. 2011-04-26 17:19:44 -07:00
Graydon Hoare
bc6e981537 Merge branch 'master' of ssh://github.com/graydon/rust 2011-04-26 20:39:33 +00:00
Graydon Hoare
418b23a538 Various bits of trans lint, nothing major. 2011-04-26 20:39:25 +00:00
Patrick Walton
ba3a4f6cc6 rustc: Cap ridiculous type name sizes 2011-04-26 13:08:48 -07:00
Marijn Haverbeke
6b11f6c46f Change rustc to use GetOpts rather than ad-hoc command-line parsing
NOTE: all 'long' parameters now use a double dash, so --shared, rather
than gcc-style -shared.
2011-04-26 20:32:14 +02:00
Patrick Walton
2746d20c83 rustc: Add a missing return value to Collect.ty_of_item() 2011-04-25 18:15:48 -07:00
Graydon Hoare
cf23db6be5 A little more guarding against wasted work in ty, typeck. 2011-04-25 18:08:13 -07:00
Patrick Walton
c4e13cd1fa rustc: Use the abbreviated type names to avoid LLVM bitcode size explosion 2011-04-25 17:00:25 -07:00
Graydon Hoare
da328b1ba9 Kick ty_var and ty_local entries out of the type store. Pre-compute presence of var, local, param and bound_params in types. 2011-04-25 16:40:25 -07:00
Patrick Walton
e0479c902b rustc: Add a -save-temps option to save bitcode and write output simultaneously; document command line switches 2011-04-25 14:08:12 -07:00
Patrick Walton
e102413aad rustc: Pass a "type context" around instead of directly passing the type store; prep for removing type annotations 2011-04-25 12:15:55 -07:00
Graydon Hoare
b258060a94 Avoid type_store hashtable access for a variety of cases, probably only ty_var matters. 2011-04-25 09:49:08 -07:00
Graydon Hoare
485399a8d5 Skip substitution and/or binding when there's no work to do. 2011-04-25 05:39:18 +00:00
Graydon Hoare
1b9e6b3ad2 Bind tag members as aliases rather than new locals. 2011-04-25 04:12:40 +00:00
Graydon Hoare
912c1fc81c Fix busted iter/put code. Un-XFAIL foreach-box-drop.rs. 2011-04-23 14:22:10 -07:00
Patrick Walton
2b298fa3e8 rustc: Use a silly "magic numbers" hack; seems to speed things up a bit. 2011-04-22 19:52:30 -07:00
Patrick Walton
94e5ca4df8 rustc: Include the cname in the hash to increase entropy 2011-04-22 19:26:00 -07:00
Patrick Walton
e0eccaddb2 rustc: Thread the type store through everything that needs to access type structures 2011-04-22 17:00:46 -07:00
Patrick Walton
3d62c9adf3 rustc: Move the type serialization logic to an Encode module 2011-04-22 14:48:25 -07:00
Patrick Walton
14d1c53a9c rustc: Remove direct access to the cname field of types 2011-04-22 13:45:21 -07:00
Patrick Walton
c7473c8260 rustc: Switch @ty.t to ty.t so that we can change it to a uint 2011-04-22 12:27:52 -07:00
Patrick Walton
c1335510d5 rustc: Eliminate the direct use of ty.t.struct 2011-04-22 12:09:09 -07:00
Rafael Ávila de Espíndola
9eb1479746 Dispose the module.
Thanks to brson for noticing it.
2011-04-22 14:49:02 -04:00
Patrick Walton
106f783b33 rustc: Add a fast path when the types to be unified are exactly equal 2011-04-22 10:51:32 -07:00
Patrick Walton
9edaa7dba3 rustc: Add a fast path if there are no type substitutions to be made 2011-04-22 10:37:51 -07:00
Patrick Walton
9ab9bd9cc2 rustc: Improve the efficiency of lookup_item_type() slightly 2011-04-22 10:19:57 -07:00
Marijn Haverbeke
2361b65526 Switch to binary search in codemap.lookup_pos
Patrick observed excessive slowness when looking up positions
in rustc. This might help.
2011-04-22 12:11:00 +02:00
Patrick Walton
117aff8688 rustc: Intern types 2011-04-21 19:31:13 -07:00
Brian Anderson
540344acb9 Fix the signature of expr_ext
The extension body is just a string, not an expression.
2011-04-21 20:42:26 -04:00
Patrick Walton
5e7336ec0d rustc: Add a shallow type equality function, not used yet 2011-04-21 17:06:01 -07:00
Patrick Walton
5dbf554bb3 rustc: Pass a type store around, which does nothing yet 2011-04-21 14:30:27 -07:00
Patrick Walton
3dbfc9310a rustc: Make the parser never assign any types, not even ty_nil 2011-04-21 13:00:06 -07:00
Patrick Walton
4d5fad696a rustc: Get rid of boring_ann(); it duplicates plain_ann() 2011-04-21 12:51:46 -07:00
Patrick Walton
ef0fcdd630 rustc: Create a unification context 2011-04-21 12:10:53 -07:00
Patrick Walton
f4b89f5d79 rustc: Move ty.unify to a separate namespace 2011-04-21 11:46:31 -07:00
Graydon Hoare
4509e6fd70 Change ty.eq_ty to avoid stringification. 2011-04-21 05:31:00 +00:00
Patrick Walton
1ee96891a0 rustc: Create an item collection context during typechecking; move collection to a module 2011-04-20 17:59:33 -07:00
Graydon Hoare
c0d98cec45 Fix walk bug that coupled with marijns work to regress stage1. 2011-04-20 22:52:33 +00:00
Patrick Walton
bc50a3ba44 rustc: Add a type unification cache 2011-04-20 15:26:55 -07:00
Patrick Walton
7596fcfba7 rustc: Define type hashing inductively 2011-04-20 14:34:17 -07:00
Patrick Walton
276a0f2de8 rustc: Precompute type hashes 2011-04-20 12:22:28 -07:00
Patrick Walton
cac7524c1a rustc: Remove all manual type construction outside ty.rs 2011-04-20 11:59:10 -07:00
Patrick Walton
38e842244c rustc: Remove all uses of plain_ty() and friends from outside of ty.rs 2011-04-20 11:23:36 -07:00
Patrick Walton
ac62488bb1 rustc: Introduce preferred type constructors, which will eventually precompute hashes and intern 2011-04-20 10:51:41 -07:00
Marijn Haverbeke
c49735d7c4 Remove last uses of fold from trans.rs 2011-04-20 17:43:37 +02:00
Marijn Haverbeke
757f1520d7 Change trans.collect_items to use walk, not fold 2011-04-20 17:23:45 +02:00
Marijn Haverbeke
4fe339d5ef Change collect_upvars from using fold to using walk 2011-04-20 12:35:34 +02:00
Marijn Haverbeke
fc6fbc1ed0 Integrate walk.rs 2011-04-20 12:35:07 +02:00
Graydon Hoare
9034a8fbd6 Fix #335, log context needs to be a scope to capture cleanups. 2011-04-20 04:55:55 +00:00
Graydon Hoare
2e6711fca5 Small fast-path hack to ty.hash_ty and eq_ty. 2011-04-19 18:46:54 -07:00
Patrick Walton
1080ac5349 rustc: Add a -noverify option 2011-04-19 18:31:27 -07:00
Graydon Hoare
d1b9ddc8d4 Add testcase for bootstrap blocker and fix for each result type to nil. 2011-04-19 16:53:12 -07:00
Patrick Walton
6651826677 rustc: Cache the results of type_of() 2011-04-19 16:41:08 -07:00
Patrick Walton
5475c0009c rustc: Use marijnh's stringifier for type hash and equality, since it's not sensitive to cnames 2011-04-19 16:41:08 -07:00
Patrick Walton
0ee997cee6 rustc: Make structured comparison glue instead of emitting it inline 2011-04-19 15:29:27 -07:00
Tim Chevalier
b7dd75c904 Handle nested items correctly in typestate_check
Summary says it all. Actually, only nested objects and functions
are handled, but that's better than before. The fold that I was using
before to traverse a crate wasn't working correctly, because annotations
have to reflect the number of local variables of the nearest enclosing
function (in turn, because annotations are represented as bit vectors).
The fold was traversing the AST in the wrong order, first filling in
the annotations correctly, but then re-traversing them with the bit
vector length for any outer nested functions, and so on.

Remedying this required writing a lot of tedious boilerplate code
because I scrapped the idea of using a fold altogether.

I also made typestate_check handle unary, field, alt, and fail.

Also, some miscellaneous changes:
* added annotations to blocks in typeck
* fix pprust so it can handle spawn
* added more logging functions in util.common
* fixed _vec.or
* added maybe and from_maybe in option
* removed fold_block field from ast_fold, since it was never used
2011-04-19 14:56:28 -07:00
Graydon Hoare
3d9cf15d0b Remove half-baked 'opacity' layer qualifier. 2011-04-19 14:00:04 -07:00
Graydon Hoare
d2bd07dcb0 Remove effect system from src. 2011-04-19 13:35:49 -07:00
Patrick Walton
d9d5eb82a7 rustc: Allow glue to be emitted even for scalar types; this is necessary to support compare glue 2011-04-19 11:25:40 -07:00
Patrick Walton
6599b310f7 rustc: Don't return "result" types from glue helper functions. This allows glue to fail. 2011-04-19 11:17:01 -07:00
Patrick Walton
37b5e91544 rustc: Assert that each basic block isn't terminated before adding instructions to it 2011-04-19 10:40:38 -07:00
Marijn Haverbeke
6511d471ba replace error logging with log_err in stdlib and rustc 2011-04-19 16:57:13 +02:00
Marijn Haverbeke
6d3a423094 add log_err to rustc 2011-04-19 16:57:13 +02:00
Marijn Haverbeke
9bfc8bf11e Add log_err to rustboot 2011-04-19 16:57:13 +02:00
Brian Anderson
d4f1a48111 Support 0 flag in #fmt 2011-04-18 21:36:04 -04:00
Graydon Hoare
4763cd39ca Boilerplate city, for anyone who wants it. 2011-04-18 18:32:05 -07:00
Patrick Walton
5f2cfa7351 rustc: Add an operation field to compare glue with ==, <=, and < modes 2011-04-18 12:57:00 -07:00
Patrick Walton
abd78f2f04 rustc: Create stub glue for structural comparison 2011-04-18 11:14:38 -07:00
Marijn Haverbeke
f6be25a870 Update foregoing patches to leave rust_crate alone.
Apparently it can't live in the main binary, since on non-Linux
platforms, dynamics libs won't find symbols in the binary. This
removes the crate_map pointer from rust_crate again, and instead
passes it as an extra argument to rust_start. Rustboot doesn't pass
this argument, but supposedly that's okay as long as we don't actually
use it on that platform.
2011-04-18 16:21:49 +02:00
Rafael Ávila de Espíndola
f12998e5d7 Add a -c option. 2011-04-18 10:02:52 -04:00
Marijn Haverbeke
148e6f7b00 Make log the log level configurable per module
This overloads the meaning of RUST_LOG to also allow
'module.submodule' or 'module.somethingelse=2' forms. The first turn
on all logging for a module (loglevel 3), the second sets its loglevel
to 2. Log levels are:

 0: Show only errors
 1: Errors and warnings
 2: Errors, warnings, and notes
 3: Everything, including debug logging

Right now, since we only have one 'log' operation, everything happens
at level 1 (warning), so the only meaningful thing that can be done
with the new RUST_LOG support is disable logging (=0) for some
modules.

TODOS:
 * Language support for logging at a specific level
 * Also add a log level field to tasks, query the current task as well
   as the current module before logging (log if one of them allows it)
 * Revise the C logging API to conform to this set-up (globals for
   per-module log level, query the task level before logging, stop
   using a global mask)

Implementation notes:

Crates now contain two extra data structures. A 'module map' that
contains names and pointers to the module-log-level globals for each
module in the crate that logs, and a 'crate map' that points at the
crate's module map, as well as at the crate maps of all external
crates it depends on. These are walked by the runtime (in
rust_crate.cpp) to set the currect log levels based on RUST_LOG.

These module log globals are allocated as-needed whenever a log
expression is encountered, and their location is hard-coded into the
logging code, which compares the current level to the log statement's
level, and skips over all logging code when it is lower.
2011-04-18 15:28:47 +02:00
Marijn Haverbeke
0bf75a203e collect crate meta info and ext crate names 2011-04-18 15:28:47 +02:00
Marijn Haverbeke
0984d1db2e move rust_crate structure into the actual crate code 2011-04-18 15:28:47 +02:00
Marijn Haverbeke
36c332a241 introduce local_ctxt in trans.rs to keep crate_ctxt global
This reduces crate_ctxt copying (which unfortunately did not
result in a noticeable speedup), and makes the role of that
type a bit more clear.
2011-04-18 15:28:47 +02:00
Brian Anderson
9976bb93d6 Support the space flag in #fmt 2011-04-17 19:50:58 -04:00
Brian Anderson
86a43c24d6 Support + flag in #fmt 2011-04-17 18:19:26 -04:00
Brian Anderson
c7edcb3a72 Support #fmt precision for string types 2011-04-17 13:10:02 -04:00
Brian Anderson
96e3e29e88 Support left-justification in #fmt conversions 2011-04-16 19:43:29 -04:00
Brian Anderson
dcfdb02fab Make #fmt support explicit conversion widths 2011-04-16 18:01:17 -04:00
Patrick Walton
0c288720b6 rustc: Capture type parameters into for-each blocks. Add a test case. 2011-04-15 18:14:29 -07:00
Patrick Walton
e37d9fc2b6 rustc: Use a regular vector instead of a hash table for type descriptors 2011-04-15 17:46:16 -07:00
Patrick Walton
cc6a9c8876 rustc: Remove the "boxed" check, and make the static_size_of_tag recursion-eliminating transformation deep 2011-04-15 15:16:06 -07:00
Rafael Ávila de Espíndola
2214b6835d Add a -S option for producing assembly. I will move more of it to
rust once the necessary APIs are available in C.
2011-04-15 17:41:14 -04:00
Patrick Walton
790084ced1 rustc: Make fold_ty no longer use an object; introduce walk_ty 2011-04-15 13:01:31 -07:00
Graydon Hoare
232c450957 Work on destructors, not entirely functional yet (no tydesc integration). 2011-04-14 16:50:59 -07:00
Patrick Walton
0387b5a060 rustc: Use the unified result for the type of assignment expressions 2011-04-14 15:28:50 -07:00
Patrick Walton
35e021ed53 rustc: Perform type substitutions when recording locals 2011-04-14 12:33:26 -07:00
Patrick Walton
65b7578851 rustc: Remove generalize_ty. Instead, maintain an explicit type parameter substitution list. 2011-04-14 11:24:25 -07:00
Patrick Walton
ec5a60d5e2 rustc: Use union-find for variable substitution 2011-04-14 11:24:25 -07:00
Brian Anderson
99a697b56a Add support for upper-case hex and binary output to #fmt.
Only works for uints at present. Necessitated the addition of _str.to_upper.
2011-04-13 22:14:54 -04:00
Brian Anderson
5c0f4c1939 Add more commentary about ExtFmt 2011-04-13 22:14:40 -04:00
Brian Anderson
4844e1c08a Add support for printing uints as lower-case hex to ExtFmt.
Begin passing an ExtFmt.RT.conv parsed format description to each of the
ExtFmt.RT.conv* functions.
2011-04-13 22:14:24 -04:00
Brian Anderson
aebdef0cd6 Move #fmt conversion model into ExtFmt.CT namespace 2011-04-13 22:13:21 -04:00
Tim Chevalier
de50efebc2 rm unused import 2011-04-13 15:50:34 -07:00
Tim Chevalier
7c6e6fc5d4 Make expr_while work in typestate_check
Also did some refactoring in typestate_check. All test cases in
compile-fail that involve uninitialized vars now fail correctly!
(All eight of them, that is.)
2011-04-13 15:50:34 -07:00
Graydon Hoare
afeb3a417c Fix temporary-spilling logic in trans_args, uncomment most of lib-deque.rs (which now passes on stage0). 2011-04-13 15:21:54 -07:00
Graydon Hoare
8e0ecb4d1a Lex numeric escapes, needed for lib-str.rs (which now passes). 2011-04-13 11:25:11 -07:00
Rafael Ávila de Espíndola
e7b8db2e63 Enable alias analysis and the function attributes pass.
The C API extension is already upstream, we can drop the local copy once
the bots are updated.
2011-04-13 13:54:08 -04:00
Tim Chevalier
63e87c102d typestate_check can now handle expr_block, expr_if, and expr_binary
(caveat for the latter: it assumes that binary operations are strict;
a TODO is to detect or and and and correctly reflect that they're lazy
in the second argument). I had to add an ann field to ast.block,
resulting in the usual boilerplate changes.

Test cases that currently work (if you uncomment the typestate pass
in the driver) (all these are under test/compile-fail):

fru-typestate
ret-uninit
use-uninit
use-uninit-2
use-uninit-3
2011-04-12 19:03:52 -07:00
Patrick Walton
de0175abed rustc: Switch to indices for type parameters 2011-04-12 15:10:40 -07:00
Patrick Walton
e11e8754de rustc: Add "float" as a type to the pretty printer 2011-04-12 15:10:39 -07:00
Tim Chevalier
d7e8818414 Further work on typestate. Handles expr_rec and expr_assign now.
Also changed the ts_ann field on statements to be an ann instead,
which explains most of the changes.

As well, got rid of the "warning: no type for expression" error
by filling in annotations for local decls in typeck (not sure whether
this was my fault or not).

Finally, in bitv, added a clone() function to copy a bit vector,
and fixed is_true, is_false, and to_str to not be nonsense.
2011-04-12 14:31:46 -07:00
Graydon Hoare
7c55938125 Make glue always pass-by-alias and rename "scalar_or_boxed" concept to "immediate" 2011-04-12 12:48:46 -07:00
Graydon Hoare
f374fa44b6 Tighten up condition on use of opaque_tag, remove blunt hammer of alias arg-casting in trans_args. 2011-04-12 12:48:46 -07:00
Rafael Ávila de Espíndola
dd6fc607a4 Enable more optimizations. 2011-04-12 15:33:39 -04:00
Brian Anderson
73eecbd0ca Factor out creation of calls into ExtFmt.RT 2011-04-11 21:55:03 -04:00
Brian Anderson
bba245f3e6 Add support for bool, char to extfmt.
XFAIL syntax-extension-fmt in rustboot.
2011-04-11 21:54:03 -04:00
Brian Anderson
37f87161cc Move ExtFmt compile-time functions into their own module 2011-04-11 21:51:23 -04:00
Brian Anderson
ce85b9eb7b Make ExtFmt call its own functions instead of others defined in std 2011-04-11 21:51:23 -04:00
Brian Anderson
d4d0144bcf Move extfmt parsing into standard library 2011-04-11 21:51:23 -04:00
Brian Anderson
5a36786634 Move the extfmt data model into the standard library. 2011-04-11 21:51:23 -04:00
Patrick Walton
9d9790c7f5 rustc: Add a uint hash function 2011-04-11 16:54:05 -07:00
Patrick Walton
e0faf57313 rustc: Factor out expr_ty() into expr_ann() and expr_ty() 2011-04-11 15:05:39 -07:00
Rafael Ávila de Espíndola
cca6335c26 Implement the "attempted dynamic environment-capture" error in rustc. 2011-04-11 15:35:01 -04:00
Patrick Walton
3efb7f5459 rustc: Push down types for all expressions; add logic for recv and send 2011-04-08 18:14:31 -07:00
Graydon Hoare
35573144c5 Remove silly legacy glue-offset encoding, predicate runtime adjustments by ABI. LLVM should inline most glue now. 2011-04-09 00:54:46 +00:00
Marijn Haverbeke
c0d0b717ee Fix codemap.lookup_pos
Previously, it would place every single location in the first
file of the crate that was parsed.
2011-04-09 01:57:48 +02:00
Patrick Walton
129c8392af rustc: Rename "demand" to "pushdown" in the typechecker and explain more clearly what it's for 2011-04-08 16:22:03 -07:00
Marijn Haverbeke
1af3174fe3 Move to single-uint file-position representation.
This makes passing them around cheaper. There is now a table (see
front/codemap.rs) that is needed to transform such an uint into an
actual filename/line/col location.

Also cleans up the span building in the parser a bit.
2011-04-09 01:05:18 +02:00
Marijn Haverbeke
094d31f5e4 Make lexer buffer the whole file
This way, it won't have to go through a bunch of calls for each
byte fetched.
2011-04-09 01:05:18 +02:00
Patrick Walton
573bc5ad01 rustc: Resolve ty_locals 2011-04-08 15:41:08 -07:00
Patrick Walton
5355811859 rustc: Add the ability to fold over annotations 2011-04-08 15:21:49 -07:00
Rafael Ávila de Espíndola
ad7aff8203 Remove unused function. 2011-04-08 16:03:35 -04:00
Rafael Ávila de Espíndola
70bc63a3af Remove unused function. 2011-04-08 15:14:26 -04:00
Tim Chevalier
97d0f76c63 fix long lines 2011-04-08 17:46:46 +00:00
Tim Chevalier
9c001af07c Implemented computing prestates and poststates for a few expression forms.
The typestate checker (if it's uncommented) now correctly rejects a
trivial example program that has an uninitialized variable.
2011-04-08 17:46:46 +00:00
Brian Anderson
d2d42fd4c7 Make block results work for generic types
I think just about every type can be used as a block result now. There's quite
a proliferation of tests here, but they all test slightly different things and
some are split out to remain XFAILed. The tests of generic vectors are still
XFAILed because generic aliased boxes still don't work in general.
2011-04-07 21:58:36 -04:00
Patrick Walton
f28a9d8f52 rustc: Pointer cast when crossing a box boundary for statically-sized elements in trans_index() 2011-04-07 18:02:01 -07:00
Marijn Haverbeke
32e62d0151 add a -parse-only option to rustc
(undocumented, only used for profiling the parser)
2011-04-08 00:46:41 +02:00
Patrick Walton
6dcf6218b1 rustc: Pointer cast when autodereferencing boxed tag types 2011-04-07 15:12:48 -07:00
Patrick Walton
9b35051143 rustc: Use the name "opaque_tag", not "tag", for opaque tags 2011-04-07 15:12:48 -07:00
Lindsey Kuper
1092bbfff0 Support for self-calls that take arguments.
Nicer parsing of self-calls (expr_self_method nodes inside expr_call
nodes, rather than a separate expr_call_self) makes typechecking
tractable.  We can now write self-calls that take arguments and return
values (see: test/run-pass/obj-self-*.rs).
2011-04-07 14:26:34 -07:00
Marijn Haverbeke
39774e88b4 Add a very basic crate-dump utility
'rustc -ls [cratelib]' will now dump out a list of symbols defined by
the crate, as well as a short description of what they are.
2011-04-07 14:19:19 -07:00
Marijn Haverbeke
d678dad434 Fix problem in metadata writer
It was creating non-multiple-of-four section sizes, which, for some
reason, presumably by LLVM, were clipped, rather than padded, to be a
multiple of four.
2011-04-07 14:19:17 -07:00
Marijn Haverbeke
ac3026412b Revise EBML reader API
New one is less stateful, easier to work with.
2011-04-07 14:19:16 -07:00
Patrick Walton
0f5f467dc0 rustc: Remove useless call to type_of() in trans_rec() 2011-04-07 13:55:02 -07:00
Patrick Walton
015c0d0d59 rustc: Allow dereference expressions to be used as lvalues. Add a test case. 2011-04-07 12:51:27 -07:00
Rafael Ávila de Espíndola
b4422cca21 Add a -O option and change the Makefile to use it. 2011-04-07 15:42:06 -04:00
Patrick Walton
ddf96ac3a8 rustc: Reindent line. Puts out burning tinderbox. 2011-04-07 12:01:48 -07:00
Patrick Walton
cd6962f29d rustc: Link to external tag discriminants. Un-XFAIL test/run-pass/lib-option.rs. 2011-04-07 11:42:40 -07:00
Patrick Walton
2a894cabc2 Merge branch 'master' of github.com:graydon/rust 2011-04-07 10:14:25 -07:00
Rafael Ávila de Espíndola
25320da099 Run optimizations.
It is always on for now just to make sure the bots are happy. If they
are, I will add a -O option and update the makefile.
2011-04-07 12:12:21 -04:00
Tim Chevalier
2e90bd94de Continued sketching out code for checking states against preconditions.
It's still sketchy. I added a typestate annotation field to statements
tagged stmt_decl or stmt_expr, because a stmt_decl statement has a typestate
that's different from that of its child node. This necessitated trivial
changes to a bunch of other files all over to the compiler. I also added a
few small standard library functions, some of which I didn't actually end
up using but which I thought might be useful anyway.
2011-04-06 17:58:18 -07:00
Patrick Walton
d9da43984b Merge branch 'master' of github.com:graydon/rust 2011-04-06 10:25:32 -07:00
Graydon Hoare
5e98cd9472 Remove reference to nonexistent ast.module from typestate_check.rs, stage1 doesn't like it. 2011-04-06 04:18:12 +00:00
Graydon Hoare
52abd912c0 Brute force and ignorance workaround for tag-and-generic-obj; un-XFAIL it. 2011-04-05 21:08:13 -07:00
Tim Chevalier
86d4601827 More work on typestate. Sketched out code for computing and checking prestates and poststates. Still a long ways away. 2011-04-06 00:17:06 +00:00
Lindsey Kuper
4fc8de1969 Last pieces of self-call support.
The last few pieces of the hack that lets us use trans.trans_call() to
translate self-calls, plus a fix for the parser buy that was
preventing self-call expressions from getting past parsing.
test/run-pass/obj-self.rs works now (as in it actually prints "hi!"
twice!).
2011-04-05 16:26:31 -07:00
Lindsey Kuper
b8bb2e118e Further on the path toward self-awareness.
Mostly:

  * Merciless refactoring of trans.rs so that trans_call can work for
    self-calls as well as other kinds of calls

Also:

  * Various changes to go with having idents, rather than exprs, in
    expr_call_self AST nodes
  * Added missing case for SELF token to token.to_str()
2011-04-05 14:54:48 -07:00
Graydon Hoare
8703c8067f FIx native wrapper generation to handle more arg types. 2011-04-05 21:52:48 +00:00
Lindsey Kuper
361ee5a68b Oops -- if we're going to use the pretty-printer, we need it to work. 2011-04-05 11:55:14 -07:00
Lindsey Kuper
ba537fa5f5 Knocking out a quick fixme: pretty-printing exprs in error messages. 2011-04-05 11:55:12 -07:00
Graydon Hoare
70e5457d7c Make box prefix operator and box type carry mutability flag. 2011-04-04 15:44:15 -07:00
Patrick Walton
f10a5bbad0 rustc: Make type_of() return the type of the wrapper for native functions. lib-map now compiles, but fails to work properly. 2011-04-03 15:23:58 -07:00
Brian Anderson
bd9f45446a Begin comparing vectors from the correct address
Start at the first element instead of the address of the vector.
2011-04-03 03:09:20 -04:00
Graydon Hoare
8e9c5b96fb Change rust_vec to have a 16-byte header, to 16-byte-align vec-body data. Major perf win. 2011-04-02 19:05:12 -07:00
Brian Anderson
99901bdbc4 Add FIXMEs around type handling in trans_if, trans_alt 2011-04-02 20:35:51 -04:00
Brian Anderson
21fb49ad95 Join the results of alt arms so alt can be used as an expression.
Un-XFAIL expr-alt.rs.
2011-04-02 20:35:50 -04:00
Brian Anderson
203e33b611 Make join_results branch into the join block even when only one edge is live.
I don't don't totally understand the implications of this but it makes the
behavior consistent for all live edges, which is going to make joining the
arms of an alt expression work correctly.
2011-04-02 20:35:50 -04:00
Brian Anderson
6e6acaa39a Fail on non-exhaustive alt matches 2011-04-02 20:35:50 -04:00
Brian Anderson
9d0a505d61 Terminate fail blocks by making their ends unreachable.
This will make implementing default alt arms simpler.
2011-04-02 20:35:50 -04:00
Graydon Hoare
4f90c88b4d Write typarams for variants. Typecheck gets as far as ty.rs now. 2011-04-01 18:53:08 -07:00
Graydon Hoare
5b7961b641 Encode ty_native ebml node for native types so typechecker has something to work with. 2011-04-01 18:34:13 -07:00
Graydon Hoare
c077da553d Remove typestate_check reference to nonexistent ast.init node; rustc compiling itself notices what rustboot did not :) 2011-04-01 18:33:47 -07:00
Graydon Hoare
23f18a096f Re-enable typestate_check in build, was lost during merge. Sorry. 2011-04-01 17:23:56 -07:00
Graydon Hoare
0397c05f42 Support for passing native types through metadata/creader. 2011-04-01 17:04:51 -07:00
Graydon Hoare
2a2ea6351d Comment out import for not-yet-compiling typestate_check. 2011-04-01 17:04:07 -07:00
Graydon Hoare
3971110d7f Guh. Actually commit the staged undo-of-indentation. Forgotten git staging wins again. 2011-04-01 16:04:22 -07:00
Graydon Hoare
7d88e63ec8 Switch private linkage to local, re-indent trans.rs. 2011-04-01 15:01:46 -07:00
Patrick Walton
3a8b0be1cb rustc: Write symbols for native items into the crate metadata 2011-04-01 14:18:46 -07:00
Patrick Walton
a0eb9c814b rustc: Don't try to write symbols into the metadata for nullary tags. Puts out burning tinderbox. 2011-04-01 14:14:10 -07:00
Patrick Walton
6dc452335a rustc: Get tag variants from the crate metadata 2011-04-01 13:02:44 -07:00
Patrick Walton
ec9d7abf8c rustc: Have tag_variants() return a new variant_info structure instead of an AST node 2011-04-01 11:37:31 -07:00
Tim Chevalier
3130348ee1 Started adding support for typestate checking.
I added a new field to the ast "ann" type for typestate information.
Currently, the field contains a record of a precondition bit vector and
postcondition vector, but I tried to structure things so as to make
it easy to change the representation of the typestate annotation type.
I also had to add annotations to some syntactic forms that didn't have
them before (fail, ret, be...), with all the boilerplate changes
that that would imply.

The main call to the typestate_check entry point is commented out and
the actual pre-postcondition algorithm only has a few cases
implemented, though the overall AST traversal is there. The rest of
the typestate algorithm isn't implemented yet.
2011-04-01 11:27:32 -07:00
Patrick Walton
69a34b992b rustc: Remove useless call to tag_variant_with_id() 2011-04-01 10:59:59 -07:00
Brian Anderson
1bc06bc59b Cleanup typos and newlines 2011-04-01 00:05:13 -04:00
Brian Anderson
f16e7242d2 Initialize the alloca used to retrieve boxed block results to null.
This allows blocks to be used in conditional constructs where the block may
not ever execute: the drop glue will notice that it was never used and ignore
it.

Also, beef up the comments.
2011-03-31 23:15:11 -04:00
Brian Anderson
524e803582 Only use allocas to hold expression results for boxed types 2011-03-31 23:15:11 -04:00
Brian Anderson
f05d3c516b Add more comments to trans_block 2011-03-31 23:15:11 -04:00
Brian Anderson
125bebbf60 Modify trans.rs to allow blocks to result in boxed values 2011-03-31 23:15:11 -04:00
Brian Anderson
d631f29d47 Add block_to_str and expr_to_str methods to the pprust module.
Since pprust is authed impure these can be used for debug logging.
2011-03-31 23:15:11 -04:00
Patrick Walton
c66edca83d rustc: Add a type annotation to tag items 2011-03-31 19:12:40 -07:00
Patrick Walton
1eeedbd008 rustc: Make tag_ty_params() and substitute_ty_params() take def ids instead of ty_params, and to check in external crates 2011-03-31 18:45:24 -07:00
Patrick Walton
bdea343879 rustc: Use the path index. Speeds up compilation a lot. 2011-03-31 18:28:59 -07:00
Patrick Walton
fffc5d3b3d rustc: Write out a path index as well 2011-03-31 18:28:59 -07:00
Graydon Hoare
1b65a61cad Couple minor bug fixes in creader, lib-bitv, int, rand, sort, sha1, uint and vec all work. 2011-03-31 15:57:36 -07:00
Patrick Walton
3c1de96cda rustc: Use the crate index to look up defs 2011-03-31 14:37:44 -07:00
Lindsey Kuper
ef0c903f6a More stuff to go with the new expr_call_self AST node 2011-03-31 14:16:02 -07:00
Lindsey Kuper
e939d6f17c More machinery for adding an expr_call_self AST node. 2011-03-31 14:04:53 -07:00
Patrick Walton
6c383bbd7b rustc: Index only the local part of definition IDs 2011-03-31 12:24:59 -07:00
Patrick Walton
3945ace520 rustc: Write out an index of definition info in crate metadata 2011-03-31 11:56:02 -07:00
Patrick Walton
6a60cb1e0c rustc: Mix the bits more when hashing def ids 2011-03-31 11:55:28 -07:00
Patrick Walton
7f3f66df7b rustc: Use the scaled index, not the raw index, if a vector has generic size. lib-vec.rs works now. 2011-03-31 10:10:21 -07:00
Brian Anderson
607fa14960 Rename incr_all_refcnts to take_ty, to match drop_ty 2011-03-31 14:52:30 +00:00
Brian Anderson
b0b72ab472 Restore scope block contexts to the translation of expr_block.
I removed this previously but that was wrong because it caused
block expressions to not create a new scope.
2011-03-31 14:52:29 +00:00
Brian Anderson
50e354611f Remove redundant parser logic.
These cases are all dealt with in parse_expr_inner.
2011-03-31 14:52:29 +00:00
Marijn Haverbeke
6a75740e96 handle unterminated block comments and line comment at eof 2011-03-31 14:41:40 +00:00
Marijn Haverbeke
39f0656b4f Improve line comment positioning
This involved making ast.variant spanned.
2011-03-31 14:41:40 +00:00
Marijn Haverbeke
8a7ea941bb Support break and cont in pretty-printer 2011-03-31 14:41:40 +00:00
Marijn Haverbeke
f8393cc572 Add effect field to ast.ty_fn.
Still not used, except by the pretty-printer.
2011-03-31 14:41:40 +00:00
Marijn Haverbeke
e7e6f396d8 Preserve comments when pretty-printing.
The patch also includes a number of smaller fixes to the
pretty-printer that were encountered on the way.
2011-03-31 14:41:39 +00:00
Graydon Hoare
ffc188a4dd Tweak build command on rustc. 2011-03-31 14:41:35 +00:00
Patrick Walton
ab8d200fb0 rustc: Read 'y' tags from external crates 2011-03-30 18:28:33 -07:00
Patrick Walton
ae5ba62b24 rustc: Use the type cache to construct external item references 2011-03-30 18:15:29 -07:00
Patrick Walton
cc59cea8b0 rustc: Thread an item-to-type mapping throughout the typechecking and translation phases 2011-03-30 17:28:06 -07:00
Graydon Hoare
3e7b991d49 Ensure task stacks start out with a 16-byte aligned entry frame. Should make OSX behave a bit better. 2011-03-30 13:04:18 -07:00
Patrick Walton
301cfe1354 rustc: Add all items to the item table during translation. lib-vec now compiles, but asserts and then segfaults. 2011-03-29 18:16:53 -07:00
Patrick Walton
626bdaaa1f rustc: Parse parameter IDs in external crate metadata. Un-XFAIL lib-bitv.rs. 2011-03-29 17:25:55 -07:00
Patrick Walton
c67eb1a575 rustc: Partially resolve external module imports 2011-03-29 17:01:27 -07:00
Patrick Walton
6a5feffd6c rustc: Tolerate def id tags inside module tags. Fixes metadata reading. 2011-03-29 16:43:27 -07:00
Lindsey Kuper
55fbed3d8d Beginnings of support for magical self prefix; nothing profound happening yet. 2011-03-29 15:59:15 -07:00
Graydon Hoare
f6490a6f03 Ignore 'mutable foo' in plain field contexts. 2011-03-29 15:40:21 -07:00
Patrick Walton
94c061729b rustc: Resolve external modules and native modules to definition IDs as well 2011-03-29 14:46:42 -07:00
Graydon Hoare
77f85460e6 Rename trans_native to trans_native_call, for clarity. 2011-03-29 13:23:51 -07:00
Graydon Hoare
734abe593d Teach trans to emit undefined references to 'use'd symbols. Can compile and run a simple 'use std;' example now. 2011-03-29 13:23:51 -07:00
Brian Anderson
8f2a97a562 Add partial support for if expressions resulting in generic types 2011-03-28 21:14:08 -07:00
Brian Anderson
aced4ce145 Handle structural types as the result of if expressions 2011-03-28 21:14:04 -07:00
Brian Anderson
a5a319fa04 Teach rustc to use the result of if expressions 2011-03-28 21:14:03 -07:00
Brian Anderson
2b27d12ce1 Add expr_spawn, spawn parsing, folding, typechecking, ty_task 2011-03-28 21:13:53 -07:00
Graydon Hoare
540d29f641 Move all allocas to dedicated basic block at top of function, to keep frames finite. Un-comment next size in nbody.rs. 2011-03-28 18:07:29 -07:00
Patrick Walton
2809e30d1d rustc: Parse types in external metadata 2011-03-28 16:49:26 -07:00
Patrick Walton
ace2c92a96 rustc: Populate the item types table with types of items from external crates; remove the redundant typeck.ty_and_params type on the way 2011-03-28 14:42:01 -07:00
Patrick Walton
621ab34410 rustc: Remove commented out "encode_tag_variant_info" call that sneaked in 2011-03-28 13:31:13 -07:00
Patrick Walton
62f4709953 rustc: Resolve def ids in external crates 2011-03-28 13:29:59 -07:00
Patrick Walton
cc221c472a rustc: Don't include a trailing null when writing out metadata; it corrupts the EBML 2011-03-28 13:15:03 -07:00
Graydon Hoare
8b5968165f Fix get_tydesc to alloca enough room for root; remove hack that was attempting to paper over it. Fix from espindola. 2011-03-28 11:11:03 -07:00
Patrick Walton
81695a19f8 rustc: Add support for calling LLVM intrinsics as native functions 2011-03-28 08:24:58 -07:00
Marijn Haverbeke
6ecdc04788 Add support for break and cont to rustc
Testing proper cleanup is hampered by
https://github.com/graydon/rust/issues/293
2011-03-27 14:11:23 +02:00
Graydon Hoare
f59e49c9a6 Twiddle visibility, start exposing only type-mangled names (64 bit truncated sha1 prefixes). 2011-03-26 19:14:07 -07:00
Graydon Hoare
dbc7289a4d Start refactoring name-mangling in trans. 2011-03-26 17:36:47 -07:00
Graydon Hoare
643a75b86e Add visibility enum values to lib.llvm. 2011-03-26 17:36:26 -07:00
Graydon Hoare
ac6e1131e9 Teach creader and metadata writer how to do ty.ty_type. 2011-03-26 17:35:51 -07:00
Patrick Walton
bea41aa7d8 rustc: Add a function to look up external item info in the item info table 2011-03-25 19:02:19 -07:00
Graydon Hoare
027368b885 Janitorial: move llvmext back to llvm module, as they're the same thing now. 2011-03-25 18:45:00 -07:00
Patrick Walton
24a75eeccc rustc: Parse definition IDs from crates; add a function to parse unsigned ints to the standard library 2011-03-25 18:35:30 -07:00
Graydon Hoare
ee686dacb8 Add get_extern_const, factor get_extern into get_extern_fn and get_simple_extern_fn. 2011-03-25 17:59:56 -07:00
Patrick Walton
94c19a18ae rustc: Look up names in "use"d crates 2011-03-25 17:54:48 -07:00
Graydon Hoare
661f1c541e Trans nomenclature tidy-up: upcall vs. native vs. extern. 2011-03-25 15:48:00 -07:00
Graydon Hoare
b2427509e2 Another go at changing compile-command, this time using RBUILD env var. 2011-03-25 15:07:27 -07:00
Graydon Hoare
3712ee68ad Sketch of wiring typeck up to creader. 2011-03-25 14:34:32 -07:00
Graydon Hoare
91c2b82b09 Revert "Bulk-edit compile commands in emacs chatter to point to assumed build/ dir off src root."
This reverts commit 846f2e2ba9.
2011-03-25 14:05:38 -07:00
Graydon Hoare
846f2e2ba9 Bulk-edit compile commands in emacs chatter to point to assumed build/ dir off src root. 2011-03-25 13:48:37 -07:00
Tim Chevalier
a47cd50dfb Parse FP literals without coercing to int. This allows parsing 64-bit
floats. However, if someone writes a literal that can't be represented
precisely in 64 bits, the front-end will accept it while the back-end
will (presumably) complain.
2011-03-25 11:20:30 -07:00
Patrick Walton
e2d6475308 rustc: Store cached crate metadata in the session 2011-03-25 11:11:21 -07:00
Brian Anderson
9ca7acb1f3 Update pretty printer for ports, channels, send and receive 2011-03-25 11:01:52 -07:00
Brian Anderson
ebc4df3c7a Implement local declarations with receive. Un-XFAIL decl-with-recv.rs. 2011-03-25 11:01:52 -07:00
Brian Anderson
71f058499a Refactor ast.local to make room for initialization via recv 2011-03-25 11:01:52 -07:00
Patrick Walton
77a3373d53 rustc: Create a crate metadata cache 2011-03-25 10:44:24 -07:00
Marijn Haverbeke
d4c3059e1e make lexer unicode-aware for strings and char literals 2011-03-25 08:23:00 -07:00
Marijn Haverbeke
a045514477 Start making the standard-lib utf-8 aware
Finally implements _str.is_utf8, adds from_chars, from_char, to_chars,
char_at, char_len, (push|pop|shift|unshift)_char. Also, proper
character I/O for streams.
2011-03-25 08:22:52 -07:00
Marijn Haverbeke
d3b49f5aab fix pretty-printer
A change in 54587bdccb (the vec
appending overhaul) had broken it. (Apparently modifying a vec while
iterating over it can corrupt memory.)
2011-03-25 07:59:13 -07:00
Graydon Hoare
4e49ca8abd Start hooking resolve into creater. 2011-03-24 17:37:32 -07:00
Patrick Walton
af3d0d1848 rustc: Open "use"d crates; add a _vec.vec_from_buf() method along the way; XFAIL use-import-export.rs in rustc 2011-03-24 17:22:07 -07:00
Graydon Hoare
86f1ace55b Teach creader about reading ty_float, and trim trailing whitespace. 2011-03-24 11:50:45 -07:00
Patrick Walton
2c21195b21 rustc: Emit a better error message when a type is used where a value was expected 2011-03-24 10:29:15 -07:00
Patrick Walton
4c5ab05741 rustc: Switch over to using rustllvm.dll exclusively, ending the "Franken-LLVM" problem 2011-03-23 17:48:53 -07:00
Graydon Hoare
08bea1d9a2 Revert "Change the type of the second argument of upcalls to be a %task*.", breaks win32 build.
This reverts commit dcf122ede0.
2011-03-23 16:31:30 -07:00
Lindsey Kuper
0b63512f4c Support for 'float' in type signatures. 2011-03-23 16:01:29 -07:00
Patrick Walton
c669f20231 rustc: Write out crate metadata 2011-03-23 15:44:17 -07:00
Tim Chevalier
23e23bd762 Further support for floating-point. Literals with exponents work
and literals with the 'f32' or 'f64' suffixes work as well. In
addition, logging things with the f32 or f64 type works. (float is
still assumed to be a synonym for f64).
2011-03-22 17:31:27 -07:00
Rafael Ávila de Espíndola
dcf122ede0 Change the type of the second argument of upcalls to be a %task*. 2011-03-22 17:50:18 -04:00
Lindsey Kuper
0ce0c4c41a Support for shorter error messages that are aware of objects' cnames. 2011-03-22 14:23:43 -07:00
Patrick Walton
bcf04e253f Revert "Remove usages of case(_) { fail; } since the compiler does this automatically". When we have exhaustiveness checking, "case(_) { fail; }" will be useful to silence warnings.
This reverts commit 92a716d862.
2011-03-22 14:02:52 -07:00
Brian Anderson
92a716d862 Remove usages of case(_) { fail; } since the compiler does this automatically 2011-03-22 08:11:34 -07:00
Brian Anderson
530fe1daea Add a cleanup to trans_send. Express further confusion about cleanups in trans_recv 2011-03-22 08:04:53 -07:00
Brian Anderson
cddd8094da Remove a todo from trans_chan that doesn't appear necessary 2011-03-22 08:04:49 -07:00
Brian Anderson
c02cdc32a8 Generalize send/recv to work for more types 2011-03-22 08:04:45 -07:00
Brian Anderson
39c01c97ba Fix trans_recv 2011-03-22 08:04:41 -07:00
Brian Anderson
b2ee569c23 Implement trans_send and a broken trans_recv 2011-03-22 08:04:39 -07:00
Brian Anderson
261d1e4c61 Add codegen for ports and chans 2011-03-22 08:04:38 -07:00
Tim Chevalier
1e1ff638a3 Make floating-point operations work (neg, add, sub, mul, div, rem,
and comparison ops.)
2011-03-21 18:10:34 -07:00
Tim Chevalier
caa22c9341 Started adding support for floating-point type, floating-point literals, and logging of floats. Other operations on float probably don't work yet. 2011-03-21 18:10:34 -07:00
Rafael Ávila de Espíndola
933c01bd15 Every upcall needs a task pointer to find the C stack. It is just that when
handling cdecl call they should skip it when calling the final function.

There is some cleanup to be done on the generated IL, but this gets us
running Hello World for real.
2011-03-21 17:53:11 -04:00
Rafael Ávila de Espíndola
f3057244a6 Make the wrapper function of native functions private. 2011-03-21 16:02:00 -04:00
Rafael Ávila de Espíndola
12e7feb71c The T_taskptr is already included in the n_args, don't add it twice. 2011-03-21 15:15:22 -04:00
Patrick Walton
3dec5b5e50 rustc: Remove uses of Unicode in type deserialization and fix vector-push operations 2011-03-21 12:03:34 -07:00
Patrick Walton
84c0d8638e rustc: Update type serialization and deserialization for the "mutable?" change 2011-03-21 11:44:08 -07:00
Marijn Haverbeke
86d05655b4 rustc: Merge in type serialization and deserialization
Signed-off-by: Patrick Walton <pcwalton@mimiga.net>
2011-03-21 11:35:04 -07:00
Rafael Ávila de Espíndola
e687dd5ce7 Make lltaskptr a regular argument element in args in calls to trans_upcall2. 2011-03-21 11:59:14 -04:00
Rafael Ávila de Espíndola
770a49520c Move calls to PtrToInt out of trans_upcall2. 2011-03-21 11:11:22 -04:00
Graydon Hoare
4b946cea35 Modify native_item_fn to handle trailing linkage names that differ from the item name (used in win32 build of std.dll) 2011-03-20 20:18:19 -07:00
Patrick Walton
d31bfc8692 rustc: Internalize glue. Cuts libstd size by 8% or so. 2011-03-20 15:05:13 -07:00
Patrick Walton
277d42f589 rustc: Only declare each native function once. std.rc now links. 2011-03-19 17:33:46 -07:00
Patrick Walton
a1aad28690 rustc: Use the right block context to generate unary operands. std.rc compiles now. For realz. 2011-03-19 15:03:21 -07:00
Patrick Walton
8e597b295f rustc: Allow arguments to be captured as upvars. std.rc compiles now, except for the lack of a main fn. 2011-03-19 14:26:12 -07:00
Patrick Walton
c710c9a1b8 rustc: Do argument casts before loading aggregates, not after 2011-03-19 13:58:48 -07:00
Patrick Walton
3f2bae4449 rustc: Implement int-to-native casts 2011-03-18 18:49:59 -07:00
Patrick Walton
e6b6d1b645 rustc: Make trans_path() generic-safe wrt nullary tags 2011-03-18 18:45:49 -07:00
Patrick Walton
95dc89f012 rustc: Make iter_structural_ty_full() generic-safe wrt tags 2011-03-18 18:34:06 -07:00
Patrick Walton
8c48fae726 rustc: Do pointer casts when casting native types 2011-03-18 18:12:58 -07:00
Patrick Walton
9c0c0af1b2 rustc: Fix inference for auto slots (forgot to stage changes before) 2011-03-18 17:45:47 -07:00
Patrick Walton
f3b58947c0 rustc: Don't always build a constant multiply instruction when translating literal vectors; the size of the referent isn't always constant 2011-03-18 16:41:56 -07:00
Patrick Walton
533dea772f rustc: Move type_of() behind the check for dynamic size in trans_vec() 2011-03-18 16:34:22 -07:00
Patrick Walton
78bcfe28f2 rustc: Create global variable constants during the collection phase 2011-03-18 16:24:01 -07:00
Patrick Walton
8ff77b14a9 rustc: Make iter_sequence() work with generic vectors 2011-03-18 16:04:16 -07:00
Patrick Walton
47d650e25b rustc: Box the tuples returned by hashmap.items() for now since we don't have alias iterators yet 2011-03-18 15:18:45 -07:00
Patrick Walton
ebee49314b rustc: Get type params from the item when translating native items 2011-03-18 15:01:45 -07:00
Patrick Walton
8b82a549bf rustc: When encountering "mutable" as a tycon, parse it, drop it on the floor, and emit a warning 2011-03-18 13:44:54 -07:00
Patrick Walton
e8938f5fb2 rustc: Unify over alt expressions 2011-03-18 12:49:48 -07:00
Patrick Walton
6f65ce5255 rustc: Add a span_unimpl() for debugging 2011-03-18 12:30:44 -07:00
Patrick Walton
2ef9c01ffc rustc: Implement "mutable?". Add a test case and XFAIL it in rustboot for now. 2011-03-18 11:49:47 -07:00
Patrick Walton
5eca7129e3 rustc: Switch mutability from being a type constructor to a field annotation 2011-03-17 17:39:47 -07:00
Patrick Walton
ed96688be5 rustc: Typo: mutabliity -> mutability 2011-03-17 16:39:10 -07:00
Patrick Walton
67bac63aa3 rustc: Correctly report mutability when stringifying types 2011-03-17 11:54:00 -07:00
Patrick Walton
2ca66718ce rustc: Consider native types to be scalar 2011-03-17 11:46:21 -07:00
Patrick Walton
55587a554c rustc: Sort object methods when parsing textual types in the AST 2011-03-17 11:40:05 -07:00
Patrick Walton
bc51842d4f rustc: Don't go over inner functions' locals during the writeback phase of typechecking 2011-03-17 11:23:17 -07:00
Rafael Ávila de Espíndola
9dc3f3f183 Fixed version of my previous patch to rename the upcall functions. This time also update the inline assembly. 2011-03-16 18:09:12 -04:00
Graydon Hoare
54587bdccb Switch all vases of vec += elt to vec += vec. Prohibit former in rustboot. Tweak std lib vec fns in process. 2011-03-16 14:58:02 -07:00
Rafael Ávila de Espíndola
e65e1716a7 Revert 6fdb81fa17, it is causing failures in
the bots.
2011-03-16 11:46:51 -04:00
Rafael Ávila de Espíndola
8dc5059058 Update comment to reflect the decision to avoid cycles. 2011-03-16 11:29:41 -04:00
Patrick Walton
1d8b0e8f8a rustc: Remove the memory-managed interface to LLVM memory buffers; passing them around transfers ownership 2011-03-15 18:08:30 -07:00
Patrick Walton
6fdb81fa17 rustc: Open "use"d crates with the LLVM object file reader 2011-03-15 18:05:29 -07:00
Patrick Walton
71b6e602c5 rustc: Add an annotation for the crate definition to view_item_use 2011-03-15 17:33:05 -07:00
Patrick Walton
341d128ad3 Revert "Change the numbering of upcall functions. upcall_0 now calls a function" due to tinderbox failure on win32
This reverts commit bd9dd5ed1a.
2011-03-15 17:20:00 -07:00
Patrick Walton
7d32f3d052 rustc: Add a stub crate reader module for "use" directives 2011-03-15 16:30:43 -07:00
Patrick Walton
bb081d6611 rustc: Typo: "unput" -> "input" 2011-03-15 15:07:41 -07:00
Patrick Walton
736969f9fe rustc: Add support for LLVM memory buffer creation via a wrapper function 2011-03-15 14:58:11 -07:00
Rafael Ávila de Espíndola
bd9dd5ed1a Change the numbering of upcall functions. upcall_0 now calls a function
with no arguments. This is still preparation for calling functions that
don't take a rust task argument.
2011-03-15 16:24:03 -04:00
Graydon Hoare
73f4728182 Append 'svn' to version in dll name, hopefully to bring win32 up again. 2011-03-15 12:55:23 -07:00
Patrick Walton
b07634f212 rustc: Add Rust bindings to the LLVM object file library 2011-03-15 12:27:48 -07:00
Graydon Hoare
316158df8e Bump LLVM version strings to 3.0svn, we're effectively tied to it now anyways. 2011-03-14 17:33:06 -07:00
Graydon Hoare
7f5bffc3ea Merge remote branch 'brson/recursive-elseif' 2011-03-14 16:59:04 -07:00
Brian Anderson
8b5574ac09 Rename check_assignment_like to check_assignment since it turned out not to be useful for send/recv 2011-03-14 16:41:46 -07:00
Brian Anderson
b83a4af93c Fix the typechecking for expr_send and expr_recv 2011-03-14 16:41:46 -07:00
Brian Anderson
4ce4d8857f Add ty_port and ty_chan to expr_ty function 2011-03-14 16:41:46 -07:00
Brian Anderson
83f758cf0d Typecheck expr_send and expr_recv 2011-03-14 16:41:46 -07:00
Brian Anderson
a309f74a94 Reorganize evaluation of expr_send/recv to put them closer to expr_assign, to which they are similar 2011-03-14 16:41:46 -07:00
Brian Anderson
f0842030f3 Fix typo in expr_recv parsing 2011-03-14 16:41:46 -07:00
Brian Anderson
644d8b95da Factor out expression checking for forms that look like assignment 2011-03-14 16:41:46 -07:00
Brian Anderson
7464237256 Add folding and type checking for ports and chans 2011-03-14 16:41:46 -07:00
Brian Anderson
a3cca65f6d Fold ty_chan and ty_port 2011-03-14 16:41:46 -07:00
Brian Anderson
292dac644f Parse receive expressions 2011-03-14 16:41:46 -07:00
Brian Anderson
80e0ebaa86 Parse port and chan types, constructors, send statements 2011-03-14 16:41:46 -07:00
Marijn Haverbeke
77f4c52c3e Make pretty-printer print 'with' clause in rec literals 2011-03-14 14:57:13 -07:00
Marijn Haverbeke
441697ab35 Extend stream functionality
Writer and reader streams now come with methods to write and read
little-endian numbers. Whether that is the right place for such
methods is debatable, but for now, that's where they live.
2011-03-14 14:57:13 -07:00
Marijn Haverbeke
c731d625fe Add basic file-system functionality
std.fs.list_dir will list the files in a directory, std.fs.file_is_dir
will, given a pathname, determine whether it is a directory or not.
2011-03-14 14:57:13 -07:00
Rafael Ávila de Espíndola
3436979b17 Split trans' collection in two passes. This allows us to handle tags
that are defined after use in a block.

This is really inefficient, but for now it lets us compile the included test.
2011-03-14 16:56:03 -04:00
Brian Anderson
bbb6836da0 Merge branch 'master' into recursive-elseif
Conflicts:

	src/comp/middle/typeck.rs
2011-03-13 19:40:25 -04:00
Brian Anderson
2a662944a4 Remove extra blocks from the translation of expr_block
Doesn't seem to break anything and allows trans_if to be streamlined
2011-03-13 19:29:40 -04:00
Graydon Hoare
ec7e84ae0d Preserve crate directives in the parsed crate. 2011-03-11 15:49:56 -08:00
Patrick Walton
9b3db0ed44 rustc: Add some stub metadata to each crate 2011-03-11 15:35:50 -08:00
Rafael Ávila de Espíndola
74d891517b reindex the block index. 2011-03-11 17:35:33 -05:00
Patrick Walton
6392bd1681 rustc: Load structural loop variables in iterators. Un-XFAIL foreach-put-structured.rs. 2011-03-11 14:29:45 -08:00
Rafael Ávila de Espíndola
28d51e3fd2 Add support for indexing tags in blocks. 2011-03-11 17:12:25 -05:00
Patrick Walton
37007a4d01 rustc: Populate the upvar environment when calling iterator bodies. Un-XFAIL test/run-pass/iter-range.rs. 2011-03-11 12:02:51 -08:00
Patrick Walton
336f22db61 rustc: Resolve upvars as necessary 2011-03-11 10:39:36 -08:00
Rafael Ávila de Espíndola
0117cf2fc2 Handle resolving to native modules. 2011-03-10 21:33:53 -05:00
Graydon Hoare
3aac5059ee Move the glue code to a .o file. This reduces how much asm we print
in each "translation unit".

Part of it is not repetitive and should probably be moved to a .ll file, but
for now we autogen all of it.

(Modified somewhat by graydon while integrating).
2011-03-10 17:30:08 -08:00
Patrick Walton
7454b53411 rustc: Build up a list of upvars inside foreach bodies 2011-03-10 16:49:00 -08:00
Patrick Walton
60f86354ad rustc: Use the generic info from the item in bind thunks just as calls do. Un-XFAIL drop-parametric-closure-with-bound-box.rs. 2011-03-10 15:14:45 -08:00
Patrick Walton
185bcc6218 rustc: Increment the counter in trans_bind_thunk() 2011-03-10 15:09:41 -08:00
Patrick Walton
41d5094a8e rustc: Fix off-by-one error and logic error regarding type parameters in the translation of bind expressions. Un-XFAIL bind-obj-ctor.rs. 2011-03-10 14:38:06 -08:00
Rafael Ávila de Espíndola
4ca0259b20 Update the current id when we create sub parsers. 2011-03-10 17:36:41 -05:00
Patrick Walton
36b81abf61 rustc: Perform a cast in vector initialization due to changing layers of indirection. Keep test/run-pass/size-and-align.rs XFAIL'd due to a leak in rustboot. 2011-03-10 12:15:07 -08:00
Patrick Walton
7505c1fa23 rustc: Run cleanups on while expressions' condition blocks. Un-XFAIL while-prelude-drop.rs. 2011-03-10 11:46:37 -08:00
Graydon Hoare
0d3cec71a3 Fix eval typo (caught by Martin Hock). 2011-03-10 10:17:10 -08:00
Graydon Hoare
8e8c336f93 Implement deep structural comparison through boxes and sequences. 2011-03-09 20:14:19 -08:00
Patrick Walton
874e8e3505 rustc: Have tag patterns use the type parameter information from the typechecker instead of trying to deduce it in trans. Un-XFAIL test/run-pass/generic-tag-values.rs. 2011-03-09 17:50:46 -08:00
Graydon Hoare
bafcbb101c Fold exports. 2011-03-09 17:34:22 -08:00
Marijn Haverbeke
ec22fe9733 Add ty_obj case to pretty printer 2011-03-09 16:15:58 -08:00
Marijn Haverbeke
aed40fbcd8 Have the pretty-printer take a writer stream as argument
It now uses a string writer to also fill in for
middle.ty.ast_ty_to_str
2011-03-09 16:15:55 -08:00
Patrick Walton
ea2c868744 rustc: Perform type substitutions for tag variants in dynamic_size_of() 2011-03-09 16:07:55 -08:00
Patrick Walton
1e65baad94 rustc Remove dead "llunit_ty" assignment in trans_index 2011-03-09 15:23:41 -08:00
Patrick Walton
7dc64b45b5 rustc: Make tag pattern translation generic-aware. Un-XFAIL generic-tag-alt.rs. 2011-03-09 15:17:06 -08:00
Patrick Walton
ba2e04f271 Rename confusing usage of "lltag" to "lldiscrim" in trans_pat_match() 2011-03-09 14:29:00 -08:00
Patrick Walton
603d820b85 rustc: Have demand_pat() extract type parameters from tags. Add a test case. 2011-03-09 14:09:02 -08:00
Patrick Walton
2986ed43e9 rustc: Substitute type parameters in type_of_variant(). Add a test case. 2011-03-09 13:31:25 -08:00
Patrick Walton
9aa26904b8 rustc: Remove redundant ty_params_of_tag() function 2011-03-09 13:07:06 -08:00
Patrick Walton
80fa01fb57 rustc: Perform type parameter substitutions in static_size_of_tag() 2011-03-09 12:53:12 -08:00
Patrick Walton
fcd195bb4c rustc: Don't try to load dynamically-sized types when translating tag variants. Add a test case for this. 2011-03-09 12:53:12 -08:00
Rafael Ávila de Espíndola
02f669ca67 Pass the task pointer as just another i32. 2011-03-09 15:35:54 -05:00
Rafael Ávila de Espíndola
10d8b4e861 Fix access to the rust stack. 2011-03-09 15:05:22 -05:00
Rafael Ávila de Espíndola
aeca138944 swap taskptr and callee in preparation for making taskptr optional. 2011-03-09 14:16:11 -05:00
Patrick Walton
50da3ea5bc rustc: Instantiate tag patterns with the type parameters supplied by the programmer. size-and-align.rs typechecks now. 2011-03-09 11:08:59 -08:00
Patrick Walton
b828ec36fb rustc: Factor the type parameter and type lookup out of instantiate_path(), as patterns need different logic 2011-03-09 10:56:45 -08:00
Patrick Walton
3c200f3e14 rustc: Grammar police work in check_pat() error messages 2011-03-09 10:21:48 -08:00
Patrick Walton
0a22a4edbb rustc: Factor out path type instantiation so that tag patterns can use it as well 2011-03-08 18:48:17 -08:00
Patrick Walton
e64085b0a2 rustc: Fold over the paths in tag patterns so that we can resolve type variables in them 2011-03-08 18:11:00 -08:00
Patrick Walton
5b7c3b8b5d rustc: Typecheck the base part of record extension expressions. Un-XFAIL rec-extend.rs. 2011-03-08 17:34:41 -08:00
Patrick Walton
e9fe47b359 rustc: Make ann_to_type() fail if the node has no type. Miraculously, no test cases fail. 2011-03-08 17:03:00 -08:00
Patrick Walton
e62424944b rustc: Have trans get the type parameters from the annotation instead of trying to deduce them itself. Un-XFAIL generic-fn-twice.rs. 2011-03-08 16:56:19 -08:00
Graydon Hoare
01bfc3ae8b Fix generic-bind support for bound aliases and generics. 2011-03-08 16:32:39 -08:00
Patrick Walton
da9ea9ab69 rustc: Move type parameter resolution from translation into the typechecker 2011-03-08 14:55:39 -08:00
Graydon Hoare
27547c6514 Revert "Move the glue asm code to a .o file. This reduces how much asm we print"
This reverts commit 55c80e763b.
2011-03-08 13:20:16 -08:00
Rafael Ávila de Espíndola
55c80e763b Move the glue asm code to a .o file. This reduces how much asm we print
in each "translation unit".
2011-03-08 13:08:31 -08:00
Patrick Walton
35bee753de rustc: Pass explicit type substitutions to later passes 2011-03-08 13:00:31 -08:00
Patrick Walton
4654faa67c rustc: Add a slot for explicit type parameter instantations to the typechecker's AST annotation 2011-03-08 12:42:56 -08:00
Patrick Walton
e2f6f19fc8 rustc: Rework type substitution to pair up type parameter IDs with the supplied type parameter instantiations explicitly 2011-03-08 12:19:37 -08:00
Patrick Walton
51be50490e rustc: Expose common.def_eq(). 2011-03-08 11:59:38 -08:00
Patrick Walton
473a242525 rustc: Store type parameter definition IDs instead of type parameter counts in the typechecker 2011-03-08 11:27:36 -08:00
Patrick Walton
0054efc412 rustc: Store the number of type parameters per item, which will be needed to get unused type params working 2011-03-08 10:57:40 -08:00
Brian Anderson
5aabe7e84f Add partial pretty-printing for syntax extensions 2011-03-07 22:06:26 -05:00
Brian Anderson
fa2525a7bd Remove old pretty-printer from rustc 2011-03-07 22:06:07 -05:00
Brian Anderson
5ba012f4a5 Add missing alt arm to expr_if pretty-printer 2011-03-07 22:05:55 -05:00
Brian Anderson
9fc4db6b89 Merge branch 'master' into recursive-elseif
Conflicts:

	src/Makefile
	src/comp/front/ast.rs
	src/comp/front/parser.rs
	src/comp/middle/fold.rs
	src/comp/middle/trans.rs
2011-03-07 21:21:01 -05:00
Graydon Hoare
0d60918855 Most of the way through genericizing bind properly with new malloc path. Still getting the thunk call wrong. 2011-03-07 18:13:56 -08:00
Patrick Walton
3473ff3bff rustc: Cast dynamically-sized tags in iter_structural_ty_full() to opaque tag types. Un-XFAIL generic-recursive-tag.rs. 2011-03-07 18:03:33 -08:00
Patrick Walton
6ed226c6b3 rustc: Cast the LLVM representations of tag types when constructing boxes. Un-XFAIL list.rs. 2011-03-07 16:35:00 -08:00
Patrick Walton
6f7e21ddac rustc: Truncate or zero-extend indexes appropriately. Un-XFAIL integral-indexing.rs. 2011-03-07 15:44:42 -08:00
Graydon Hoare
df3038e68b Parse opacity (and drop on the floor), so std.rc parses now. 2011-03-07 15:38:20 -08:00
Graydon Hoare
abbcc0385d Poison ty_param values in trans; fix buggy parametric obj and box malloc paths. Add generic-box test. 2011-03-07 14:05:16 -08:00
Marijn Haverbeke
0624f9db4a Add a pretty-printer
Adds a -pp option to the compiler which will cause it to simply
pretty-print the given file.
2011-03-07 12:58:08 -08:00
Rafael Ávila de Espíndola
8047957b99 Construct the wrappers to native functions. Hello world now works :-) 2011-03-07 15:37:40 -05:00
Graydon Hoare
90f299e710 Permit view items in native modules. 2011-03-07 11:48:43 -08:00
Graydon Hoare
dfa85968c3 Stage the last compile fix to put out fire. Thanks git. 2011-03-07 10:33:04 -08:00
Graydon Hoare
44bceb84a7 Complain on unexpected native symbol, rather than failing with none-exhaustive match. 2011-03-07 10:02:01 -08:00
Marijn Haverbeke
1ce6cfbe7c use a precedence table for operator parsing 2011-03-07 15:32:11 +01:00
Graydon Hoare
60657fa8aa Set the cleanup on the post-growth vector, not the temporary one. 2011-03-07 00:13:56 -08:00
Graydon Hoare
2cbfb8795d Fix off-by-one in vector append code. 2011-03-06 23:06:01 -08:00
Graydon Hoare
386ba3ae63 Further work on vec-append. Almost working. 2011-03-06 22:37:14 -08:00
Brian Anderson
d39da6f978 Remove typestate workarounds 2011-03-06 15:13:35 -08:00
Brian Anderson
b893bec4bb Flatten conditionals in rustc.rs. Remove FIXME 2011-03-06 15:13:32 -08:00
Graydon Hoare
138c55a69d Fix return value on trans_vec_add. 2011-03-06 15:12:33 -08:00
Graydon Hoare
3eb20f3f6e Correct signatures and arguments associated with call into vec_append_glue. 2011-03-06 12:46:33 -08:00
Graydon Hoare
d97c800e31 Make ret and fail stmts have 0 out-edges, Closes #250. 2011-03-05 20:05:02 +00:00
Patrick Walton
94b681afe4 rustc: Use copy_ty() when initializing N-ary tag variants. Un-XFAIL generic-tag.rs. 2011-03-04 18:05:48 -08:00
Patrick Walton
1dc6bdf331 rustc: Don't recurse forever if type glue needs to refer to its own type descriptor 2011-03-04 17:22:43 -08:00
Patrick Walton
0aa74828e3 rustc: Remove "translating variants" debug string 2011-03-04 15:15:12 -08:00
Patrick Walton
76ec67063e rustc: Don't use recursive types for tags; remove tag_info; introduce GEP_tag() 2011-03-04 15:10:22 -08:00
Graydon Hoare
596face274 Parse (and generally ignore) constraints and constrained types. 2011-03-04 14:19:48 -08:00
Rafael Ávila de Espíndola
95c0cefd32 Build empty wrappers. This lets us compile hello world, but so far it
just returns 0.
2011-03-04 15:29:33 -05:00
Rafael Ávila de Espíndola
2ff67ed94e Remove unused argument. 2011-03-04 14:53:52 -05:00
Graydon Hoare
02dff96b52 Parse meta directives in crates. 2011-03-04 11:28:40 -08:00
Graydon Hoare
652cb48475 Assortment of additional work on vec-append. Not done yet. 2011-03-03 18:18:59 -08:00
Patrick Walton
629eba1d06 rustc: Make tag discriminants per-tag-ID, not per-tag-ID-and-subtypes 2011-03-03 18:15:17 -08:00
Graydon Hoare
b4a85c7b58 Factor out and generalize sequence pointer walking, for use in vec-grow. 2011-03-03 17:36:38 -08:00
Patrick Walton
04a0a6fbef Revert "rustc: Add support for folding over tag types" as it's unnecessary. Oops. 2011-03-03 17:09:20 -08:00
Patrick Walton
f6682280f3 rustc: Add support for folding over tag types 2011-03-03 16:54:15 -08:00
Patrick Walton
39b0563205 rustc: Remove dead code that used to generate tag constants from trans_constant() 2011-03-03 16:18:43 -08:00