Brian Anderson
45706a63bf
Remove unused case in resolve
...
Issue #817
2011-08-17 11:05:11 -07:00
Brian Anderson
bfbe8870d7
Refactor import lookup in middle:resolve
...
Issue #817
2011-08-17 11:05:04 -07:00
Brian Anderson
cd54e77720
Allow multiple imports in a single statement
...
Like so: import foo::{bar, baz};
Issue #817
2011-08-17 11:04:56 -07:00
Brian Anderson
c6482c0083
Refactor ast::view_item to differentiate between [ident]s and paths
2011-08-17 11:04:05 -07:00
Brian Anderson
67cc5b9e34
Allow multiple exports in a single export statement. Issue #817
2011-08-17 11:04:05 -07:00
Brian Anderson
53df58a177
Purge vecs from the std::test interface
2011-08-17 09:55:55 -07:00
Brian Anderson
7bd0437b08
Convert rustc main to ivecs
2011-08-17 09:55:55 -07:00
Graydon Hoare
5a209c8350
Fix some comments.
2011-08-16 17:39:25 -07:00
Graydon Hoare
ce276211f5
Remove dead send/recv operator tokens.
2011-08-16 17:39:25 -07:00
Michael Sullivan
07225e2169
Make a call with the wrong number of arguments non-fatal. Closes #784 .
2011-08-16 16:41:29 -07:00
Michael Sullivan
837342242c
Make fewer typechecker errors immediately fatal.
2011-08-16 16:39:49 -07:00
Erick Tryzelaar
70b009178c
Remove support for expr[T] syntax.
2011-08-16 15:05:57 -07:00
Erick Tryzelaar
c92f5b34d5
Remove support for foo[T] declaration syntax.
2011-08-16 15:05:57 -07:00
Erick Tryzelaar
adb9cde399
Remove type parameter and vec/port/chan foo[T] syntax.
2011-08-16 15:05:57 -07:00
Erick Tryzelaar
af21a27002
Port the compiler to the expr foo::<T> syntax.
2011-08-16 15:05:56 -07:00
Erick Tryzelaar
4abc471390
Port the compiler to foo<T> decl syntax.
2011-08-16 15:05:56 -07:00
Erick Tryzelaar
e4a0f997fb
Port the compiler to the typaram foo<T> syntax.
2011-08-16 15:05:56 -07:00
Erick Tryzelaar
014c6922e1
Change expr foo[T] syntax to foo::<T>.
...
This preserves the old syntax for now.
2011-08-16 14:16:14 -07:00
Erick Tryzelaar
9304b7ee59
Change declaration type parameter syntax to foo<T>.
2011-08-16 14:16:14 -07:00
Erick Tryzelaar
0107d6a81d
Change type parameter syntax to foo<T>.
...
This preserves the old syntax for now.
2011-08-16 14:16:14 -07:00
Patrick Walton
03174b4379
rustc: Implement unique pointer allocation and deallocation
2011-08-16 12:41:53 -07:00
Marijn Haverbeke
27169387fe
Remove partial DPS back-end
...
It won't be finished on the short term, and it's already bit-rotting
fast. We can fetch this from git's autumn annals if we need it.
2011-08-16 21:35:50 +02:00
Eric Holk
3db300b06e
Removing port, chan and task shapes.
2011-08-16 12:30:32 -07:00
Michael Sullivan
a9c46e29bc
Don't put the target in the bind closure if it is statically known. Closes #177 .
2011-08-16 12:13:21 -07:00
Eric Holk
89df915a13
Removing task, chan and port upcalls.
2011-08-16 11:22:24 -07:00
Eric Holk
862bc521a1
Removing tasks, ports and chans from the compiler.
2011-08-16 10:59:49 -07:00
Brian Anderson
f05a91a0dc
Rename std::ivec to std::vec
2011-08-16 10:36:19 -07:00
Brian Anderson
38c2363c45
Replace std::ufind with std::ufindivec. Remove std::ufindivec
2011-08-16 10:29:09 -07:00
Brian Anderson
bab29af449
Continue migrating the std #fmt interface to ivecs
...
Only thing left is to remove some duplicate interfaces in std::extfmt::rt
after the next snapshot
2011-08-16 10:29:09 -07:00
Brian Anderson
46658c4a9c
Revert "Revert "Make [] and ~[] both construct ivecs""
...
This reverts commit 28bf190219
.
Should work now that tests are all using ivecs
2011-08-16 10:29:09 -07:00
Brian Anderson
184eac90ab
Add and use an ivec interface to std::test
2011-08-16 10:29:08 -07:00
Brian Anderson
053b8bff5a
Accept main(args: [str]) as main signature
2011-08-16 10:29:08 -07:00
Eric Holk
cf2def46c1
Removed trans_comm.rs from the compiler. Updating aio/sio to work with the new chan and port system, started on a networking module for the standard library.
2011-08-16 09:36:29 -07:00
Marijn Haverbeke
e33af7e0b5
Make let bindings' scope start at their definition
...
Also, allow let bindings in a block to shadow each other.
2011-08-16 13:45:41 +02:00
Lindsey Kuper
f91351aaf6
The wonky for...in... whitespace was bothering me. Sorry!
2011-08-15 22:19:50 -07:00
Patrick Walton
e3d5b8a8d5
rustc: Add a few type-related methods to unique pointers; add typestate support
2011-08-15 18:12:31 -07:00
Michael Sullivan
42034f5e34
Remove a FIXME that I just made obsolete...
2011-08-15 17:40:08 -07:00
Michael Sullivan
14d85ca87a
Make bind glue do an llvm tail call to the target. Closes #2 .
...
Now, llvm probably won't actually *emit* a tail call with the compiler
options and configuration we have, but this should punt it over to the
more general "do tail calls" bug.
2011-08-15 17:36:28 -07:00
Michael Sullivan
f1cec5793f
Make GEPi use InBoundsGEP.
2011-08-15 16:19:47 -07:00
Michael Sullivan
9e084469af
Pretty print lambda-blocks.
2011-08-15 15:48:11 -07:00
Michael Sullivan
9eb798e965
Change arg typechecking procedure to make blocks more useful.
2011-08-15 15:48:10 -07:00
Michael Sullivan
d68f1a80dc
Implement type inference for type-inferred blocks.
2011-08-15 15:48:10 -07:00
Michael Sullivan
9b50011aae
Parse type inferred lambda-block expressions.
2011-08-15 15:48:10 -07:00
Graydon Hoare
814bf41d89
Add operator 'copy', translates as fall-through.
2011-08-15 15:44:41 -07:00
Paul Stansifer
ac0e5ea0ef
Implement an untyped version of the AST, with a coversion back to the typed AST..
2011-08-15 15:35:28 -07:00
Paul Stansifer
ebb16e6a25
Use span stacks to track macro expansion for less troublesome error messages.
2011-08-15 15:35:28 -07:00
Paul Stansifer
c48036c0b7
Make spans into stacks (to store expansion backtraces).
2011-08-15 15:35:27 -07:00
Paul Stansifer
87b56b5565
Allow [a, b, ..., c]
transcription patterns in MBE.
2011-08-15 15:35:27 -07:00
Paul Stansifer
d2f9b15052
Rename a field (so that macros can mention it).
2011-08-15 15:35:27 -07:00
Paul Stansifer
b803326063
Change node_id
s when expanding, to avoid duplicates.
2011-08-15 15:35:27 -07:00
Paul Stansifer
f50a582126
Add a syntax extension to log syntax, for debugging macros.
2011-08-15 15:35:27 -07:00
Paul Stansifer
e7139e28f4
Add a layer of boxing as a hack; this code can segfault otherwise.
2011-08-15 15:35:27 -07:00
Paul Stansifer
6d39be465f
Add backtraces for syntax problems.
2011-08-15 15:35:27 -07:00
Paul Stansifer
5428d4ee6d
Check for nonconsistent macro names.
2011-08-15 15:35:27 -07:00
Michael Sullivan
e39d835390
Fix compilation of paths containing ".". Closes #821 .
2011-08-15 15:15:34 -07:00
Patrick Walton
af61daf294
rustc: Parse and typecheck unique pointers
2011-08-15 14:38:48 -07:00
Patrick Walton
55c9842e7d
rustc: Unbreak "3 as uint < 5u"
2011-08-15 12:06:10 -07:00
Patrick Walton
91d83f5547
rustc: Accept <T> for type parameters in type and item declarations
2011-08-15 11:01:31 -07:00
Eric Holk
be7325073a
Removed spawn and task from the parser. Updated all the tests except for the benchmarks.
2011-08-15 09:26:52 -07:00
Marijn Haverbeke
a21ebb2f5e
Fix bad argument type of pprust::print_type
...
AST types are boxed, there's no need for every caller to do the unboxing
2011-08-15 13:45:04 +02:00
Marijn Haverbeke
3f127e397f
Add tuple patterns
2011-08-15 13:20:16 +02:00
Marijn Haverbeke
1ee24d31e1
Make tuples constructable
2011-08-15 12:18:27 +02:00
Marijn Haverbeke
29ea87542f
Tuple fields are immutable
2011-08-15 12:08:05 +02:00
Marijn Haverbeke
9538b00363
Tuple types back, not constructable yet
2011-08-15 11:40:38 +02:00
Brian Anderson
28bf190219
Revert "Make [] and ~[] both construct ivecs"
...
This reverts commit 60e1cead9b
.
The check-fast driver can't work with this commit. Need to wait until main
taks ivecs
2011-08-14 12:54:18 -07:00
Michael Sullivan
0340f32748
Eliminate autoderef on binops and unary negation.
...
Autoderef on binops is basically unused, kind of silly, and
complicates typechecking. There were only three instances of it in the
compiler and the test drivers, two of which were of the form "*foo =
foo + 1", which should be written as "*foo += 1" anyways.
2011-08-12 18:28:03 -07:00
Tim Chevalier
1ba9af92bf
Remove typestate workaround that's no longer necessary
2011-08-12 18:26:23 -07:00
Michael Sullivan
8e92be3b94
Small whitespace cleanups.
2011-08-12 16:36:50 -07:00
Tim Chevalier
c01e487485
Un-XFAIL do-while-body-fails
...
Made it work both with optimization enabled, and with optimization
disabled. Huzzah!
2011-08-12 16:26:10 -07:00
Brian Anderson
60e1cead9b
Make [] and ~[] both construct ivecs
...
It's no longer possible to create an exterior vec
2011-08-12 16:23:33 -07:00
Brian Anderson
594c7fb0c6
Remove the last remaining vec expressions in rustc
2011-08-12 16:13:13 -07:00
Brian Anderson
12b03dd3d4
Add an ivec interface to the #fmt library functions
...
It will take a snapshot to finish the ivec conversion for #fmt
2011-08-12 16:13:13 -07:00
Michael Sullivan
2421312dea
Don't rely on binop autoderef in the compiler.
2011-08-12 15:16:01 -07:00
Brian Anderson
4e62c0d6cb
Remove std::vec
2011-08-12 12:14:07 -07:00
Brian Anderson
544bdf05c5
Convert uint::parse_buf to ivecs
2011-08-12 12:14:07 -07:00
Brian Anderson
5f71a204d3
Remove vecs from std::getopts
2011-08-12 12:14:07 -07:00
Brian Anderson
0fed53921f
Remove ebmlivec module
2011-08-12 12:14:06 -07:00
Brian Anderson
674fb0911c
Rename std::termivec to std::term
2011-08-12 12:14:06 -07:00
Brian Anderson
7625ed52ee
Remove vecs from std::sort
2011-08-12 12:14:06 -07:00
Brian Anderson
13439dc870
Convert std::run to ivecs
2011-08-12 12:11:12 -07:00
Brian Anderson
72773e6d4d
Hide even more exports from std::vec
2011-08-12 12:11:12 -07:00
Brian Anderson
7d05da96f7
Rename std::ioivec to std::io
2011-08-12 12:08:27 -07:00
Brian Anderson
119f43e0c7
Rename str::connect_ivec to str::connect
2011-08-12 12:08:27 -07:00
Brian Anderson
369be5c8df
Convert uses of str::connect to str::connect_ivec
2011-08-12 12:08:27 -07:00
Brian Anderson
1e397eee2a
Rename str::split_ivec to str::split
2011-08-12 12:08:27 -07:00
Brian Anderson
64f53dfbb0
Convert uses of str::split to split_ivec
2011-08-12 12:08:27 -07:00
Brian Anderson
740196987e
Rename std::str::unsafe_from_bytes_ivec to unsafe_from_bytes
2011-08-12 12:08:27 -07:00
Brian Anderson
a9ce342fa3
Convert all uses of unsafe_from_bytes to unsafe_from_bytes_ivec
2011-08-12 12:08:26 -07:00
Brian Anderson
49b80f9bf7
Remove str::from_bytes
...
This is exactly the same as str::unsafe_from_bytes
2011-08-12 12:08:26 -07:00
Brian Anderson
2e7e58812b
Remove vec version of str::bytes, rename bytes_ivec to str::bytes
2011-08-12 12:08:26 -07:00
Brian Anderson
4caeba9178
Remove vecs from the rustc driver
2011-08-12 12:08:26 -07:00
Brian Anderson
b32889d82c
Remove vecs from simplext
2011-08-12 12:08:26 -07:00
Brian Anderson
f195814df3
Begin removing vecs from #fmt
2011-08-12 12:08:26 -07:00
Marijn Haverbeke
de4b383a0f
Properly typecheck unary minus
...
Closes #813
2011-08-12 16:05:56 +02:00
Tim Chevalier
051b401051
Handle _|_ - typed things in the bodies of do-while loops
...
The resulting code is strange, but perhaps someone else can
fix it. The obvious things, like returning body_res, all resulted
in completely incomprehensible LLVM errors.
Closes #814
2011-08-11 17:23:47 -07:00
Lindsey Kuper
19bbd02049
Fix too-long line.
2011-08-11 16:21:09 -07:00
Rafael Ávila de Espíndola
6402b63b4f
Use the new C API for PassManagerBuilder.
2011-08-11 19:09:52 -04:00
Rafael Ávila de Espíndola
4cee063976
Update for llvm api change.
2011-08-11 14:58:30 -07:00
Patrick Walton
5079f51386
rustc: Associate type descriptors with allocas as metadata
2011-08-11 14:35:33 -07:00
Brian Anderson
4ff6763b60
rustc: Lowercase "main function not found" error
2011-08-11 10:09:02 -07:00
Brian Anderson
0cddcac016
rustc: Use spans in some main typeck errors
2011-08-11 10:09:02 -07:00
Brian Anderson
612fe3d2d6
Add ast_map::node_span function
2011-08-11 10:09:02 -07:00
Brian Anderson
14b3ad194a
Switch a check for main type from an error to an ICE
...
This code path doesn't look possible, so I think it indicates a bug. Also,
make the message lowercase.
2011-08-11 10:09:02 -07:00
Brian Anderson
0f8e58e3ce
Lowercase the "wrong type in main fn" error
2011-08-11 10:09:02 -07:00
Patrick Walton
7b337e3581
rustc: Don't free shared memory when --gc is on
2011-08-10 22:47:18 -07:00
Patrick Walton
a5d5f9ef48
rustc: Add a --gc switch for debugging and experimentation
2011-08-10 22:13:30 -07:00
Michael Sullivan
c5c8258937
Rework check_expr substantially.
...
The bulk of check_expr is now check_expr_with_unifier, which takes an
expected type and a unification function and will perform the
unification on the type it produces. check_expr calls
check_expr_with_unifier with a dummy unifier and a new function,
check_expr_with, takes an expected type and uses the simple unifier.
I think this generally makes thing cleaner, but the purpose for doing
this is to enable type inferred lambda-blocks to be useful by allowing
the argument types to be unified before the body of the lambda is
checked.
2011-08-10 20:18:07 -07:00
Michael Sullivan
67e361a940
Introduce a ty_infer ast node and use it instead of option::t[ty].
...
This actually basically makes things worse, since we get less nice
type system guarentees but it will make doing type inferred blocks a
fair deal less painful. I'm not /really/ happy about this...
2011-08-10 20:18:07 -07:00
Patrick Walton
1e6074ca73
rustc: Mark functions as "rust" GC
2011-08-10 20:12:30 -07:00
Michael Sullivan
43c9fe65bd
Eliminate the last vestiges of init_recv.
2011-08-10 19:21:29 -07:00
Michael Sullivan
00b781e495
Some cleanup in check_expr.
2011-08-10 19:20:00 -07:00
Patrick Walton
ba7c8f18d4
rustc: Remove unused "trace" upcalls
2011-08-10 18:09:52 -07:00
Patrick Walton
d1494901d0
rustc: Declare GC-related intrinsics
2011-08-10 17:59:33 -07:00
Patrick Walton
19424dfab6
rustc: Add unique pointers to the set of types we support
2011-08-10 17:24:22 -07:00
Tim Chevalier
a8a4d4ec05
Use actual type, not declared type, when zeroing move arguments
...
trans was failing with a bounds check error because the caller
was using the declared type (an out-of-scope ty param) and not
the actual type in a list of argument types to zero.
Closes #811
2011-08-10 17:22:57 -07:00
Graydon Hoare
511c053856
Remove dead keywords from parser.
2011-08-10 17:11:24 -07:00
Lindsey Kuper
bf81a05223
Factor out creation of object body types.
2011-08-10 16:53:32 -07:00
Michael Sullivan
bcc30cb4f6
Rename unify::simple to unify::unify.
2011-08-10 16:43:03 -07:00
Michael Sullivan
7d5092ee7b
Some trivial cleanup.
2011-08-10 16:28:34 -07:00
Lindsey Kuper
007af36bb3
Comments, cleanup, whitespace, refactoring.
2011-08-10 15:11:32 -07:00
Patrick Walton
adce35acd4
rustc: Use polymorphic logging
2011-08-10 14:35:12 -07:00
Patrick Walton
8e6e6f5f89
rustc: Make iter_structural_ty_full and friends take one value, not two. Shaves a second off codegen.
2011-08-09 18:31:14 -07:00
Patrick Walton
044b16ad68
rustc: Remove the code to generate cmp glue
2011-08-09 18:31:13 -07:00
Graydon Hoare
a5997f2eb2
Actually perform handoff from caller to callee on move-mode args.
2011-08-09 17:56:26 -07:00
Patrick Walton
865ca749dc
rustc: Use shapes instead of codegen'd cmp glue
2011-08-09 17:02:17 -07:00
Lindsey Kuper
5d9680fc7e
Move object-system-related trans stuff to its own file.
2011-08-09 16:42:55 -07:00
Brian Anderson
61425c8d13
Convert remaning ivec decls to new syntax
...
These snuck in during rebasing
2011-08-09 15:53:26 -07:00
Erick Tryzelaar
00ccd6ba42
Remove support for the ivec T[] syntax.
2011-08-09 15:53:26 -07:00
Erick Tryzelaar
8b15045224
Port the compiler to the ivec type [T] syntax.
2011-08-09 15:53:26 -07:00
Erick Tryzelaar
a37e00ed1f
Change the ivec type syntax to [T].
...
This preserves the old syntax for now.
2011-08-09 11:29:36 -07:00
Lindsey Kuper
d5c8bb9d86
A little backwarding cleanup/refactoring.
2011-08-09 11:19:24 -07:00
Lindsey Kuper
a334adaab9
Thread "self" through the stack. Backwarding! Closes #702 .
2011-08-09 10:59:13 -07:00
Graydon Hoare
b2cac5afa3
Implement typestate checking for move-mode args. Un-XFAIL compile-fail/move-arg.rs.
2011-08-08 19:41:54 -07:00
Patrick Walton
72fdb1a3bf
rustc: Emit the shape of "float" as f64, not f32
2011-08-08 16:52:10 -07:00
Michael Sullivan
059c66b9f7
Don't bother zeroing out slots in cleanups.
2011-08-08 16:17:09 -07:00
Patrick Walton
c0fc204112
rustc: Fix signature on cmp glue upcall
2011-08-08 16:01:03 -07:00
Graydon Hoare
b54e7e4506
Add new arg-passing mode 'move' denoted with '-T'. Translate as pass-by-value, doesn't deinit source yet nor get proper analysis in typestate, alias passes.
2011-08-08 15:53:41 -07:00
Patrick Walton
4d7f866eec
rustc: Declare upcall_cmp_type
2011-08-08 15:05:12 -07:00
Paul Stansifer
a9471d8296
Revert "rustc: bzero in zero_alloca. Shaves off a second or three."
...
This causes trouble in Valgrind in drop glue in parsing.
This reverts commit 4d180793f0
.
2011-08-05 16:38:49 -07:00
Eric Holk
b62e80c1f0
Atomic ref counting for chans.
2011-08-05 15:27:28 -07:00
Tim Chevalier
1c786bcc82
Initialize all constraints to False
...
Previously, typestate was initializing the init constraint for
a declared-but-not-initialized variable (like x in "let x;") to False,
but other constraints to Don't-know. This led to over-lenient results
when a variable was used before declaration (see the included test
case). Now, everything gets initialized to False in the prestate/poststate-
finding phase, and Don't-know should only be used in pre/postconditions.
This aspect of the algorithm really needs formalization (just on paper),
but for now, this closes #700
2011-08-05 15:25:52 -07:00
Patrick Walton
b079e1adbb
rustc: Parse "inline". Also write it into metadata.
2011-08-05 13:59:27 -07:00
Patrick Walton
fd7ffd5ac2
rustc: Add inlineness to the fn decl instead
2011-08-05 11:46:43 -07:00
Patrick Walton
59e9b629c0
Revert "rustc: Introduce the concept of inline to the AST"
...
This reverts commit 9b9170f9fe
.
2011-08-05 11:38:06 -07:00
Patrick Walton
9b9170f9fe
rustc: Introduce the concept of inline to the AST
2011-08-05 11:33:48 -07:00
Tim Chevalier
d7ee55bfd0
(Almost) Always unify a function tail expr with the function result type
...
typeck::check_fn had an exception for the case where the tail expr
was compatible with type nil -- in that case, it doesn't unify the
tail expr's type with the enclosing function's result type. This
seems wrong to me. There are several test cases in Issue #719
that illustrate why. If the tail expr has type T, for some type
variable T that isn't resolved when this check happens, then T
never gets unified with anything, which is incorrect -- T should
be unified with the result type of the enclosing function. (The
bug was occurring because an unconstrained type variable is
compatible with type nil.)
Instead, I removed the check for type nil and added a check that
the function isn't an iterator -- if it's an iterator, I don't
check the tail expr's type against the function result type,
as that wouldn't make sense.
However, this broke two test cases, and after discussion with
brson, I understood that the purpose of the check was to allow
semicolons to be omitted in some cases. The whole thing seems
rather ad hoc. But I came up with a hacky compromise solution:
instead of checking whether the tailexpr type is *compatible*
with nil, we now just check whether it *is* nil. This also
necessitates calling resolve_type_vars_if_possible before
the check happens, which worries me. But, this fixes the bug
from Issue #719 without requiring changes to any test cases.
Closes #719 but I didn't try every variation -- so reopen the bug
if one of the variations still doesn't work.
2011-08-05 02:21:58 -07:00
Michael Sullivan
c5d55ef918
Prohibit assignment to upvars in lambdas. Closes #805 .
2011-08-04 19:35:44 -07:00
Patrick Walton
a26c027731
Revert "rustc: Don't emit memset for non-structural types" due to crashes
...
This reverts commit 3d5a777fe1
.
2011-08-04 19:06:13 -07:00
Patrick Walton
3d5a777fe1
rustc: Don't emit memset for non-structural types
2011-08-04 18:24:57 -07:00
Michael Sullivan
66a255ac92
Add a cleanup for copying closures. Closes #804 .
2011-08-04 17:58:12 -07:00
Michael Sullivan
9a5e9806f3
Don't force resolution of type variables until there is no enclosing function scope. Closes #803 .
2011-08-04 17:33:15 -07:00
Patrick Walton
6c0297cfe7
rustc: bzero in drop_slot
2011-08-04 16:47:20 -07:00
Lindsey Kuper
fcec628203
Enable creation of backwarding vtables (issue #702 ), but don't start
...
using them yet. Also, refactor process_fwding_mthd into separate
functions to handle backwarding and forwarding, and refactor
create_vtbl to be more digestible.
2011-08-04 16:40:17 -07:00
Patrick Walton
4d180793f0
rustc: bzero in zero_alloca. Shaves off a second or three.
2011-08-04 16:33:38 -07:00
Michael Sullivan
cf9c0f9d93
Use lambdas in gather_locals in typeck.
2011-08-04 16:18:12 -07:00
Michael Sullivan
95680474e2
Use lambdas in the freevars pass.
2011-08-04 16:18:12 -07:00
Patrick Walton
ae3312002a
rustc: Use memmove in copy_ty. 45% LLVM codegen speed improvement.
2011-08-04 16:14:28 -07:00
Tim Chevalier
e0985c1060
Handle alt on a _|_ - typed value
...
Return the result of the discriminant from trans_alt,
rather than nil, in the _|_ case. This was breaking the
enclosed test case (alt-bot-2) when optimization was disabled.
Closes #769
2011-08-04 16:07:26 -07:00
Tim Chevalier
5f03ca48d8
Add a fast path in ty::occurs_check_fails
...
Use type_contains_vars in occurs_check_fails to avoid doing
any work most of the time. This fixes a performance regression.
(No one else noticed yet that typechecking just got 4x slower, right?
Well, now it isn't anymore. :-})
2011-08-04 15:56:40 -07:00
Tim Chevalier
2baaeab784
Implement the occurs check
...
In the writeback phase, the typechecker now checks that it isn't
replacing a type variable T with a type that contains T. It
also does an occurs check in do_autoderef in order to avoid
getting into an infinite chain of derefs.
I'm a bit worried that there are more places where the occurs
check needs to happen where I'm not doing it now, though.
Closes #768
2011-08-04 15:30:09 -07:00
Lindsey Kuper
d7d4b4fc38
trans_args no longer needs llobj argument.
2011-08-04 11:34:06 -07:00
Patrick Walton
2a3235b58c
rustc: Actually emit shapes
2011-08-04 11:25:46 -07:00
Patrick Walton
4061ca2bbd
rustc: Generate shapes
2011-08-04 10:46:10 -07:00
Lindsey Kuper
1b1d8e7b91
Killing an obsolete comment.
2011-08-03 20:03:05 -07:00
Lindsey Kuper
6df7c041bc
Pointer-ifying llenv. Step 1 of 2 steps to object system sanity.
2011-08-03 19:50:19 -07:00
Lindsey Kuper
29ec2503db
Put comments on trans contexts back where they belong. :(
2011-08-03 19:49:29 -07:00
Michael Sullivan
5d5a3ca52d
Fix trans_put to properly return (). Closes #773 .
2011-08-03 18:10:54 -07:00
Michael Sullivan
5ea8d7f467
Make the pretty printer put trailing newlines at the end of files.
2011-08-03 17:52:25 -07:00
Michael Sullivan
e33de59e47
Clean up how we deal with dynamic size function arguments/returns.
2011-08-03 14:24:41 -07:00
Michael Sullivan
7bcde7270d
Have trans_bind_thunk handle polymorphic but statically sized return values.
...
Closes #775 .
2011-08-03 14:24:41 -07:00
Tim Chevalier
001df3f0ca
Revert "Revert "Handle conditionals on _|_ - typed values correctly""
...
This reverts commit ea81c03960
.
Changed the case in trans_if where the conditional is _|_ - typed
but the block is terminated to return the result of the cond,
instead of nil.
This passes "make check" with optimization disabled as well as
enabled.
2011-08-03 13:07:41 -07:00
Paul Stansifer
513276e595
Add #concat_idents[] and #ident_to_str[]
2011-08-03 12:42:35 -07:00
Michael Sullivan
c9ae548dae
Reject programs that do a put outside of iterators.
...
Closes #774 .
2011-08-03 11:43:50 -07:00
Michael Sullivan
8871462575
Do a bunch more typechecking for iters and for each loops.
...
Closes #771 .
Closes #772 .
Closes #796 .
2011-08-03 11:07:53 -07:00
Michael Sullivan
3254fb9806
Code cleanup in check_expr.
2011-08-03 11:06:58 -07:00
Michael Sullivan
fcc458d4a0
Fix typechecking when spawning something type inferred.
...
Of course, we still don't *translate* it.
Closes #757 .
2011-08-03 11:06:58 -07:00
Brian Anderson
e4da7c5bee
parse_crate_from_source_str takes a parse_sess, not codemap
...
This was causing problems when reading from stdin for subsequent passes that
needed to generate node ids.
2011-08-03 10:55:59 -07:00
Brian Anderson
97a8784c98
Fix pretty-printer to read from files again
...
I accidentally made the pretty-printer always read from stdin
2011-08-03 10:55:59 -07:00
Brian Anderson
0b7a94a94c
Pretty-print kinds of type params
2011-08-03 10:55:59 -07:00
Brian Anderson
843767a841
Disambiguate unop statements in pretty-printer. Closes #674
2011-08-03 10:55:59 -07:00
Brian Anderson
ea81c03960
Revert "Handle conditionals on _|_ - typed values correctly"
...
This reverts commit 13f8b3f2a6
.
run-pass/if-ret.rs does not translate correctly when unoptimized. Issue #797
2011-08-03 10:48:52 -07:00
Marijn Haverbeke
d08c0f0ec1
Make ast::pat_bindings an iterator
...
And use it to get rid of some repetetive code
2011-08-03 10:26:41 +02:00
Tim Chevalier
948f8090ae
Handle _|_ - typed discriminants in alts correctly
...
Stop me, won't you, if you've heard this one before?
Closes #794
2011-08-02 19:02:38 -07:00
Tim Chevalier
13f8b3f2a6
Handle conditionals on _|_ - typed values correctly
...
Closes #776
2011-08-02 18:34:44 -07:00
Tim Chevalier
7c34550931
Make _|_ type binopable
...
But don't actually generate code that does the operation. That means
hoisting the check I added in my last commit from trans_compare
up into trans_eager_binop (don't generate any code if one operand
has type _|_ ).
Closes #777
2011-08-02 18:06:46 -07:00
Brian Anderson
2911156820
Pretty-print fn constraints more correctish
2011-08-02 17:49:11 -07:00
Brian Anderson
3eef9993af
Don't pp extra lines after block open when preserving whitespace. Closes #759
2011-08-02 17:49:11 -07:00
Tim Chevalier
731797d075
In trans, don't assume both sides of a binop have the same type
...
This was at least partially responsible for Issue 777.
The only solution I can think of is for trans to just not generate
code for a comparison if one or both sides has type _|_. Since
that means evaluating that subexpression diverges, it should be ok
to never do the comparison. Actually generating code for the
comparison would trip an LLVM assertion failure.
2011-08-02 17:36:41 -07:00
Lindsey Kuper
430a28bb49
Refactor: a backwarding vtable can only have one kind of method.
2011-08-02 16:59:49 -07:00
Lindsey Kuper
48467c4faa
Comment tweaks and re-flows.
2011-08-02 16:53:31 -07:00
Michael Sullivan
f371482593
Consolidate environment building/loading between closure types.
2011-08-02 16:30:56 -07:00
Michael Sullivan
4cf4e17e1d
Track the node_id of the function in trans_common::fn_ctxt.
2011-08-02 16:30:56 -07:00
Michael Sullivan
f8b0d3d7d2
Use GEPi a bunch.
2011-08-02 16:26:00 -07:00
Paul Stansifer
ab4764520c
Allow patterns of the form `[a, b, c ...] to be matched and transcribed.
2011-08-02 14:46:02 -07:00
Tim Chevalier
40c1b864c6
Use or-patterns in trans::trans_compare, eliminating a FIXME
2011-08-02 13:17:59 -07:00
Brian Anderson
35e9e02066
Use ioivec::read_whole_file_str in a few places
2011-08-02 10:39:14 -07:00
Brian Anderson
840a09c86e
Add a --no-trans command line option
...
Runs all passes before translation. This will be used for pretty-printing
tests to verify that the results are still probably valid Rust code.
2011-08-02 10:39:12 -07:00
Brian Anderson
5f4b7e1ba7
Compiler accepts input from stdin when source file is called "-"
2011-08-02 10:39:09 -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