Commit graph

3024 commits

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