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
Tim Chevalier
a9a1392b2c
Instantiate function preconditions inside the function body
...
so that if we have a function like:
f(...) : p(x) {
...
}
p(x) is true inside the body of f.
Closes #694 .
2011-07-21 16:11:34 -07:00
Tim Chevalier
2261ddc717
Move ast_constr_to_constr from typeck to ty
...
so that it can be used in places that import ty.
2011-07-21 16:09:55 -07:00
Lindsey Kuper
075a094c1f
Now with more type inference.
2011-07-21 15:46:03 -07:00
Lindsey Kuper
879b6392d9
Comments and cleanup.
2011-07-21 15:12:27 -07:00
Lindsey Kuper
8ebd292253
Consolidate obj_field_from_anon_obj_field().
2011-07-21 15:12:27 -07:00
Lindsey Kuper
55acc737a8
Remove vestiges of typarams from anon objs.
2011-07-21 15:12:27 -07:00
Eric Holk
d79afd7916
Improving move semantics for channel operations.
...
This lets us un-XFAIL task-comm-10.rs.
2011-07-21 11:51:22 -07:00
Eric Holk
3ae4dcd41e
Lots of work on memory tracking and channels.
...
We're trying to get closer to doing correct move semantics for channel
operations. This involves a lot of cleanup (such as removing the
unused sched parameter from rust_vec constructor) and making
circular_buffer kernel_owned.
Added tagging for memory allocations. This means we give a string tag
to everything we allocate. If we leak something and TRACK_ALLOCATIONS
is enabled, then it's much easier now to tell exactly what is leaking.
2011-07-21 11:51:22 -07:00
Patrick Walton
a44fb04d57
Revert "rustc: Avoid SHA-1 hashing every type, since they're interned"
...
This reverts commit df90f57a5f
.
2011-07-21 11:44:12 -07:00
Patrick Walton
b49bdad499
rustc: Box raw types. Shaves about 5 seconds off compilation.
2011-07-21 11:43:52 -07:00
Patrick Walton
df90f57a5f
rustc: Avoid SHA-1 hashing every type, since they're interned
2011-07-21 11:24:20 -07:00
Patrick Walton
355f77ef87
rustc: Remove cnames for now
2011-07-20 19:13:55 -07:00
Patrick Walton
3ec3b02ed0
rustc: Strip cnames before generating glue to avoid duplicates
2011-07-20 19:04:45 -07:00
Patrick Walton
142ff3bb4e
rustc: Translate functions only once
2011-07-20 18:43:05 -07:00
Michael Sullivan
1b9dbcc5b4
Box the vec of freevars we store in the freevars cache.
2011-07-20 18:15:56 -07:00
Lindsey Kuper
00f54b4a42
Refactoring and cleaning up.
2011-07-20 12:22:55 -07:00
Rafael Ávila de Espíndola
94c91382cd
Fix typo.
2011-07-20 15:14:13 -04:00
Rafael Ávila de Espíndola
b7a7120804
give rust_metadata internal linkage but mark it as used. This allows
...
multiple static crates to be used.
2011-07-20 14:55:01 -04:00
Tim Chevalier
41212792c6
Add missing case in tyencode for ty_constr
...
Fixes the Windoze breakage, I hope.
2011-07-19 20:16:03 -07:00
Lindsey Kuper
2eb4762936
Typechecking self-calls in anon objs. Closes #540 .
2011-07-19 19:52:21 -07:00
Lindsey Kuper
64fb39cdd3
Clean up formatting.
2011-07-19 19:52:21 -07:00
Tim Chevalier
bd4aeef78b
Beginnings of support for constrained types
...
Programs with constrained types now parse and typecheck, but
typestate doesn't check them specially, so the one relevant test
case so far is XFAILed.
Also rewrote all of the constraint-related data structures in the
process (again), for some reason. I got rid of a superfluous
data structure in the context that was mapping front-end constraints
to resolved constraints, instead handling constraints in the same
way in which everything else gets resolved.
2011-07-19 18:57:28 -07:00
Lindsey Kuper
19a17b3d1d
Style and indentation cleanups.
2011-07-19 16:08:49 -07:00
Lindsey Kuper
18162d3261
Some progress on issue #540 .
2011-07-19 14:30:53 -07:00
Lindsey Kuper
a0c6d0a27f
Comments and cleanup.
2011-07-19 12:33:45 -07:00
Lindsey Kuper
61ee22dc84
Wrapping long strings.
2011-07-19 12:33:45 -07:00
Michael Sullivan
f8c6d282f8
Add a pass that finds all of the free variables.
2011-07-19 12:01:14 -07:00
Michael Sullivan
c4bcd0a44d
Move collect_upvars into its own file.
2011-07-19 12:01:13 -07:00
Patrick Walton
2e6197aa95
rustc: Report how much time was spent to translate each function when --stats is on
2011-07-19 11:57:15 -07:00
Marijn Haverbeke
a0ab57b3f6
Fix trans_alt to handle unreachable branches without blowing up
2011-07-19 17:07:51 +02:00
Patrick Walton
ce3d6339e0
rustc: Translate locals in DPS style
2011-07-18 18:28:36 -07:00
Patrick Walton
242ec22032
rustc: Remove obsolete TODO
2011-07-18 18:02:11 -07:00
Patrick Walton
07a68df3b7
rustc: Skip null when translating string concatenation
2011-07-18 18:00:45 -07:00
Patrick Walton
08eabde97b
rustc: First stab at implementing interior vector concat in the DPS engine
2011-07-18 17:43:24 -07:00
Lindsey Kuper
7d4903544e
Don't use 'obj_info' as an identifier for things not of type obj_info.
2011-07-18 17:05:41 -07:00
Lindsey Kuper
b6fc86ae5a
Sane error message for self-call in non-obj context. Closes #707 .
2011-07-18 15:58:36 -07:00
Brian Anderson
c40d6265ce
Support x86 stdcall convention
...
This allows rust to call the Win32 API
2011-07-18 13:56:15 -07:00
Patrick Walton
682875929e
rustc: Stub binary operator translation
2011-07-18 00:24:21 -07:00
Patrick Walton
437b776100
rustc: Simplify the destination format in the DPS backend; optimize aliases to interior strings to require no allocation at all
2011-07-17 22:30:13 -07:00
Patrick Walton
22db8b1d53
rustc: Use memmove instructions more aggressively in DPS mode. LLVM converts these to optimized block transfer instructions, significantly reducing code size.
2011-07-17 14:02:39 -07:00
Patrick Walton
652da4ca55
rustc: Implement immediates in the DPS engine; it should now always be at least as efficient as the original engine (and typically much more).
2011-07-16 10:54:12 -07:00
Patrick Walton
88574c3cea
rustc: Implement interior string logging in DPS
2011-07-15 18:37:57 -07:00
Patrick Walton
f6f7f61908
rustc: Implement logging in DPS
2011-07-15 18:00:59 -07:00
Patrick Walton
0bd7b803f6
rustc: Translate literals in DPS style; no constification of strings yet.
2011-07-15 16:40:55 -07:00
Patrick Walton
6e114a367f
rustc: Write names of local variables into the LLVM IR when debug mode is on
2011-07-15 16:40:55 -07:00
Michael Sullivan
c610d027d9
gather_locals shouldn't descend down into fns and items.
2011-07-15 14:42:59 -05:00
Michael Sullivan
7caf8a0929
Convert gather_locals to use visit.
2011-07-15 14:24:09 -05:00
Patrick Walton
9fadab64a2
rustc: Introduce a stub destination-passing-style translation engine, accessible via the --dps switch for now
2011-07-15 11:38:46 -07:00
Patrick Walton
917afa4cc9
rustc: Remove a bunch of exterior vectors
2011-07-15 11:38:46 -07:00
Lindsey Kuper
a716eb28ec
Getting rid of unnecessary casts for objects.
...
Now that all objects are of rust_object_type in the wake of the LLVM
type system rewrite, we don't need this cast anymore.
2011-07-15 10:55:31 -07:00
Eric Holk
827e300485
refactor: Move the task and communication-related translation functions to a new module.
2011-07-14 17:33:28 -07:00
Michael Sullivan
e9a6fc94d5
Make collect_upvars know about function args.
...
Closes #697 .
2011-07-14 19:18:56 -05:00
Michael Sullivan
a3301f74f9
Generalize collect_upvars to work over any type of ast node.
2011-07-14 19:18:56 -05:00
Eric Holk
8afb1a7c63
refactor: Move the LLVM type and constant constructors into a new module.
2011-07-14 17:08:45 -07:00
Michael Sullivan
e2fcd29bbd
Consolidate some arguments in typeck by just passing the record they came from.
2011-07-14 18:45:55 -05:00
Michael Sullivan
53c4cb6a2f
Factor out build_environment's code to find a variable in a function context.
2011-07-14 18:45:02 -05:00
Michael Sullivan
759317ca8b
Factor out closure construction from trans_for_each.
2011-07-14 18:45:01 -05:00
Michael Sullivan
0957525cc6
Fix array out of bounds index in load_environment.
...
Closes #696 .
2011-07-14 18:34:43 -05:00
Rafael Ávila de Espíndola
c124a025bf
Move rustc to the new llvm type system. Requires an update to llvm trunk.
2011-07-14 15:19:17 -04:00
Patrick Walton
e76f44453b
rustc: First stab at interior string literals, untested as of yet
2011-07-14 11:47:20 -07:00
Brian Anderson
f4beac4a43
Revert "Allow main to return int"
...
This reverts commit 8c94d8fd54
.
There's no mechanism to actually return the value from main, so all this does
is allow main -> int to compile. Per #688 , the program returns non-zero on
failure, so it's not obvious that this change is appropriate at this time.
2011-07-14 10:37:28 -07:00
Rafael Ávila de Espíndola
7376e751ae
Keep a pointer to rust_object_type.
2011-07-14 12:07:51 -04:00
Rafael Ávila de Espíndola
40f617390d
Main part of the type system rewrite:
...
Change the type of all objects to be { {}*, {}* }.
2011-07-14 00:34:45 -04:00
Brian Anderson
8c94d8fd54
Allow main to return int
2011-07-13 19:22:53 -07:00
Tim Chevalier
f26ca025de
Make resolve and the typechecker check for a main fn of the
...
correct type
This means if a non-library program leaves out the main program,
the error gets caught earlier than link.
Closes #626 .
2011-07-13 18:30:53 -07:00
Patrick Walton
196753e4c3
rustc: Remove some interior vectors from ty, except the ones that I think were causing crashes before
2011-07-13 17:39:33 -07:00
Rafael Ávila de Espíndola
c94fc7aad8
Small cleanups that were missing in the last patch.
2011-07-13 20:21:17 -04:00
Rafael Ávila de Espíndola
9036758191
Next step in the type system change. Add task_type to the context.
2011-07-13 20:07:16 -04:00
Patrick Walton
2a3ab10f20
rustc: Remove exterior vectors from resolve again
...
This reverts commit 6390c43dc4
.
2011-07-13 16:44:39 -07:00
Rafael Ávila de Espíndola
3d353f76a9
First step in the typesystem rewrite:
...
Create the typedesc type in one place. That is where it will be named.
2011-07-13 19:37:19 -04:00
Graydon Hoare
39151f2ad8
Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases.
2011-07-13 15:44:09 -07:00
Tim Chevalier
04b239f3cb
Use more precise spans in error messages for bad FRU exprs
...
The type error message for an expression using FRU where a field
expression had the wrong type was using the span for the entire
expression. Fixed it to use the span for the individual field.
Closes #628 .
2011-07-13 15:30:30 -07:00
Marijn Haverbeke
8d68b0462a
Refactor out some repetetive code in trans_alt
2011-07-13 11:33:46 +02:00
Marijn Haverbeke
be4f7354b4
Add box patterns
...
An @ can now be prepended to a pattern to unbox something during
pattern matching.
Closes #661
2011-07-13 11:11:43 +02:00
Marijn Haverbeke
6cb5c0980a
box patterns, expect for the trans part
2011-07-13 10:50:16 +02:00
Marijn Haverbeke
6914d32acc
Do not allow moving out of obj fields, properly check move inits
...
Closes #591
2011-07-13 10:23:13 +02:00
Patrick Walton
729fa81d3b
Revert "rustc: Remove some exterior vectors from ty.rs"
...
This reverts commit 01ea0647bb
.
2011-07-12 18:47:26 -07:00
Patrick Walton
6390c43dc4
Revert "rustc: Remove exterior vectors from resolve"
...
This reverts commit 0ffe8c81c3
.
2011-07-12 18:42:58 -07:00
Patrick Walton
79ee267ef4
rustc: Remove the last few exterior vectors from typeck
2011-07-12 18:41:27 -07:00
Patrick Walton
f7ba28573f
rustc: Remove a few scattered uses of exterior vectors from typestate
2011-07-12 18:34:22 -07:00
Patrick Walton
0ffe8c81c3
rustc: Remove exterior vectors from resolve
2011-07-12 18:29:03 -07:00
Patrick Walton
01ea0647bb
rustc: Remove some exterior vectors from ty.rs
2011-07-12 18:21:50 -07:00
Patrick Walton
cdda0fd6d6
rustc: Remove some useless std::vec imports
2011-07-12 18:07:12 -07:00
Brian Anderson
41a3888da7
Fix type inference of fn tail expressions. Closes #680
2011-07-12 16:54:46 -07:00
Patrick Walton
a3add84909
rustc: Remove some interior vectors from typestate and some useless vec-related imports
2011-07-12 16:44:57 -07:00
Marijn Haverbeke
12d5532166
Use switches rather than chained conditionals to compile alt matches
...
This also moves the alt-related trans code into its own file.
Closes #467
2011-07-13 00:38:24 +02:00
Tim Chevalier
f7a1006a07
Make resolve check for type-variable name-shadowing
...
Capturing a type argument in the enclosing scope should be an error --
this commit implements that check in resolve, avoiding a potential
assertion failure in trans.
Closes #648 .
2011-07-12 13:42:05 -07:00
Lindsey Kuper
0d9c08af2a
Remove some obsolete comments.
2011-07-12 12:01:02 -07:00
Lindsey Kuper
a0b78e649e
"Narrow scope forgives many sins." -- M. Schwern
2011-07-12 12:01:02 -07:00
Patrick Walton
0be1a0b500
rustc: Simplify tritv::copy; shaves a couple of seconds off typestate.
2011-07-12 11:47:32 -07:00
Tim Chevalier
e1f9bfbac9
Add missing files
...
git add didn't, so this actually has the changes that should
have been in the previous commit
2011-07-12 11:26:14 -07:00
Tim Chevalier
0e594939aa
Fix potential use-before-init bug in trans
...
This was being masked by a bug in typestate (fixed in the next commit).
2011-07-12 11:21:14 -07:00
Paul Stansifer
48dbee6b47
Add elipses, reorganize the macro components into their own AST node.
2011-07-11 18:52:50 -07:00
Paul Stansifer
425732311a
Move macro expansion to a separate phase, change macro syntax, and add parse_sess to session.
2011-07-11 18:52:50 -07:00
Tim Chevalier
e1620def9f
In typeck, check for dynamically sized by-value arguments to thunks
...
A check in trans didn't have a corresponding check in typeck, causing
some programs (to wit, compile-fail/chan-parameterized-args.rs - part of this
commit) to fail with an assertion failure in trans instead of a type error.
Fixed it. In short, arguments that are future thunk arguments (any spawn
arguments, and _ arguments in bind) need to either not contain type params
or type vars, or be by-reference.
Closes #665 .
2011-07-11 17:32:00 -07:00
Patrick Walton
05390b4b38
rustc: Implement explicit global scope resolution via leading "::"; add a test case
2011-07-11 16:02:16 -07:00
Tim Chevalier
9427864f33
Unify the rhs and lhs types in a send
...
Closes #662 .
One-line fixes are always the best :-D
2011-07-11 15:24:47 -07:00
Patrick Walton
79ce5a4614
rustc: Implement pointer dereference; add a test case
2011-07-11 15:19:16 -07:00
Michael Sullivan
4618e802db
Fix comparisons of the nil type to do something sensible.
...
Closes #576 .
2011-07-11 14:45:21 -07:00
Marijn Haverbeke
c893188549
Use some actual or-patterns in resolve.rs
2011-07-11 21:23:49 +02:00