Michael Sullivan
f8b0d3d7d2
Use GEPi a bunch.
2011-08-02 16:26:00 -07:00
Tim Chevalier
40c1b864c6
Use or-patterns in trans::trans_compare, eliminating a FIXME
2011-08-02 13:17:59 -07:00
Marijn Haverbeke
2d5b651f49
Assign collection element ty to loop local tvar when checking loops
...
This makes the type declarationg for the loop variable optional in
most cases.
Closes #790
2011-08-02 15:09:29 +02:00
Marijn Haverbeke
78a0d380cc
Do not try to save block result when the block is an iter body
...
Closes #791
2011-08-02 14:28:32 +02:00
Marijn Haverbeke
6c9b90d06a
Be a little more clever about picking columns to match on in trans_alt
...
This should result in slightly more efficient matching of 'complex'
patterns with multiple discriminants in them.
2011-08-02 12:57:27 +02:00
Marijn Haverbeke
f8fa574864
Copy locals created by destructuring on the content of a box
...
This is required so that assigning to these locals doesn't clobber
the content of the box.
(A possible optimization would be to only do this copying for
locals that actually are assigned to.)
2011-08-02 12:09:15 +02:00
Marijn Haverbeke
8d8ff16dfe
Improve handling of bottom type in alt arms
2011-08-02 10:24:06 +02:00
Tim Chevalier
5cf5f5024d
Handle bang functions correctly in typestate
...
The logic for how the "returns" constraint was handled was always
dodgy, for reasons explained in the comments I added to
auxiliary::fn_info in this commit. Fixed it by adding distinct
"returns" and "diverges" constraints for each function, which
are both handled positively (that is: for a ! function, the
"diverges" constraint must be true on every exit path; for
any other function, the "returns" constraint must be true
on every exit path).
Closes #779
2011-08-01 20:58:16 -07:00
Paul Stansifer
fcc32797de
Fix incorrect uses of str::buf()
2011-08-01 18:51:56 -07:00
Michael Sullivan
7a05f1db7c
Fix closures over dynamically-sized polymorphic values.
2011-08-01 15:19:55 -07:00
Michael Sullivan
601c299d52
Fix closures over known-size polymorphic values.
2011-08-01 15:18:44 -07:00
Michael Sullivan
a32f287c8a
Add a GEPi function that wraps GEP with integer arguments.
2011-08-01 15:18:44 -07:00
Marijn Haverbeke
92240eb25b
Add check for irrefutable patterns in destructuring locals
2011-08-01 17:52:43 +02:00
Marijn Haverbeke
985c32ef4c
Partially implement destructuring locals
...
You can now say
let {bcx, val} = some_result_returner();
Similar for loop variables. Assigning to such variables is not safe
yet. Function arguments also remain a TODO.
2011-08-01 17:51:37 +02:00
Tim Chevalier
2971cfb145
Remove unused imports
2011-07-31 00:06:25 -07:00
Tim Chevalier
28f7c6af24
Change bitvectors::relax_precond_block to use visit instead of walk
2011-07-31 00:06:25 -07:00
Graydon Hoare
bc4e9afe25
Fix bug in typechecker counting occurrences of typarams in instantiation rather than checking formals list.
2011-07-29 18:48:15 -07:00
Graydon Hoare
0c9b749d20
Enable kind checking on typarams, fix kind constraints in library and comp.
2011-07-29 18:48:15 -07:00
Michael Sullivan
a34f7c8cb3
Switch the heap build and load environment functions to use GEP_tup_like.
2011-07-29 18:22:41 -07:00
Michael Sullivan
56f0fbeafc
Initial trans of lambdas. Doesn't work with polymorphism yet.
2011-07-29 18:22:41 -07:00
Tim Chevalier
126cd44c38
Refactor typestate code involving stmt_decls
...
To handle multiple-LHS declarations with initializers properly,
I changed seq_states to take a list of expressions paired with optional
names, not just a list of expressions. Then, the same logic that handles
ordered lists of subexpressions everywhere else can handle multi-
declarations.
2011-07-29 18:00:10 -07:00
Graydon Hoare
59c441a66a
Encode, decode, and thread through typechecking all the param kinds, not just the counts.
2011-07-29 16:40:30 -07:00
Michael Sullivan
a684f6078f
Do some cleanup in load_environment.
2011-07-29 15:29:38 -07:00
Michael Sullivan
6a4d0ce829
Add in some missing cases for typestate with closures.
2011-07-29 15:29:38 -07:00
Lindsey Kuper
7efbad674a
Don't confuse backwards and forwards.
...
Oops. If we already have a backwarding vtable, that means that we are
currently building a forwarding fn. (Progress toward issue #702.)
2011-07-29 15:21:40 -07:00
Lindsey Kuper
6423cc7b52
Comments and cleanup, in preparation for more work on issue #702 .
2011-07-29 15:21:40 -07:00
Lindsey Kuper
f4eacbb3b4
Get rid of an obsolete comment now that obj dtors are gone.
2011-07-29 15:21:40 -07:00
Lindsey Kuper
3595f1f966
Disallow overloading a method with one of different type. Closes #703 .
2011-07-29 13:44:34 -07:00
Graydon Hoare
f3c05b9fae
Turn on kind propagation for typarams. Annotate a bunch of typarams in rustc and libstd.
2011-07-29 12:58:52 -07:00
Marijn Haverbeke
c34d74315f
Remove unreachable statements
2011-07-29 20:54:44 +02:00
Marijn Haverbeke
aa3b89610e
Track failures in typeck, assign proper type to failing blocks
...
(and warn for unreachable statements)
Closes #727
2011-07-29 20:54:44 +02:00
Lindsey Kuper
9705f97ead
Typechecking bugfix for anon objs. Removes duplicate methods in outer
...
object types.
2011-07-29 10:33:00 -07:00
Lindsey Kuper
a6151aa9a8
Formatting tweaks.
2011-07-29 10:33:00 -07:00
Marijn Haverbeke
451ec03c2d
Clean up old FIXME regarding or-patterns
2011-07-29 14:03:52 +02:00
Marijn Haverbeke
b1d2a00b4a
Remove support for obj dtors
2011-07-29 14:03:24 +02:00
Marijn Haverbeke
30d2e358be
Replace obj dtors with resources in stdlib and rustc
2011-07-29 14:03:24 +02:00
Marijn Haverbeke
ae46c154f0
Make sure resources always have their drop glue called
...
Even when their content does not contain pointers
2011-07-29 12:53:58 +02:00
Marijn Haverbeke
4c09d4a770
Missed another instance of walk in typeck
2011-07-29 12:18:26 +02:00
Marijn Haverbeke
5adf87a2c6
Fix iter_structural_ty_full for resource types
...
The compiler would blow up when compiling a structural type
containing a resource.
2011-07-29 11:44:29 +02:00
Michael Sullivan
2c0f4d51f9
Change the way freevars stores its information again.
2011-07-28 18:40:17 -07:00
Michael Sullivan
5068ae4771
Factor out a bunch of environment construction code from trans_bind.
2011-07-28 18:40:17 -07:00
Brian Anderson
3896524750
Drop the previous reference when receiving. Closes #763
2011-07-28 18:22:15 -07:00
Michael Sullivan
d0cb62ac90
Factor out box initializing code into trans_malloc_boxed.
2011-07-28 15:49:06 -07:00
Lindsey Kuper
0ea5a8a6ed
Updated alt indenting.
2011-07-28 15:01:12 -07:00
Lindsey Kuper
b24da1c2e5
The names 'outer' and 'inner' make more sense than 'self' and 'with'.
...
(Also, some formatting and long-string cleanup.)
2011-07-28 14:54:32 -07:00
Graydon Hoare
3e63fdc4c9
Thread kinds into the type system. Don't quite activate yet, since it breaks stdlib and snapshot isn't ready to compile modified stdlib.
2011-07-28 13:29:39 -07:00
Eric Holk
a5fe66e706
Adding upcalls to to ref() and deref() tasks. This is the first step towards atomic reference counting of tasks.
2011-07-28 10:47:28 -07:00
Graydon Hoare
acac6abc85
Parse, store and print type parameter kind constraints.
2011-07-28 17:22:59 +00:00
Graydon Hoare
2749ef5ede
Fix stale 'copy' occurrences to 'move' in comments.
2011-07-27 23:43:17 -07:00
Marijn Haverbeke
c141718952
Replace walk with visit in the typechecker
2011-07-28 08:05:04 +02:00
Marijn Haverbeke
757b7ec534
Remove walk instance from kind.rs
2011-07-28 07:42:51 +02:00
Graydon Hoare
a11bb404a5
Further refinement to kind system lattice and type-kind rules; first successful caught kind error (prohibits copying a pinned resource, though trans already caught it later).
2011-07-27 21:23:54 -07:00
Lindsey Kuper
7073ee4e31
Some work on backwarding for issue #702 .
2011-07-27 19:43:21 -07:00
Michael Sullivan
d1298f768c
Have bind support non-alias parametric non-bound arguments.
...
This was previously disallowed by the typechecker and not properly handled
in trans. I removed the typechecker check (replacing it with a simpler
check that spawned functions don't have type params) and fixed trans.
Closes #756 .
2011-07-27 18:46:46 -07:00
Michael Sullivan
4de0b3d947
Allow already bound functions to be bound again.
...
This commit just disables the check. All of the real work was in previous
commits that moved the target function into the bindings part of the closure
that is tracked by the tydesc.
Closes #754 .
2011-07-27 18:46:46 -07:00
Michael Sullivan
63fa765e0e
Fix binding a bare fn argument with type parameters.
...
Closes #642 .
2011-07-27 18:46:46 -07:00
Graydon Hoare
63f74f3771
Remove vestiges of "layers", insert skeletal do-nothing "kind" pass plus cached calculation of kind for each type.
2011-07-27 17:49:00 -07:00
Michael Sullivan
55a65a51aa
Eliminate "target" field in closures.
2011-07-27 15:22:11 -07:00
Michael Sullivan
b977b5c508
Put the bound function in bind in the bindings, not in a distinguished spot.
2011-07-27 15:22:11 -07:00
Michael Sullivan
db19231596
Mess around with the casting in trans_bind.
2011-07-27 14:43:35 -07:00
Michael Sullivan
e3f9648096
Some cleanup in trans.
2011-07-27 14:41:08 -07:00
Michael Sullivan
1c612ebdcc
Associate names with taskptr and tydesc types for better debugging.
2011-07-27 14:30:16 -07:00
Michael Sullivan
ab8d91dcfd
Make trand_bind_1 use create_real_fn_pair.
2011-07-27 14:28:07 -07:00
Marijn Haverbeke
f379c97913
Don't allow globals or immutable locals to be passed by mut alias
...
Closes #747
2011-07-27 17:19:46 +02:00
Marijn Haverbeke
6e2a7bff7f
Fix damage done by the pretty-printer
2011-07-27 15:54:33 +02:00
Marijn Haverbeke
df7f21db09
Reformat for new syntax
2011-07-27 15:54:33 +02:00
Marijn Haverbeke
95b926f675
Add missing case for view_item_use in resolve.rs
...
Closes #748
2011-07-27 10:01:21 +02:00
Lindsey Kuper
e1769ab76f
Clean up long strings and indentation.
2011-07-26 15:53:00 -07:00
Michael Sullivan
a17735cfb5
Some simple cleanup of trans_bind.
2011-07-26 14:47:44 -07:00
Michael Sullivan
be0629d880
Convert a bunch of cx.fcx.lcx... paths into bcx_...(cx)
2011-07-26 13:02:26 -07:00
Michael Sullivan
9ca0ce91bf
Initial implementation of typestate for closures.
...
There are still things not handled properly: relying on other preconditions
of upvars is likely to cause bad things to happen. We probably want to
disallow it.
2011-07-26 12:30:14 -07:00
Michael Sullivan
166d4f5fe9
Translate anonymous block closures.
2011-07-26 12:30:14 -07:00
Michael Sullivan
ac948b4ccd
Resolve and typecheck alias-environment-capturing blocks.
2011-07-26 12:30:14 -07:00
Michael Sullivan
eaab0db4ea
Fix the freevars pass to actually work on top of visit.
2011-07-26 12:30:14 -07:00
Marijn Haverbeke
e133f929b7
Convert all code that uses walk.rs in the straightforward way to simple_visit
...
Code that needs the keep_going functionality is still using walk. I will
add an equivalent to visit.rs later.
2011-07-26 17:13:48 +02:00
Marijn Haverbeke
2509a3dcae
Resolve loop collection expressions in the right scope
...
Closes #745
2011-07-26 15:52:59 +02:00
Marijn Haverbeke
bfaa85b735
Detect duplicate field names in record literals and types
...
Closes #746
2011-07-26 15:32:16 +02:00
Marijn Haverbeke
2c1250780d
Remove tuple support from the compiler
2011-07-26 15:19:56 +02:00
Marijn Haverbeke
aea537779e
Remove all uses of tuples from the compiler and stdlib
2011-07-26 14:06:02 +02:00
Michael Sullivan
25a89e068d
Rename the block type to be blk also. Sorry.
2011-07-25 14:18:07 -07:00
Michael Sullivan
6bcdb48e35
Disallow block as a variable name in preparation for it becoming a keyword.
2011-07-25 13:42:38 -07:00
Marijn Haverbeke
e949aab10a
Remove some rustboot-isms
...
Closes #464
2011-07-25 15:07:48 +02:00
Marijn Haverbeke
48013db5c5
Tie up the ends needed to get external consts working
...
Closes #658
2011-07-25 14:58:59 +02:00
Marijn Haverbeke
beab6ba8aa
Add a pass that checks for unreachable alt arms
2011-07-25 13:52:59 +02:00
Michael Sullivan
0cacbe901d
Overhaul how we handle freevars.
2011-07-22 17:46:52 -07:00
Michael Sullivan
2bf50114eb
Simple cleanup of the freevars pass.
2011-07-22 17:46:52 -07:00
Michael Sullivan
f2f8943a85
Add a "fake" def_upvar and mechanisms to create it.
2011-07-22 17:46:52 -07:00
Eric Holk
54be5b044f
Fixing (or at least improving) translation of move semantics for send and receive. This let's us run all of the task-comm tests.
2011-07-22 16:05:51 -07:00
Eric Holk
838511e3aa
Folding recv_val into trans_recv, since this is its only use.
2011-07-22 16:05:51 -07:00
Marijn Haverbeke
5cdb010fae
Remove typechecker work-arounds now that I know how
2011-07-22 20:15:46 +02:00
Marijn Haverbeke
b9b674abe7
Start adding support for multiple variable declarations per stmt
...
This adds parser support and most of the machinery for
auto x = 10, y = 20;
However, the above still goes wrong somewhere in typestate, causing
the state checker to believe only the last variable in the list is
initialized after the statement.
Tim, if you have a moment, could you go over the changes to the tstate
code in this patch and see where I'm going wrong?
Multi-var-decls without the typestate extension
Add a loop
2011-07-22 17:51:26 +02:00
Marijn Haverbeke
b45d973552
Rewrite trans_cast, float->float and float->int casts
2011-07-22 13:10:59 +02:00
Marijn Haverbeke
5864d4e13a
Report unresolved names only once per function
...
Closes #708
2011-07-22 11:38:30 +02:00
Marijn Haverbeke
93ffed4c16
Fix unboxing in alias pass
...
The alias checker would only deref once for autoderef, and only deref
boxes. It should now do the right thing. Closes #725 .
2011-07-22 09:29:01 +02:00
Lindsey Kuper
5566e0c3f1
Removing unnecessary argument from process_fwding_mthd().
2011-07-21 18:41:30 -07:00
Michael Sullivan
a0a2cee896
Clean up build_environment by having it return a rec with usefully named fields.
2011-07-21 18:19:07 -07:00
Michael Sullivan
4170390cb6
Add some useful functions to freevars.
2011-07-21 18:18:59 -07:00
Michael Sullivan
4b59ae0aa9
Add some support for using a map like a set.
2011-07-21 18:14:39 -07:00
Michael Sullivan
3b2d23b2cd
Move a bunch of trans into trans_common, including the context structures.
...
Probably more should be moved or split off into other files. My algorithm
was something along the lines of: move the contexts and their transitive
dependencies along with some functions to work with them. I stopped when
I was going to have to start pulling glue generation, which really
should go into a trans_glue file.
2011-07-21 17:39:06 -07:00
Michael Sullivan
f8bb5a3b58
Make ty::ctxt be boxed.
...
Arguably we should leave ty_ctxt as a bare rec and just always work with
boxes of it. This winds up being simpler and prettier, though.
2011-07-21 17:39:06 -07:00