Commit Graph

3373 Commits

Author SHA1 Message Date
Brian Anderson
6e6bc5076c rustc: Support both meta tags and attributes for crate metadata
This is a transitional patch for converting from 'meta' to attributes.

Issue #487
2011-06-17 15:07:34 -07:00
Brian Anderson
81a187e8be rustc: Remove metadata from the session.
This mechanism was not being used for anything. Issue #487.
2011-06-17 14:46:59 -07:00
Rafael Ávila de Espíndola
342dbd7abe Put std in stageN/lib. This avoids windows trying to load stageN/std.ll when
stageN/runstc.exe is run.
2011-06-17 15:34:59 -04:00
Patrick Walton
e43a3755dd rustc: Add a type_owns_heap_mem() predicate 2011-06-17 12:32:18 -07:00
Patrick Walton
dfb806b367 rustc: Cast to opaque interior vector types in trans_vec_append if necessary. Puts out burning tinderbox. 2011-06-17 12:23:04 -07:00
Patrick Walton
4918c99f69 rustc: Copy the contents of generic interior vectors 2011-06-17 12:22:53 -07:00
Patrick Walton
4bb7597542 Revert "rustc: Copy the contents of generic interior vectors"
This reverts commit 5bdbe1dfc2.
2011-06-17 12:03:21 -07:00
Patrick Walton
5bdbe1dfc2 rustc: Copy the contents of generic interior vectors 2011-06-17 11:45:51 -07:00
Brian Anderson
e8228e1260 rustc: Demand that if conditions have bool type
Closes #513
2011-06-17 11:35:00 -07:00
Brian Anderson
a4d88dacc9 rustc: Fail to unify if two ty_vars don't unify
Closes #500
2011-06-17 11:35:00 -07:00
Brian Anderson
2a69db5b76 test: Fix mismatched types in prep for typechecker fixes
Issue #500
2011-06-17 11:35:00 -07:00
Brian Anderson
753da64fd6 rustc: Demand unification of both sides of a binop
Issue #500
2011-06-17 11:35:00 -07:00
Rafael Ávila de Espíndola
1dbc0442cd Automatically add a -L to the directory the binary is in. 2011-06-17 13:36:08 -04:00
Patrick Walton
982f51aa95 stdlib: Fix reserve on zero-length interior vectors; uncomment test_unsafe_ptrs() 2011-06-16 18:01:57 -07:00
Paul Stansifer
391348ec86 Consistify ast::local. 2011-06-16 17:56:24 -07:00
Patrick Walton
d47101703e stdlib: Sketch out ivec::init_fn, currently segfaulting 2011-06-16 17:48:59 -07:00
Patrick Walton
ab7ebb608a rustc: Fix dominance issue when translating generic interior vectors 2011-06-16 17:48:32 -07:00
Brian Anderson
a68a5c9b5e Disable lib-ivec's test_unsafe_ptrs. Not working here 2011-06-16 17:34:39 -07:00
Brian Anderson
6f4326c54d Add better error messages for bad attributes in .rc files
Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
4b8fba5f34 rustc: Fix regressed handling of bad attributes
Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
ffa7c76ed2 rustc: Change print_file to print_crate
The pretty-printer needs access to the crate attributes in order to reproduce
inner crate attributes in standalone .rs files

Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
e83a115d79 rustc: Parse crate attributes in standalone .rs files
Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
ffae642663 rustc: Parse attributes in crate files
Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
62939e41b2 rustc: Parse inner items of file-level modules linked from crate files
Issue #487
2011-06-16 17:23:20 -07:00
Patrick Walton
40746fa447 rustc: Implement conversions from interior vector data to unsafe pointers and vice-versa 2011-06-16 17:07:02 -07:00
Patrick Walton
e50c918e6b rustc: Implement type walking and comparison glue for unsafe pointers 2011-06-16 17:07:02 -07:00
Graydon Hoare
b84fffaa4e Reformat a bunch of recent churn. 2011-06-16 16:55:46 -07:00
Graydon Hoare
eb9969f546 Add support for marking files no-reformat. 2011-06-16 16:42:29 -07:00
Patrick Walton
050f62983d stdlib: Introduce an ivec module into the standard library; add a minimal test case 2011-06-16 16:08:26 -07:00
Patrick Walton
94cd2985b2 rustc: Parse T[mutable?] 2011-06-16 15:17:06 -07:00
Patrick Walton
d90ad442b4 rustc: Work around leak when translating interior vectors. Un-XFAIL interior-vec.rs. 2011-06-16 15:07:21 -07:00
Patrick Walton
5b341443da test: Add an interior-vec test case, XFAIL'd for now because of leaks in the compiler 2011-06-16 14:30:10 -07:00
Patrick Walton
e7575b9f3a rustc: Add cases for istr and ivec to visit 2011-06-16 14:26:11 -07:00
Brian Anderson
99301ff830 test: Add a test for outer attributes on the first module in a file
Issue #487
2011-06-16 14:21:43 -07:00
Brian Anderson
b727d079ed rustc: Pretty print module inner attributes
Issue #487
2011-06-16 14:21:43 -07:00
Brian Anderson
43cbbabccb rustc: Correctly mark attributes as inner attributes
Issue #487
2011-06-16 14:21:43 -07:00
Brian Anderson
f3996d32b0 rustc: Parse inner attributes of modules
Issue #487
2011-06-16 14:21:42 -07:00
Brian Anderson
0efd7fac8a stdlib: Add option::is_some 2011-06-16 14:21:42 -07:00
Tim Chevalier
49a4867da6 Pretty-print if-check 2011-06-16 14:08:48 -07:00
Patrick Walton
4fc286e24e rustc: Parse interior vector types in which the base type is a path properly 2011-06-16 14:03:07 -07:00
Patrick Walton
9210afc8a5 rustc: Pretty print interior vector types 2011-06-16 14:03:07 -07:00
Eric Holk
6ed6791df4 Removing dead upcall_join. Closes #509. 2011-06-16 12:23:13 -07:00
Lindsey Kuper
a5563e173e Clean up whitespace oddities perpetrated by pretty-printer. 2011-06-16 12:21:49 -07:00
Lindsey Kuper
efc55b2a3d Simple anonymous objects compile with stage0. 2011-06-16 12:21:49 -07:00
Tim Chevalier
219924e669 Bring back if-check
Add "if check" (expr_if_check), a variation on check that executes
an "else" clause rather than failing if the check doesn't hold.
2011-06-16 12:13:20 -07:00
Tim Chevalier
94ae4590c5 if-check test case 2011-06-16 12:13:20 -07:00
Michael Sullivan
bd8f6097a7 Get rid of old vec_append glue. 2011-06-16 11:58:29 -07:00
Michael Sullivan
a9d62e5a90 Write some tests for swap. 2011-06-16 11:47:54 -07:00
Michael Sullivan
272c7e2e87 Translate the swap operator. 2011-06-16 11:47:54 -07:00
Michael Sullivan
bc33a5fe50 Fix bug in move on structure types. 2011-06-16 11:47:54 -07:00
Michael Sullivan
cfd1f74ebb Bring swap through typechecking and typestate. 2011-06-16 11:47:54 -07:00
Michael Sullivan
066599104a Parse swap. 2011-06-16 11:47:54 -07:00
Michael Sullivan
e8d2d27a88 Add "<->" to the token definition and the lexer. 2011-06-16 11:47:54 -07:00
Patrick Walton
02c0501a61 rt: memory_region::free(NULL) shouldn't touch the live allocation count 2011-06-16 11:16:03 -07:00
Patrick Walton
4673eb6839 rustc: Fix LLVM type error when generating cmp glue for interior vectors 2011-06-16 11:16:03 -07:00
Rafael Ávila de Espíndola
741e77174c Merge remote branch 'upstream/master' 2011-06-16 14:09:15 -04:00
Rafael Ávila de Espíndola
c51ac6730f Update the snapshots. 2011-06-16 13:49:57 -04:00
Patrick Walton
f9da8b2676 rt: Add an ivec length intrinsic and an ivec reserve function, both untested as of yet 2011-06-16 10:32:52 -07:00
Patrick Walton
66c52036da rustc: Change interior vector syntax to T[] 2011-06-16 10:13:39 -07:00
Marijn Haverbeke
15f71b3600 Refactor ast::item representation
Most of the fields in an AST item were present in all variants. Things
could be simplified considerably by putting them in the rec rather
than in the variant tags.
2011-06-16 13:32:35 +02:00
Brian Anderson
6c2f322f82 Improve and test failure behavior for malformed attributes 2011-06-15 19:30:10 -07:00
Eric Holk
67360ae618 Fixed a problem where spawn arguments were getting lost again. Also, fixed up stack alignment, which closes #496 2011-06-15 18:16:59 -07:00
Eric Holk
c4f9bd9470 Re-enabled join. 2011-06-15 18:16:59 -07:00
Patrick Walton
1fa9133b76 rustc: Implement interior vector concatenation 2011-06-15 18:03:25 -07:00
Eric Holk
260aa408f3 Merge branch 'master' of github.com:graydon/rust into fastcall 2011-06-15 17:45:24 -07:00
Eric Holk
405c164f02 Updating snapshots.txt. Closes #495. 2011-06-15 17:45:02 -07:00
Michael Sullivan
a91d301b31 Add xterm to the term lib's list of supported terms. 2011-06-15 17:33:37 -07:00
Brian Anderson
94d971c0e8 rustc: Remove unused variable from check_assignment 2011-06-15 16:48:59 -07:00
Brian Anderson
f50fd6d8ae stdlib: Add color support for GNU screen 2011-06-15 16:38:17 -07:00
Brian Anderson
c19a026f46 stdlib: Add emacs variables to term.rs 2011-06-15 16:28:14 -07:00
Eric Holk
02018fed42 Step 3 of cdecl conversion. 2011-06-15 16:04:39 -07:00
Brian Anderson
14c5900a70 test: Add a compile-fail test for attribute/syntax parsing
I don't currently know how to deal with syntax extensions that appear betweeen
an attribute and an item, so this test captures the error that occurs.

Issue #487
2011-06-15 16:01:39 -07:00
Brian Anderson
2772a29e92 rustc: Support outer attributes on items that are defined as statements
Issue #487
2011-06-15 16:01:35 -07:00
Eric Holk
89ba649c3a Updating snapshots.txt 2011-06-15 15:57:15 -07:00
Brian Anderson
b8a5440b2d stdlib: Add an either module
Like Haskell's, with left and right tags, various conversion functions
2011-06-15 15:45:41 -07:00
Brian Anderson
95bdedf12d test: Add missing fn test cases to run-pass/item-attributes.rs
Issue #487
2011-06-15 15:45:41 -07:00
Tim Chevalier
a5bca7df88 Refactor data structures representing constraints (again...)
I added a "resolved" version of the ast::constr type -- ty::constr_def
-- that has a def_id field instead of an ann_field. This is more
consistent with other types and eliminates some checking.

Incidentally, I removed the def_map argument to the top-level function
in middle::alias, since the ty::ctxt already has a def_map field.
2011-06-15 15:38:12 -07:00
Patrick Walton
52d4f48144 rustc: Move ivec stuff to an ivec module in trans 2011-06-15 14:43:00 -07:00
Eric Holk
92bd35075b Step 2 of cdecl task transition. 2011-06-15 14:25:53 -07:00
Eric Holk
6a3f4abc6f Updating snapshots.txt 2011-06-15 14:19:40 -07:00
Patrick Walton
6c8e94f397 rustc: Change the default interior vector length to 4 per science 2011-06-15 14:14:33 -07:00
Rafael Ávila de Espíndola
a77180f4f5 Add support for producing shared libraries directly in the rust driver. 2011-06-15 16:54:13 -04:00
Marijn Haverbeke
9b5ebe726c Implement checking of alias safety in tail calls. 2011-06-15 21:39:27 +02:00
Marijn Haverbeke
b2b8002fd3 Fix unsafe uses of aliases in tail calls 2011-06-15 21:39:27 +02:00
Marijn Haverbeke
0987b17dcb Small simplification in parser.rs' crate parsing 2011-06-15 21:39:26 +02:00
Lindsey Kuper
1ad69291bc Added issue # to FIXME. 2011-06-15 12:29:34 -07:00
Lindsey Kuper
fa5a7e7453 Simple anonymous objects get through translation. 2011-06-15 12:18:52 -07:00
Lindsey Kuper
59a254ae32 Just some typo fixes. 2011-06-15 12:18:52 -07:00
Eric Holk
01ea27b205 Step 1 of moving task startup to always be cdecl. 2011-06-15 12:10:15 -07:00
Graydon Hoare
766d54df93 Fix a bunch of compile-command lines to use RBUILD 2011-06-15 12:01:19 -07:00
Graydon Hoare
7e806c5e87 Attempt to put out windows tinderbox. 2011-06-15 11:39:31 -07:00
Graydon Hoare
ce72993488 Reformat source tree (minus a couple tests that are still grumpy). 2011-06-15 11:19:50 -07:00
Graydon Hoare
8d381823e2 Print mutability of obj fields. 2011-06-15 10:25:23 -07:00
Graydon Hoare
f03107b58c Fix pp bug on native modules. 2011-06-15 10:09:28 -07:00
Brian Anderson
df6ec4f8ea rustc: Pretty-print outer attributes of items
Issue #487
2011-06-15 09:48:59 -07:00
Brian Anderson
6c6d7c3916 test: Add tests for multiple outer attributes on items
Issue #487
2011-06-15 09:48:59 -07:00
Brian Anderson
1c9277e0d3 rustc: Make room in remaining AST item nodes for attributes
Issue #487
2011-06-15 09:48:55 -07:00
Brian Anderson
697fdaac24 test: Add test cases for outer attributes on all item types 2011-06-15 09:46:38 -07:00
Brian Anderson
11c5c73d56 rustc: Introduce an attribute type to the AST
Right now the only thing that it adds to meta_item is an indication of whether
the attribute was declared inside or outside the item, but I expect it will
become more useful.

Issue #487
2011-06-15 09:46:37 -07:00
Brian Anderson
0eefa5f9d3 rustc: Parse module attributes
Issue #487
2011-06-15 09:46:37 -07:00
Brian Anderson
31116dcdd5 rustc: Make room in item_mod for metadata
Issue #487
2011-06-15 09:46:37 -07:00
Brian Anderson
f42977d946 rustc: Modernize front::eval 2011-06-15 09:46:37 -07:00
Marijn Haverbeke
c7ab88cc35 Implement checking against assignments to immutable obj fields 2011-06-15 14:59:51 +02:00
Marijn Haverbeke
b0d46efd07 Stop dropping object field mutability on the floor 2011-06-15 14:20:04 +02:00
Marijn Haverbeke
0ddade3d7a Extend alias analysis to check assignments
This is a somewhat odd place to put these checks, but the data tracked
by that pass, and the available functions, make it trivial to do such
a check there.
2011-06-15 14:10:07 +02:00
Marijn Haverbeke
5fb518abc9 Fix assignments to immutable fields throughout the code 2011-06-15 14:10:07 +02:00
Marijn Haverbeke
180db08470 Refactor expr_root in alias.rs
It was too clunky and specific before. Now returns a vec of dereference specs
instead of a bunch of special-case information. Further accessors extract
the information they need from this vec.
2011-06-15 11:03:23 +02:00
Patrick Walton
ac743cfcb0 Merge pull request #490 from msullivan/fix_vec_append
Move the implementation of vec_append from llvm assembly to a regular upcall
2011-06-14 18:32:04 -07:00
Patrick Walton
c6be352f73 rustc: Implement on-heap resizing for interior vectors 2011-06-14 18:23:13 -07:00
Graydon Hoare
b7f043eeb7 Add new testcase to show the nature of our exciting block-expr / trailing unop interaction. 2011-06-14 17:07:48 -07:00
Rafael Ávila de Espíndola
ec9c4fdde7 Merge remote branch 'upstream/master' 2011-06-14 19:29:30 -04:00
Rafael Ávila de Espíndola
e6f87a7525 Use new snapshot. 2011-06-14 19:28:39 -04:00
Michael Sullivan
ccd1bcf7a7 Make tydesc glue functions use cdecl. 2011-06-14 16:09:21 -07:00
Michael Sullivan
5378f48a03 Remove vec_append_glue from the compiler. 2011-06-14 16:09:17 -07:00
Patrick Walton
14258b87a7 rustc: Free heapified interior vectors 2011-06-14 16:00:30 -07:00
Patrick Walton
bd18860be7 rustc: Fix LLVM type error that occurred when translating large unique vector literals 2011-06-14 16:00:02 -07:00
Michael Sullivan
95def699f1 Implement upcall_vec_append and use it for vector append. 2011-06-14 15:35:09 -07:00
Michael Sullivan
491d110645 Make type_desc fields have useful types and better names. Add in cmp_glue. 2011-06-14 15:35:08 -07:00
Tim Chevalier
36755e42df Remove some unnecessary xfails 2011-06-14 15:11:48 -07:00
Tim Chevalier
05b7eb6dff Make the typechecker check that dynamically sized arguments are passed by alias
Before, this would cause an assertion failure in trans.
2011-06-14 15:11:48 -07:00
Rafael Ávila de Espíndola
c3015b8952 Apply the makefile changes again, this time fixin the driver to not produce a
rustc.exe.exe.
2011-06-14 17:51:31 -04:00
Tim Chevalier
1cc7165e62 Un-xfail test/run-fail/pred.rs 2011-06-14 14:17:28 -07:00
Tim Chevalier
1513539b67 Improve error message for a failed assert or check 2011-06-14 14:17:28 -07:00
Patrick Walton
bf5840d530 rustc: Do a dynamic alloca for generic interior vectors; fix data pointer calculation when spilling vectors 2011-06-14 14:03:38 -07:00
Tim Chevalier
206429e075 Un-xfail working test cases 2011-06-14 13:58:10 -07:00
Marijn Haverbeke
df27699a57 Modernize some code in parser.rs
No more explicit type params or working around rustboot bugs
2011-06-14 22:09:00 +02:00
Marijn Haverbeke
f24408d89a Don't error when trans_lval is called on a non-lval
This allows directly calling a function expression, or the
result of an alt/if/block expression.
2011-06-14 21:38:56 +02:00
Tim Chevalier
6142c731a0 Un-xfail some tests that work 2011-06-14 12:27:23 -07:00
Tim Chevalier
7532681612 Add xfail-stage0 to some tests (not sure if it matters...) 2011-06-14 12:27:23 -07:00
Graydon Hoare
9ae843ab1c Print parens on unops when necessary. 'make reformat' output now builds to stage3. 2011-06-14 11:32:20 -07:00
Graydon Hoare
a1edf91f48 Fix bug in detecting trailing comments when at beginning-of-file. 2011-06-14 11:11:22 -07:00
Marijn Haverbeke
fa2b4d3a8d Remove a bunch of primitive-compiler-workarounds from pprust.rs 2011-06-14 18:23:27 +02:00
Marijn Haverbeke
471436a299 Implement function expressions/anonymous functions
Looks like 'fn(..arg..) -> ret {body;}. They don't support type
parameters or upvars yet.
2011-06-14 18:22:46 +02:00
Marijn Haverbeke
8c06d1bcb0 Remove 'peeking_at_item' from parser
parse_item now returns a value to indicate it didn't find an item
2011-06-14 14:53:01 +02:00
Patrick Walton
355c417267 rustc: Add some interior vector spill code, untested as of yet 2011-06-13 19:27:04 -07:00
Patrick Walton
c3bf7d07e9 rustc: Implement simple interior vector append translation 2011-06-13 18:57:25 -07:00
Tim Chevalier
a1bb4a4ded Refactor some typestate-related data structures 2011-06-13 18:21:22 -07:00
Eric Holk
d1857d30fc This is the mega-ucontext commit. It replaces the task switching mechanism with a new one inspired by ucontext. It works under Linux, OS X and Windows, and is Valgrind clean on Linux and OS X (provided the runtime is built with gcc).
This commit also moves yield and join to the standard library, as requested in #42. Join is currently a no-op though.
2011-06-13 18:14:13 -07:00
Brian Anderson
1595c9d767 rustc: Assignment expressions have nil type. Closes #483 2011-06-13 17:57:43 -07:00
Tim Chevalier
d65ad8c31c Change decl to local in expr_for and expr_for_each
Since the decl in a for or for-each loop must always be a local
decl, I changed the AST to express this. Fewer potential match
failures and "the impossible happened" error messages = yay!
2011-06-13 17:33:04 -07:00
Rafael Ávila de Espíndola
eb811a903f Enough driver support to link an empty program on linux. Will
try to update the Makefiles to use it.
2011-06-13 16:08:07 -04:00
Patrick Walton
913383d775 rustc: Preserve more type information for interior vectors at the LLVM level, allowing SROA to take place. log ~[ 2 ].(0) now optimizes to just log 2. 2011-06-12 00:44:43 -07:00
Patrick Walton
770bf24d72 rustc: Use in-bounds GEPs for fetching length and data of interior vectors 2011-06-11 23:32:21 -07:00
Patrick Walton
4375329031 rustc: Translate interior vector index expressions 2011-06-11 23:15:16 -07:00
Patrick Walton
8b318be4ce rustc: Typecheck vector index expressions for interior vectors 2011-06-11 19:52:49 -07:00
Patrick Walton
ac206068d9 rustc: Bump the default interior vector size up to 64 bytes 2011-06-11 19:42:48 -07:00
Patrick Walton
182b933ac4 rustc: Link with main.o 2011-06-11 19:31:47 -07:00
Patrick Walton
00eb3f5798 rustc: Sketch out translation of interior vector literals and take/drop glue 2011-06-10 19:36:33 -07:00
Tim Chevalier
b0a80104a3 Un-XFAIL pred-on-wrong-slots 2011-06-10 19:17:15 -07:00
Tim Chevalier
698c6406ba Reject programs with unsatisfied predicate constraints
Generate appropriate constraints for calls to functions with
preconditions, and reject calls where those constraints don't
hold true in the prestate.

...by which I mean that it works for one test case :-)
2011-06-10 19:17:15 -07:00
Graydon Hoare
a1bc2b17cc Make darwin happy. 2011-06-10 18:32:38 -07:00
Graydon Hoare
603ad1748b Fix printf flags. 2011-06-10 17:59:34 -07:00
Brian Anderson
10a4ecbd96 stdlib: Remove a FIXME for issue #452 2011-06-11 00:42:52 +00:00
Brian Anderson
2723e1c48f test: Add tests for issue #452 2011-06-11 00:42:52 +00:00
Graydon Hoare
c734c969fb Merge branch 'master' of github.com:graydon/rust 2011-06-10 17:36:23 -07:00
Graydon Hoare
1d1010cac0 Move rt:: logging namespace to ::rt:: and implement RUST_LOG=? and RUST_LOG=::help as synonyms that dump the crate logging map. Also warn when some logging specs don't match. 2011-06-10 17:31:48 -07:00
Lindsey Kuper
f6d7d75699 More work on typechecking anon objs. 2011-06-10 17:18:08 -07:00
Graydon Hoare
8876e2c29e Oops, fix logging string specs. Nobody likes writing RUST_LOG=_ZN5rustc5front7creaderE, do they? 2011-06-10 16:32:21 -07:00
Graydon Hoare
9671d21408 Implement meta tag matching in creader. Start using it in rustc.rc. Close #459. Close #457. 2011-06-10 15:54:41 -07:00
Tim Chevalier
774c6d0198 Friendlier error message for break outside a loop
The typechecker should really check for this, but at least now
there's an error message rather than an inexhaustive match failure
in trans.
2011-06-10 14:34:01 -07:00
Tim Chevalier
e5eacf8ea9 Use RHS type when translating assignments
In code like "auto foo = fail", a type gets inferred for foo
depending on how it's used. However, fail still has type _|_ and
still should be treated that way: particularly, its value shouldn't
be copied. Fixed trans to reflect that.
2011-06-10 14:05:06 -07:00
Patrick Walton
f1431adb40 rustc: Add a generic struct_elt() function to trans 2011-06-10 13:49:22 -07:00
Patrick Walton
451fc176d3 rustc: Derive flags for unsafe pointers. Puts out burning tinderbox. 2011-06-10 13:13:46 -07:00
Graydon Hoare
52c4c9014f Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives.
Now with extra "works on OSX" kludging.
2011-06-10 12:57:29 -07:00
Patrick Walton
4634f236a9 rustc: Add some missing cases to ty.rs for interior vectors, and modify the pattern match so this is less likely to happen again. Add the LLVM type mapping as well. 2011-06-10 12:07:38 -07:00
Patrick Walton
d8b271e3b1 test: Change bitwise.rs to use ! instead of ~. Should put out burning tinderbox. 2011-06-10 11:34:07 -07:00
Patrick Walton
cc3d484d9d rustc: Add missing cases for istr and ivec to equal_type_structures() 2011-06-10 11:00:56 -07:00
Lindsey Kuper
3ce82d2e70 Fix a non-exhaustive match failure. 2011-06-10 10:58:55 -07:00
Patrick Walton
7b7c746c1e Merge pull request #447 from paulstansifer/quick_error_message_fix
Error message, instead of segfault, when recursive types are used.
2011-06-10 10:53:42 -07:00
Patrick Walton
dfdd6dbc54 rustc: Remove the bitwise not operator 2011-06-10 10:47:33 -07:00
Lindsey Kuper
7a066ba547 Dead code elimination. 2011-06-10 10:23:48 -07:00
Marijn Haverbeke
1dbf3e8477 Minimal comment for visit.rs 2011-06-10 17:29:34 +02:00
Marijn Haverbeke
97576bd149 Move some uses of walk to visit in trans.rs 2011-06-10 17:24:20 +02:00
Marijn Haverbeke
e25e05539e Handle mutable references in alias analysis 2011-06-10 16:44:33 +02:00
Marijn Haverbeke
f28796ed99 Fix unsafe uses of mutable references 2011-06-10 16:44:32 +02:00
Marijn Haverbeke
fccf065266 Implement mutable/immutable alias distinction.
Before, all aliases were implicitly mutable, and writing
&mutable was the same as writing &. Now, the two are
distinguished, and assignments to regular aliases are
no longer allowed.
2011-06-10 12:15:58 +02:00
Marijn Haverbeke
798bbd2e22 Fix all occurrences of writing to immutable aliases
You'd be surprised.
2011-06-10 12:15:28 +02:00
Lindsey Kuper
c51c6ba354 Sketching trans_anon_obj. 2011-06-09 18:16:28 -07:00
Patrick Walton
40e3a9fcbc Revert "Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives." due to tree bustage
This reverts commit ab3635eebe.
2011-06-09 18:15:13 -07:00
Patrick Walton
60706f1e35 rustc: Write interior vecs and strings into the metadata and add logic for them in ty_to_str 2011-06-09 18:00:46 -07:00
Graydon Hoare
ab3635eebe Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives. 2011-06-09 17:24:32 -07:00
Patrick Walton
c9c1d860f1 rustc: Report type errors in terms of the actual types involved, not type variables 2011-06-09 17:23:15 -07:00
Patrick Walton
5318248f24 rustc: Annotate vector and string literals in the AST with their uniqueness or lack thereof 2011-06-09 17:11:21 -07:00
Patrick Walton
1c48102838 rustc: Add ty_istr and ty_ivec types 2011-06-09 16:23:19 -07:00
Patrick Walton
1408e1aa16 snap: Register new snapshots 2011-06-09 15:59:31 -07:00
Patrick Walton
54d34bec59 rustc: Parse istr and ivec 2011-06-09 15:05:08 -07:00
Tim Chevalier
1cc3fe567c Improve error message for wrong number of type arguments
Improve error message in the case where a use of a polymorphic tag has
insufficient type arguments given. Before, the typechecker was
just crashing with a bounds check error.
2011-06-09 14:50:49 -07:00
Patrick Walton
efcf8570f0 rustc: Remove comment dating back to the rustboot days from typeck 2011-06-09 14:19:04 -07:00
Patrick Walton
c7ca08d1b6 rustc: Remove all calls to resolve_all_vars and the function itself 2011-06-09 14:17:50 -07:00
Patrick Walton
06d706e197 rustc: Remove the call to resolve_all_vars when typechecking field exprs 2011-06-09 14:04:11 -07:00
Patrick Walton
3009574165 rustc: Unify with the root types 2011-06-09 14:04:11 -07:00
Erick Tryzelaar
501201a431 Remove executable bit from lock_and_signal.cpp. 2011-06-09 12:30:57 -07:00
Marijn Haverbeke
1146136fa8 Fix double import that now somehow gets caught by resolve 2011-06-09 20:48:06 +02:00
Marijn Haverbeke
4ab862a50d Switch resolve pass to use visit.rs rather than walk.rs 2011-06-09 20:44:04 +02:00
Marijn Haverbeke
d8516178e5 Pass ty params to visit::visit_fn 2011-06-09 20:44:04 +02:00
Tim Chevalier
d1819fb747 Improve an error message in resolve 2011-06-09 11:37:52 -07:00
Tim Chevalier
b34a97de39 Start to check expr_check and expr_call constraints in typestate
Start writing the cases for expr_check and expr_call to take
predicates into account, but this isn't working yet.
2011-06-09 11:37:52 -07:00
Tim Chevalier
17ff2a0d79 Further support for predicate constraints
Changed function types to include a list of constraints. Added
code for parsing and pretty-printing constraints. This necessitated
splitting pprust into two files (pprust and ppaux) to break a
circulate dependency, as ty_to_str now needs to print out constraints,
which may include literals, but pprust depended on ty.
2011-06-09 11:37:52 -07:00
Rafael Ávila de Espíndola
46920e073b Remove hack now that stage0 doesn't use it. 2011-06-09 14:26:10 -04:00
Patrick Walton
a4663d2845 rustc: Add fast paths for vars and param folds. 3x typechecking speedup. 2011-06-09 11:20:47 -07:00
Patrick Walton
73ae684536 rustc: Don't resolve all type variables eagerly for paths 2011-06-09 10:51:51 -07:00
Patrick Walton
80f86d1e9b stdlib: Make union-find not create loops when unifying two already-unified sets 2011-06-09 10:51:51 -07:00
Marijn Haverbeke
537d879dc1 Properly handle lifetime of aliases in nested blocks
There was a bug that would cause the alias analyser to allow you to
invalidate an alias that was no longer directly referred to, even if
another alias was rooted in it. It now properly tracks dependencies
between live aliases.

Required another case of copying values in map.rs.
2011-06-09 14:19:13 +02:00
Marijn Haverbeke
beda82ddf1 A revised, improved alias-checker
The old system tried to ensure that the location an alias pointed at
would retain its type. That turned out to not be strong enough in the
face of aliases to the inside of tags.

The new system instead proves that values pointed to by aliases are
not replaced (or invalidated in some other way) at all. It knows of
two sufficient conditions for this, and tries to prove at least of
them:

A) The alias is 'immutably rooted' in a local, and this local is not
   reassigned for the lifetime of the alias. Immutably rooted means
   the alias refers to the local itself, or to something reachable
   from the local through immutable dereferencing.

B) No value whose type might include the type of the 'inner mutable
   element' of the thing the alias refers to (for example, the box in
   rec(mutable x = @mutable int)) is from the outer scope is accessed
   for the lifetime of the alias. This means for functions, no other
   argument types may include the alias's inner mutable type. For alt,
   for each, and for, it means the body does not refer to any locals
   originating from outside their scope that include this type.

The lifetime of an alias in an alt, for each, or for body is defined
as the range from its definition to its last use, not to the point
where it goes out of scope. This makes working around these
restrictions somewhat less annoying. For example, you can assign to
your alt-ed value you don't refer to any bindings afterwards.
2011-06-09 13:11:29 +02:00
Marijn Haverbeke
43fbb07126 Add vec::member 2011-06-09 13:11:28 +02:00
Marijn Haverbeke
77c1b9650f Some more workarounds to please the alias checker
Some of the vec utilities now only work on immutable vecs, since they
would have to be rewritten to do a lot more copying to be alias-safe.

Some forced copying was added to map.rs, showing a weakness in the
alias checker (or maybe the alias system): when fn args are passed
into a function, calling them must assume all aliases that are not
immutably rooted (directly connected to a local or temporary without
any mutable edges) become invalid. This will be a drag on functional
programming in Rust.

Work around alias issues in the stdlib
2011-06-09 13:08:39 +02:00
Marijn Haverbeke
bd90c7a3cb Add new visitor framework 2011-06-09 13:08:38 +02:00
Patrick Walton
6feb1dfd76 rustc: Don't eagerly resolve type variables after unification 2011-06-08 18:42:34 -07:00
Patrick Walton
537d4ac65a rustc: Fix error pattern in compile-fail/arg-count-mismatch.rs 2011-06-08 18:42:34 -07:00
Patrick Walton
cc7a8b668f rustc: Make resolve_all_vars() check to see whether the type actually has vars before folding over it; also remove some debug code. 2x typechecking speedup. 2011-06-08 18:05:45 -07:00
Patrick Walton
7527084e62 rustc: Don't generate so many variables when typechecking functions; remove mo_either 2011-06-08 18:05:45 -07:00
Graydon Hoare
8691a1a1e5 Tidy up 'export meta' situation now that snapshot understands it. 2011-06-08 15:58:03 -07:00
Patrick Walton
99c72b98b5 rustc: Use cnames in ty_to_str again; debugging code crept in 2011-06-08 15:49:46 -07:00
Patrick Walton
cc06bd4aa5 rustc: Add some miscellaneous demands that pushdown had previously caught; put out burning tinderbox 2011-06-08 15:33:16 -07:00
Graydon Hoare
b02b50c695 Register new snapshots. 2011-06-08 14:58:58 -07:00
Patrick Walton
2f853ddb8d test: Add a test case for issue #362, "ret none". 2011-06-08 12:52:36 -07:00
Patrick Walton
4571172c03 rustc: Remove pushdown. 15 second improvement. 2011-06-08 12:24:05 -07:00
Graydon Hoare
f54f2799c3 Merge pull request #403 from espindola/newllvm
Update rust to build with newer llvm versions.
2011-06-08 11:41:01 -07:00
Rafael Ávila de Espíndola
698022d351 Update rust to build with newer llvm versions. 2011-06-08 14:08:24 -04:00
Patrick Walton
08dcb9306b rustc: Remove all traces of the unification cache 2011-06-08 10:52:12 -07:00
Rafael Ávila de Espíndola
d360c481e8 Don't force the fetch of main.o from main.a, we are not using main.a anymore. 2011-06-08 13:47:21 -04:00
Josh Matthews
2235fb73ef Add optional message to fail. 2011-06-08 04:02:55 -04:00
Patrick Walton
0857d22c04 rustc: Print out a real error message on unresolved types. Puts out burning tinderbox. 2011-06-07 23:03:41 -07:00
Patrick Walton
ddec6b5f47 rustc: Use a set-based approach to unification; remove ty_bound_param and ty_local.
Sorry, big perf regression; will fix soon.
2011-06-07 19:33:18 -07:00
Graydon Hoare
721c5bbee8 More work on proper linkage name-mangling. Almost right, aside from version numbers. 2011-06-07 18:08:17 -07:00
Rafael Ávila de Espíndola
7034a28241 Update the snapshot. 2011-06-07 20:40:31 -04:00
Lindsey Kuper
a4ca75e6af For consistency, use ctxt instead of ty_ctxt outside of unify. 2011-06-07 15:18:30 -07:00
Lindsey Kuper
ab69c4a98f Removing dead code and redundant fails; changing fails to sess.bug
calls (issue #444).
2011-06-07 14:12:34 -07:00
Rafael Ávila de Espíndola
b1d6f12a05 Don't put a copy of main (the C one) in each binary we produce. This is a step
in getting a driver that works on all linux systems.

Sorry for the linker hacks, I will remove them after snapshotting a new compiler.
2011-06-07 16:56:27 -04:00
Josh Matthews
df9cf0be9b Add multiline, whitespace-eating strings. 2011-06-07 11:21:10 +02:00
Graydon Hoare
319156c8d1 Begin tidying up name-mangling rules. 2011-06-06 15:48:47 -07:00
Rafael Ávila de Espíndola
ee54fa5c7d Implement enough support for pointer to get an identity function working. 2011-06-06 16:36:01 -04:00
Marijn Haverbeke
4bd5f834b0 First take on an alias-safety checker
The alias checker works by ensuring that any value to which an alias
is created is rooted in some way that ensures it outlives the alias.

It is now disallowed to create an alias to the content of a mutable
box, or to a box hanging off a mutable field. There is also machinery
in place to prevent assignment to local variables whenever they are
the root of a live alias.
2011-06-06 21:24:03 +02:00
Marijn Haverbeke
2b334f061a Change unsafe aliases
This litters aberrations like 'alt({foo.bar}) { ... }' and f({*baz})
though the code (mostly in trans.rs). These are a way to explicitly
copy the given value so that it can be safely aliased. At some point
we'll probably want a more explicit copy operator.
2011-06-06 21:09:55 +02:00
Brian Anderson
4d8f715dab rustc: Make resolve::unresolved return !. Remove redundant fails 2011-06-05 00:11:44 -04:00
Lindsey Kuper
2736d63db0 Adding comments; removing dead code. 2011-06-04 19:38:11 -07:00
Lindsey Kuper
5f95766a40 Remove redundant 'fail' exprs and dead code; use sess.bug or
sess.span_err instead of 'fail'.  (issue #444)
2011-06-04 18:34:40 -07:00
Brian Anderson
53ea2a4751 stdlib: Use spans for #fmt errors originating in std
Issue #444
2011-06-04 19:48:19 -04:00
Brian Anderson
a177dc485b rustc: Reenable debug logging in extfmt
This is not obnoxious now that logging is off by default
2011-06-04 17:57:53 -04:00
Brian Anderson
4b566fe7f9 rustc: Hide the parser from syntax extensions
Eventually extensions will probably need access to the parser again, but it'll
be in a different form.
2011-06-04 17:51:59 -04:00
Brian Anderson
c88fa92de4 rustc: Generate extension annotations from ext_ctxt instead of parser 2011-06-04 17:44:24 -04:00
Brian Anderson
1d6f1dc58d rustc: Add a next_ann method to ext_ctxt
After this we can remove the parser from the syntax extensions, at least for
now.
2011-06-04 17:31:44 -04:00
Brian Anderson
3ca5fff195 rustc: Use spans for #env errors
Issue #444
2011-06-04 17:14:32 -04:00
Brian Anderson
ac83e34dc6 rustc: Report unimplemented #fmt features with spans 2011-06-04 17:10:08 -04:00
Brian Anderson
dd588519bd rustc: Add a span_unimpl method to ext_ctxt 2011-06-04 17:10:08 -04:00
Brian Anderson
ecf1bd7651 rustc: Use spans on extfmt error messages
Issue #444
2011-06-04 17:10:04 -04:00
Brian Anderson
794221b353 rustc: Return the correct span from parse_seq 2011-06-04 16:36:08 -04:00
Brian Anderson
c18f2e2dac rustc: Pass the correct span to syntax extensions 2011-06-04 15:57:13 -04:00
Brian Anderson
af46f3ed0d rustc: Introduce ext module. Move some things from parser to ext.
Introduce an ext_ctxt record to provide a span_err method for use while
expanding syntax extensions. Hopefully it will be useful for other things.
2011-06-04 15:49:42 -04:00
Paul Stansifer
dbd066a02a "macro" -> "syntax extension" for now 2011-06-03 18:47:11 -07:00
Paul Stansifer
79fcd51b46 Make the macro system more modular. 2011-06-03 18:47:11 -07:00
Graydon Hoare
cfc75695a5 Register new snapshots. 2011-06-03 18:47:08 -07:00
Graydon Hoare
f29d04672b Remove zerobreak between foo and ( on a call expr. Never looks right. 2011-06-03 17:32:29 -07:00
Graydon Hoare
f34d19a242 Make pp more conservative about inserting trailing comments mid-list. 2011-06-03 17:32:29 -07:00
Lindsey Kuper
69325f815d More comments. 2011-06-03 17:16:28 -07:00
Lindsey Kuper
dcf7fbf833 Comments and cleanup. 2011-06-03 17:09:50 -07:00
Patrick Walton
cb4c969ba6 rustc: Add a "smallintmap" implementation 2011-06-03 16:15:14 -07:00
Graydon Hoare
088ab03fdb Add spans to fields, args, methods. Improve pp of same. 2011-06-03 15:42:42 -07:00
Graydon Hoare
8235e76a47 Tidy up printing of ty_fn. 2011-06-03 15:42:42 -07:00
Rafael Ávila de Espíndola
429e21414b Parse pointers in metadata. 2011-06-03 15:13:10 -04:00
Rafael Ávila de Espíndola
ba74c6cfdc Boilerplate for pointers. Sorry for missing this on the first patch. 2011-06-03 15:02:58 -04:00
Rafael Ávila de Espíndola
18b63865ce Accept *foo as a pointer to foo.
This is accepted everywhere, since just passing a pointer is safe.
2011-06-03 14:34:19 -04:00
Marijn Haverbeke
07667d29aa Temporarily xfail compile-fail/pattern-tyvar
So that the tinderboxes can go green again. Patrick, please look into
this at some point.
2011-06-03 10:23:13 +02:00
Lindsey Kuper
dc29dead2e Removing redundant "fail"s. 2011-06-02 18:15:29 -07:00
Patrick Walton
ad9afefa10 rustc: Typecheck patterns from the top down; remove pushdown_pat 2011-06-02 18:11:26 -07:00
Tim Chevalier
76bcbfd269 Un-XFAIL break-value
It passes thanks to the previous two commits.
2011-06-02 17:52:04 -07:00
Tim Chevalier
ba377c043d Handle _|_ values properly in trans
Generate an LLVMUndef value of the proper type for an argument of
type _|_. Otherwise we get an LLVM assertion failure.
2011-06-02 17:52:04 -07:00
Tim Chevalier
468786e36d Fix unification bug
Hello from SFO Terminal 3!

unify_fn_common had the expected and actual types reversed in one
place. This was causing the type of an occurence of a function f
with type fn(int) -> T to be set to fn(_|_) -> T at a call site like
f(fail); I think this was also making some of the type error messages
come out backwards, but I haven't checked.

Also: ty_bot does not contain pointers
2011-06-02 17:52:04 -07:00
Patrick Walton
c515ed13de Merge pull request #450 from paulstansifer/quick_error_message_fix_2
Flatten functions and objects in trans::simplify_type.
2011-06-02 17:43:11 -07:00
Paul Stansifer
20bd927c3f Flatten functions and objects in trans::simplify_type. 2011-06-02 17:40:12 -07:00
Graydon Hoare
cb61d7b38e Pretty-print literals exactly as we saw them in the source. 2011-06-02 17:18:49 -07:00
Lindsey Kuper
3a6b5576ac Refactor make_fp_cmp_glue and make_integral_cmp_glue into one. 2011-06-02 16:35:25 -07:00
Paul Stansifer
1377e9b341 Implement pcwalton's code review suggestions. 2011-06-02 15:12:17 -07:00
Paul Stansifer
5cd10d2fef Error message, instead of segfault, when recursive types are used. 2011-06-02 14:03:17 -07:00
Patrick Walton
12f86e6f2f rustc: Print node IDs for more types of nodes 2011-06-02 11:29:17 -07:00
Patrick Walton
7c6a0f189e rustc: Tiny style fix in pprust::rust_printer 2011-06-02 11:29:17 -07:00
Graydon Hoare
f919af0f8f Remove offending hyphen. 2011-06-02 10:34:19 -07:00
Marijn Haverbeke
fd5428a95e Re-xfail lib-io test. Seems to only work on Linux 2011-06-02 17:58:49 +02:00
Marijn Haverbeke
5144f790fe Fix and un-xfail vec-append test 2011-06-02 16:45:26 +02:00
Marijn Haverbeke
75ffe657db Un-xfail multi test 2011-06-02 16:21:14 +02:00
Marijn Haverbeke
8ac94d59e8 Un-xfail lib-io test 2011-06-02 16:19:30 +02:00
Marijn Haverbeke
830c58b651 Un-xfail obj-dtor-2 2011-06-02 16:12:20 +02:00
Patrick Walton
78374d11ce rustc: Add a new mode to the pretty printer that prints out node IDs, for debugging 2011-06-01 18:53:52 -07:00
Patrick Walton
eae3036179 rustc: Remove else-after-return in main 2011-06-01 18:38:00 -07:00
Patrick Walton
d43f60e5d4 rustc: Fold --pretty and --typed-pretty into a single option with an optional argument 2011-06-01 18:32:05 -07:00
Patrick Walton
8c3809afd0 stdlib: Add some functions to getopts to deal with optional arguments more easily 2011-06-01 18:32:05 -07:00
Tim Chevalier
24c9d7e5f8 Improve type error message for non-constructor in pattern 2011-06-01 18:15:12 -07:00
Tim Chevalier
1402cd101b Redo typestate-related data structures to support predicate constraints. No actual support yet, just infrastructure. 2011-06-01 18:14:48 -07:00
Tim Chevalier
af4554aadf Add a few more to_str functions 2011-06-01 17:47:59 -07:00
Tim Chevalier
ac4ef1741e Allow constraint args to be literals 2011-06-01 17:45:13 -07:00
Lindsey Kuper
528c6516f0 Use span_err instead of err. Fixes issue #444. 2011-06-01 17:22:23 -07:00
Patrick Walton
af9272f70e rustc: Remove rustboot workaround from walk::default_visitor() 2011-06-01 16:52:22 -07:00
Patrick Walton
8851ae0423 rustc: Allow walking over patterns 2011-06-01 16:47:24 -07:00
Graydon Hoare
6e058ff54e Register new snapshots. 2011-06-01 16:39:31 -07:00
Graydon Hoare
1f915ef7ce Permit breaking before fn args block. 2011-06-01 16:39:31 -07:00
Lindsey Kuper
dba9caeba9 Comments. 2011-06-01 16:39:52 -07:00
Graydon Hoare
1b67fbdfd3 More tweaks to comment preservation rules. 2011-06-01 15:29:38 -07:00
Graydon Hoare
198f6a247e Print iters as iters not fns. 2011-06-01 13:18:16 -07:00
Graydon Hoare
023bbc0449 Add a space after @mutable. 2011-06-01 13:12:12 -07:00
Graydon Hoare
19f85cc9c4 Print ty_bot properly. 2011-06-01 13:08:08 -07:00
Rafael Ávila de Espíndola
a6ca9c2922 Don't create an empty section. 2011-06-01 15:59:28 -04:00
Rafael Ávila de Espíndola
30efdeeca1 Visibility is an ELF concept and protected visibility is not very well implemented,
avoid using it for now.

Instead, mark pairs that are not needed elsewhere as internal.
2011-06-01 15:45:31 -04:00
Graydon Hoare
2ef2bda276 Move brace/if/for/while/do/alt/spawn exprs into bottom_expr rule. 2011-06-01 12:42:28 -07:00
Graydon Hoare
4eef7b613c Bug fixes to pprust. 2011-06-01 12:26:42 -07:00
Graydon Hoare
e5dc138dfa Buffer pending whitespace in printer so as not to introduce trailing whitespace lines. 2011-06-01 12:01:42 -07:00
Graydon Hoare
681f0c7a2b Support printing globs. 2011-06-01 11:39:20 -07:00
Graydon Hoare
ae16639dfa Slightly more aggressive about inserting whitespace. Getting frustrated with comments. 2011-06-01 11:39:20 -07:00
Lindsey Kuper
649a7bf38a Comments and cleanup. 2011-06-01 11:34:52 -07:00
Paul Stansifer
9f5dddf08c Now imports are not re-exported unless 'export' is explicitly used. 2011-05-31 18:43:26 -07:00
Graydon Hoare
0235e742f6 Give up on use of huge_word for comments. Still not formatting quite right, but closer. 2011-05-31 17:39:15 -07:00
Michael Sullivan
f4df2e4974 Fix pretty printer for move. 2011-05-31 17:39:14 -07:00
Michael Sullivan
78b0d33c35 More tests for <-. 2011-05-31 17:39:14 -07:00
Michael Sullivan
fd1029e6dd Support move as an initializer. 2011-05-31 17:39:14 -07:00
Michael Sullivan
68b4688875 Add some simple tests for move. 2011-05-31 17:39:14 -07:00
Michael Sullivan
c232964301 Implement move semantics. 2011-05-31 17:39:14 -07:00
Michael Sullivan
5e7bba3d23 Insert plumbing for move that behaves just like assign. 2011-05-31 17:39:14 -07:00
Eric Holk
43342e9a66 Updating snapshot 2011-05-31 17:40:17 -07:00
Eric Holk
84a56ed7cd Teach the compiler to understand yield and join, as well as using task as a type name. 2011-05-31 16:28:13 -07:00
Brian Anderson
9daa00bf83 rustc: Teach rustc to use block results as fn return values. Closes #372 2011-05-31 19:18:55 -04:00
Graydon Hoare
223c7dfb11 Fix comment-scanning logic in lexer. 2011-05-31 15:31:50 -07:00
Graydon Hoare
2de1a4bb1b Handle pretty-printing else-if properly. 2011-05-31 12:58:02 -07:00
Rafael Ávila de Espíndola
cc96eeafca Move rust_vec_append_glue to rt. 2011-05-31 14:32:08 -04:00
Graydon Hoare
b6971d94df Consolidate formatting functions a bit more. 2011-05-31 11:00:47 -07:00
Graydon Hoare
55e3cd41de Fix utility printers to flush eof in common.rs. 2011-05-31 11:00:47 -07:00
Graydon Hoare
1811513552 Fix long lines 2011-05-31 11:00:47 -07:00
Graydon Hoare
371c25683c Break methods in obj types. 2011-05-31 11:00:47 -07:00
Graydon Hoare
1676c67446 Tighten up comment rules a little more. 2011-05-31 11:00:47 -07:00
Graydon Hoare
cf57553679 Improve handling of trailing comments. 2011-05-31 11:00:47 -07:00
Graydon Hoare
b48cab962a Add span to field to catch per-field comments in rec exprs. 2011-05-31 11:00:47 -07:00
Graydon Hoare
d12ea39896 Improve comment handling in pp. 2011-05-31 11:00:47 -07:00
Graydon Hoare
30f8348473 Differentiate consistency of commasep boxes 2011-05-31 11:00:47 -07:00
Graydon Hoare
21313d623a new pretty printer 2011-05-31 11:00:47 -07:00
Rafael Ávila de Espíndola
697be84d61 Fix the bots. 2011-05-31 13:50:16 -04:00
Rafael Ávila de Espíndola
3dc6c3b737 Remove code that is now dead. 2011-05-31 13:38:10 -04:00
Rafael Ávila de Espíndola
ebe055c307 Merge remote-tracking branch 'upstream/master' 2011-05-31 13:19:15 -04:00
Tim Chevalier
18a1cce2bc change fn to pred in pred-on-wrong-slots (but it's still xfailed 2011-05-31 10:13:25 -07:00
Rafael Ávila de Espíndola
b0a5c09986 New snapshot. 2011-05-31 13:11:59 -04:00
Rafael Ávila de Espíndola
e66f9e46f6 Start finishing up the rust_start signature transition. 2011-05-31 11:17:17 -04:00
Marijn Haverbeke
7d68cbdff0 Have blocks return their result by writing to a reserved space
This makes it possible to pass the location of that space through to
nested blocks, resulting in less copying, taking, and dropping.

This makes the compiler slightly faster and 19k smaller.

A FIXME is to use 'move' semantics when returning the values from the
block -- don't bump the refcount and drop it again for the returning
block, but simply assign ownership to the receiver. To do this, we'll
need a way to (safely) scrub things from a block's cleanup list.
2011-05-31 14:29:16 +02:00
Brian Anderson
81fc2d8728 rustc: Remove unneeded type params from alt patterns 2011-05-31 01:23:53 -04:00
Brian Anderson
ed0eb8f45a stdlib: Remove unneeded type params from alt patterns 2011-05-31 01:23:53 -04:00
Brian Anderson
c1d97a41eb Register new snapshots 2011-05-31 01:23:05 -04:00
Brian Anderson
c7e3f88c93 rustc: Pushdown type params for tag patterns. Closes #363 2011-05-31 00:00:04 -04:00
Brian Anderson
973b93ee2a rt: Use new module syntax for logging rt pseudo-modules
Now use RUST_LOG=rt::mem instead of RUST_LOG=rt.mem
2011-05-30 17:17:51 -04:00
Tim Chevalier
18883fea3a In pre/postcondition computation, failing calls should set the postcondition
A non-returning call should have a postcondition in which all predicates
are true -- not just a poststate. Otherwise, alt expressions where
one or more branches terminate in a non-returning call and others
initialize a variable get rejected.

Includes a test case.
2011-05-27 20:43:51 -07:00
Tim Chevalier
95e1aa18c1 change comment 2011-05-27 20:43:51 -07:00
Tim Chevalier
9a24e4f780 Fix two typestate bugs
* Non-returning calls should set all predicates to be true, not
  just the "this function returns" predicate

* Fixed a bug in the expr_alt case in tstate.states that wasn't updating
  the changed flag properly, then fixed *another* bug that was updating
  it too enthusiastically, but was masked by the first bug.
2011-05-27 20:43:51 -07:00
Lindsey Kuper
dc9d5e1689 Lots of comments, and some more descriptive names. 2011-05-27 18:20:43 -07:00
Tim Chevalier
b6e0c5829f Check the declaration type in a for loop against the sequence type
Changed the typechecker to correctly typecheck the declared variable
type in a for or for-each loop against the vector element type (for
a for loop) or the iterator type (for a for-each loop). Added a
test case.
2011-05-27 17:42:09 -07:00
Tim Chevalier
0c5a55f275 add a function that returns the type of a local decl 2011-05-27 17:34:50 -07:00
Graydon Hoare
85a2b0bfb9 Re-XFAIL, not valgrind-clean. 2011-05-27 15:52:00 -07:00
Eric Holk
52795049e7 Generating names for wrappers, removed extra logging 2011-05-27 15:37:19 -07:00
Eric Holk
8cfc388d40 Switched calling conventions so that spawn with multiple arguments works. 2011-05-27 15:20:58 -07:00
Eric Holk
d49998f0ed Switching over to wrappers for spawning functions of multiple arguments. Doesn't quite work yet. 2011-05-27 15:20:58 -07:00
Eric Holk
842bf7cad1 Un-XFAILing spawn tests. 2011-05-27 15:20:58 -07:00
Eric Holk
da0e0b6f5e Removing excessively verbous logging. 2011-05-27 15:20:58 -07:00
Eric Holk
a88af906c5 Programs using spawn terminate 2011-05-27 15:20:58 -07:00
Eric Holk
dad426419c Working on 2 argument spawn. The arguments seem to be copied correctly once, but then they get lost. 2011-05-27 15:20:58 -07:00
Eric Holk
bb4c7a9c68 Arguments seem to be correctly passed to child processes now. 2011-05-27 15:20:58 -07:00
Eric Holk
21efd07bc1 New tasks run, but their arguments get lost and something ends up in an infinite loop when the task exits. 2011-05-27 15:20:58 -07:00
Lindsey Kuper
867e9fb030 Test case showing that issue 324 is resolved. 2011-05-27 12:45:01 -07:00
Tim Chevalier
0cbcf92749 Use annotations on blocks
Previously, block_ty returned the type of the terminating
expression of the block (or nil if said expression was absent).
I changed check_expr to write the type of that expression into
the annotation for the block itself, so now block_ty can use the
block's annotation.
2011-05-27 12:21:37 -07:00
Michael Sullivan
a7a42c24be Change the syntax for RECV from "var <- port" to "port |> var". 2011-05-27 12:01:20 -07:00
Michael Sullivan
2119e3b5b9 Fix missing bump in RECV lexer case. 2011-05-27 12:01:20 -07:00
Michael Sullivan
9c79200a7f Pretty print the new RECV token... 2011-05-27 12:01:20 -07:00
Michael Sullivan
ea16e582eb Remove parser support for recv as an initializer in preparation for changing the recv syntax. 2011-05-27 12:01:20 -07:00
Michael Sullivan
55b40e6894 Lex '|>' as the RECV token. 2011-05-27 12:01:20 -07:00
Tim Chevalier
147b088125 Test for use of break as an expression
The test was meant to verify that the typechecker correctly
allows a _|_ value (break, here) to be used in any context.
However, the compiler fails with an LLVM assertion failure.
I xfailed it, but wanted it to be on the record anyway.
2011-05-26 20:52:05 -07:00
Tim Chevalier
1a96e79fe0 Make _|_ unify with anything
The typechecker had a number of special cases for unifying types
with _|_ (as with checking if and alt). But, a value of type _|_
should be usable in any context, as such a value always diverges,
and will never be used by its immediate context. Changed unify
accordingly, removed special cases.
2011-05-26 20:50:25 -07:00
Paul Stansifer
af6b4821c1 Handle circularity in glob imports in a more elegant fashion. 2011-05-27 02:42:33 +00:00
Paul Stansifer
7fe3d821ac Add a map from def_id s to items in resolve::env.
Use it to provide better error messages in the event of
glob-importing the same name multiple times.
2011-05-27 02:42:33 +00:00
Paul Stansifer
54ca8565c9 Fix bugs: make sure glob imports show up in the right module,
and make sure that circular glob imports don't diverge.
2011-05-27 02:42:33 +00:00
Paul Stansifer
3375b8fba2 Add list function 'has'. 2011-05-27 02:42:33 +00:00
Paul Stansifer
40fe44d23e "import module::*;" now works. 2011-05-27 02:42:33 +00:00
Paul Stansifer
22953f52fa Added filter_map. 2011-05-27 02:42:33 +00:00
Paul Stansifer
e2bb98001e Part one of adding globbing to resolve.rs: build up glob links. (Part two will follow those links if non-glob resolution fails.) 2011-05-27 02:42:32 +00:00
Paul Stansifer
f11f846ead Parsing and folding changes for globbed imports. 2011-05-27 02:42:32 +00:00
Tim Chevalier
610c81af19 Fix typo 2011-05-26 19:13:56 -07:00
Tim Chevalier
83cdb47a7c Add a list append function, which I didn't end up using, but why not add it? 2011-05-26 19:13:56 -07:00
Graydon Hoare
fc31aa7f85 Fix testcase to be slightly less fussy about line number of error, as it just drifted. 2011-05-26 18:29:28 -07:00
Graydon Hoare
79c9e13073 More delicious dead code removal from runtime, upcalls. 2011-05-26 18:21:02 -07:00
Tim Chevalier
4f792f2dbb Track spans for each local variable in typestate
This lets us print better messages in situations with name
shadowing.
2011-05-26 18:14:32 -07:00
Tim Chevalier
250643c549 Remove unused imports 2011-05-26 18:01:48 -07:00
Tim Chevalier
97e0575e2e Add a span_str function in session 2011-05-26 18:00:54 -07:00
Tim Chevalier
79693fab1f Fix typo in error message 2011-05-26 18:00:54 -07:00
Graydon Hoare
9f95538462 Remove redisue of unused fields from 'ann'. 2011-05-26 17:26:59 -07:00
Graydon Hoare
2561b01211 Remove residual uses of fold, and fold itself. 2011-05-26 17:16:54 -07:00
Graydon Hoare
8e945dcd81 Remove native glues. All calls to C are direct now. 2011-05-26 16:45:01 -07:00
Rafael Ávila de Espíndola
89e5f6c883 New snapshot. 2011-05-26 18:47:21 -04:00
Graydon Hoare
9491dc3e61 Add early returns to rustc main on non-compiling paths. 2011-05-26 15:22:08 +00:00
Graydon Hoare
dc1b34288c Pretty print view items with :: rather than :. 2011-05-25 22:09:36 -07:00
Brian Anderson
29a801565a rustc: Fail better when the first argument to #fmt is not a string literal 2011-05-25 23:50:19 -04:00
Brian Anderson
c4e9d8fb91 rustc: Fail when #fmt is given too many arguments 2011-05-25 23:43:04 -04:00
Michael Sullivan
1b29892b5b Produce a useful error message in trans when attempting to log an unsupported type.
(Previously, an llvm assert was tripped.)
2011-05-25 18:54:33 -04:00
Eric Holk
d72d50473f Fixing typechecking for spawn. 2011-05-25 18:01:45 -04:00
Rafael Ávila de Espíndola
4c4a4aee91 Fix non linux bots. 2011-05-25 16:03:50 -04:00
Rafael Ávila de Espíndola
94129c4216 dead argument removal part one. 2011-05-25 15:33:57 -04:00
Rafael Ávila de Espíndola
db47cb5c13 Dead code. 2011-05-25 15:22:25 -04:00
Rafael Ávila de Espíndola
0e324cad0a Dead code. 2011-05-25 15:08:31 -04:00
Rafael Ávila de Espíndola
9a3624466b Dead code. 2011-05-25 14:12:09 -04:00
Rafael Ávila de Espíndola
2306fb19f2 dead code. 2011-05-25 13:25:00 -04:00
Rafael Ávila de Espíndola
23c1335cb3 Dead code. 2011-05-25 12:00:16 -04:00
Rafael Ávila de Espíndola
579b317ae8 Dead code. 2011-05-25 11:45:07 -04:00
Rafael Ávila de Espíndola
3eafea46a3 Dead code. 2011-05-25 11:36:34 -04:00
Brian Anderson
70106f35ce test: Fix run-fail testing and bring tests up to date
A typo in the Makefile was causing these to not run. Happily, a lot of these
tests pass, so un-xfailed.
2011-05-24 22:09:12 -04:00
Brian Anderson
763380a2cc test: xfail vector-no-ann-2 in stage0 2011-05-24 22:08:08 -04:00
Rafael Ávila de Espíndola
4364be3744 Dead code. 2011-05-24 20:36:27 -04:00
Brian Anderson
9a88ba2b81 rustc: Downcase typeck::demand and typeck::pushdown 2011-05-24 20:26:46 -04:00
Brian Anderson
6473b73174 rustc: Use demand functions instead of open-coded typecheck for spawn
Un-xfail spawn-non-nil-fn
2011-05-24 20:23:21 -04:00
Rafael Ávila de Espíndola
0c1ea141b4 Dead code. 2011-05-24 20:12:30 -04:00
Rafael Ávila de Espíndola
f9946c9748 Dead code. 2011-05-24 19:39:30 -04:00
Rafael Ávila de Espíndola
40a3923fca Dead code. 2011-05-24 19:29:46 -04:00
Rafael Ávila de Espíndola
395940f7e3 Dead code elimination. 2011-05-24 19:07:30 -04:00
Rafael Ávila de Espíndola
de2e84e5b0 Only one gc glue. 2011-05-24 18:52:31 -04:00
Kelly Wilson
31de8e15c0 Add quick_sort3 function based on 'QuicksortIsOptimal.pdf' (see comments in file). Cleanup the quick_sort function a little, as well. Add test file. 2011-05-24 18:38:41 -04:00
Rafael Ávila de Espíndola
ac836dd79c There is only one yield glue. 2011-05-24 18:29:08 -04:00
Rafael Ávila de Espíndola
b1292580b9 Remove dead code for unwind_glue. 2011-05-24 17:28:37 -04:00
Rafael Ávila de Espíndola
0fc91b6ecc There is only one activate function now. 2011-05-24 17:00:45 -04:00
Eric Holk
2e8afc7b47 Merge pull request #404 from lkuper/cleanup
Just removing some unnecessary imports.
2011-05-24 13:51:00 -07:00
Rafael Ávila de Espíndola
fe90159b86 "constant propagate" rust_new_exit_task_glue to its only use. 2011-05-24 15:51:22 -04:00
Marijn Haverbeke
fbc0e840e3 Stop showing a 'cyclic import' message for unresolved imports
This only happened for single-length import paths, because the import
was being looked up in its own scope.
2011-05-24 20:58:38 +02:00
Lindsey Kuper
f1d3b88f0a Just removing some unnecessary imports. 2011-05-24 11:22:40 -07:00
Tim Chevalier
bad05e20a3 Improve nonexistent-module error message
The error message for (for example) "import vec;" without "use std;"
was "cyclic import", which was misleading because there were no
cycles. I changed it to "cyclic import or nonexistent module",
which doesn't break existing tests.
2011-05-24 10:47:58 -07:00
Brian Anderson
029c1e71ff test: Remove compile-fail/export-boot.rs
This was a rustboot-specific test which is covered by other tests in rustc.
2011-05-23 23:13:18 -04:00
Brian Anderson
e5e2811bc6 test: Un-xfail some compile-fail tests
Changed a few error patterns to match rustc's errors where it seemed
reasonable.
2011-05-23 23:13:18 -04:00
Tim Chevalier
c22100ab2d Un-XFAIL vector-no-ann
and update it to reflect the new friendly error message
2011-05-23 19:46:27 -07:00
Tim Chevalier
c9a8bdee2f Improve error message for ambiguous polymorphic types
If a type still contains free type variables after typechecking (for
example, as with "auto foo = []", the result was an assertion failure
in typeck. Made it a human-readable error message instead.
2011-05-23 19:46:27 -07:00
Brian Anderson
776977b755 test: Un-xfail some working tests 2011-05-23 22:41:37 -04:00
Tim Chevalier
b620be9cd2 Typecheck @[] correctly
Previously, if you wrote
let @vec[int] foo = @[];

that would be a type error. That didn't seem right, so I changed
pushdown to unify the inner type in an unop application with the
argument type of the operator type.
2011-05-23 17:17:49 -07:00
Brian Anderson
2505a2312e rustc: Run the llvm verifier pass before optimization. Closes #376
The optimization passes were hiding some codegen errors so now we run the
verifier both before and after optimization.
2011-05-23 19:52:57 -04:00
Brian Anderson
8637c09cf9 stdlib: Make the bound vector an alias in std::deque
Workaround for issue #375
2011-05-23 19:45:51 -04:00
Marijn Haverbeke
edf95efae8 Un-xfail test/run-pass/mlist 2011-05-23 23:25:55 +02:00
Marijn Haverbeke
86d51ec24b Get test-pass/utf8.rs to run
This involved a small fix to the unicode-escape character lexing and
to the pretty-printer.
2011-05-23 23:25:55 +02:00
Marijn Haverbeke
dc2cdbf4a1 Un-xfail test/run-pass/use-import-export 2011-05-23 23:25:54 +02:00
Tim Chevalier
2a73c4ffab Add line breaks to typestate error messages 2011-05-23 13:32:29 -07:00
Brian Anderson
db7611c4c9 rustc: More cleanup of rustc.rs 2011-05-22 16:58:33 -04:00
Brian Anderson
1081d0aee9 rustc: Some refactoring of rustc.rs 2011-05-22 16:41:32 -04:00
Brian Anderson
837dff9226 stdlib: Export match type from std::getopts 2011-05-22 16:41:06 -04:00
Brian Anderson
65ec38c096 rustc: Cleanup formatting in rustc.rs 2011-05-22 16:07:30 -04:00
Brian Anderson
c1122a6707 stdlib: Use if/alt expressions in std::uint 2011-05-22 12:28:27 -04:00
Brian Anderson
1ecd6a82ab stdlib: Use if/alt expressions in std::str 2011-05-22 12:28:27 -04:00
Brian Anderson
10c904bc6a stdlib: Add regression tests for std::str 2011-05-22 12:28:27 -04:00
Brian Anderson
443e1e4557 stdlib: Use if/alt expressions in std::option 2011-05-22 12:28:27 -04:00
Brian Anderson
820ccf4a13 stdlib: Do tail calls in std::map. Remove FIXMEs 2011-05-22 12:28:20 -04:00
Brian Anderson
2d17d9101d stdlib: Use if/alt expressions in std::map 2011-05-22 12:28:20 -04:00
Brian Anderson
f6777db615 stdlib: Add regression tests for std::map 2011-05-22 12:28:20 -04:00
Brian Anderson
f1c1887cab stdlib: Remove unneeded fail statements from std::list. Remove FIXMEs 2011-05-22 12:28:14 -04:00
Brian Anderson
f6beec6c43 stdlib: Do tail calls in std::list. Remove FIXMEs 2011-05-22 12:28:08 -04:00
Brian Anderson
bac68e4af3 stdlib: Add regression tests for std::list 2011-05-22 02:10:10 -04:00
Brian Anderson
b4c9f782e4 stdlib: Add list::from_vec 2011-05-22 02:10:10 -04:00