Commit graph

1363 commits

Author SHA1 Message Date
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
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
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
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
65ec38c096 rustc: Cleanup formatting in rustc.rs 2011-05-22 16:07:30 -04:00
Brian Anderson
d82e9c1874 rustc: Add a FIXME to expr_alt type checking 2011-05-21 18:35:21 -04:00
Brian Anderson
4504e23a82 rustc: Remove unnecessary pushdown from check_expr in the expr_if case 2011-05-21 18:18:48 -04:00
Brian Anderson
e24d7ae967 rustc: If all if branches are _|_, then the entire if is _|_ 2011-05-21 18:18:48 -04:00
Brian Anderson
085fb1a2db rustc: Remove outdated comment 2011-05-21 14:43:04 -04:00
Brian Anderson
b62bf8cede rustc: Allow if expressions to fail 2011-05-21 14:22:01 -04:00
Brian Anderson
6824f119fc rustc: Allow alt expressions to fail 2011-05-21 13:22:01 -04:00
Brian Anderson
418b4c4567 rustc: Assign ty_bot to nodes in write::bot_ty. Remove FIXME 2011-05-21 13:02:58 -04:00
Brian Anderson
779dd809d2 rustc: Blocks shouldn't try to return results for ty_bot 2011-05-21 12:56:31 -04:00
Tim Chevalier
755ca8eb73 Correctly check that ! functions always diverge
Also make _|_ unify with any type.
2011-05-20 19:54:14 -07:00
Brian Anderson
2fc0bedc83 rustc: Don't write metadata for unexported items 2011-05-20 21:32:57 -04:00
Tim Chevalier
467b938ea8 Merge remote-tracking branch 'graydon/master' into typestate_4 2011-05-20 18:23:03 -07:00
Tim Chevalier
964898eaf1 Error instead of warning for missing returns. Huzzah! 2011-05-20 18:20:54 -07:00
Tim Chevalier
fed0486c33 Annotate erroring functions in session and parser 2011-05-20 18:20:54 -07:00
Lindsey Kuper
c3410bf927 More work on anonymous objects. 2011-05-20 17:59:56 -07:00
Tim Chevalier
c8d488b337 Change node_ann hash table to a vector in typestate 2011-05-20 16:57:37 -07:00
Tim Chevalier
9128a1bab8 rm unnecessary logging 2011-05-20 16:57:37 -07:00
Tim Chevalier
7e82f23bc0 rm unused import 2011-05-20 16:57:37 -07:00
Tim Chevalier
551fb13689 Add a "fail" after a while(true) loop in two places
(in preparation for changing the "function may not return" warning
to an error)
2011-05-20 16:57:37 -07:00
Tim Chevalier
a08a376d6e Make controlflow part of a function type
Change ty_fn to have a controlflow field. A 'controlflow' is
essentially a bit of data that says whether or not this function
never returns to the caller (if it never returns, that means it calls
"fail" or another "never-returns" function on every control path).

Also add syntax for annotating functions that never return:

fn foo() -> ! {
   fail;
}

for example. Functions marked with ! implicitly have a result type of
ty_bot, which is a new type that this commit also adds.
2011-05-20 16:57:37 -07:00
Eric Holk
3dd2877975 Using the right mode... 2011-05-20 16:51:09 -07:00
Eric Holk
0de27ce8bd Translated start_task, but it fails on spp == align_down(spp) 2011-05-20 16:51:09 -07:00
Eric Holk
d01948cd07 Called the new_task upcall. There are refcount issues though. 2011-05-20 16:51:08 -07:00
Eric Holk
41b3979990 Nicer printer of LLVM array types. 2011-05-20 16:51:08 -07:00
Eric Holk
219351e4b9 A little closure towards translating spawn. We're about ready to do the upcall, except that rustc segfaults. 2011-05-20 16:51:08 -07:00
Eric Holk
d6338a8c15 Added some comments to trans_spawn that sort of explains what needs to happen 2011-05-20 16:51:08 -07:00
Eric Holk
2b124a8140 Started working on translating spawn. It correctly generates the task name in the case that it is not provided. 2011-05-20 16:51:08 -07:00
Graydon Hoare
36c083b14c Options fix from erickt. 2011-05-20 15:20:48 -07:00
Graydon Hoare
fa75703700 Twiddle glue inlining heuristics. ~10% win on build time. 2011-05-20 14:57:52 -07:00
Graydon Hoare
67b8501eb8 Elide a bunch of do-nothing take glue. 2011-05-20 14:50:57 -07:00
Graydon Hoare
381ba1d0ba Remove redundant secondary declaration of glue. 2011-05-20 14:48:33 -07:00
Patrick Walton
7e43a31f08 rustc: Move the interner to a new module intended to be used for general data structures 2011-05-20 13:57:53 -07:00
Brian Anderson
b6d2fe4d74 rustc: Translate else if blocks the same as other blocks. Closes #388 2011-05-19 23:32:09 -04:00
Brian Anderson
879a952a37 rustc: Find the correct outer scope in trans_block 2011-05-19 23:32:08 -04:00
Rafael Ávila de Espíndola
40b511a7c5 Revert 106216d673.
This depends on llvm's 131294.
2011-05-19 18:30:19 -07:00
Graydon Hoare
494c0c3b61 After all that, give up on "complex" version of type_has_pointers and just manually inspect. Can't calculate property during interning. 2011-05-19 18:28:09 -07:00
Graydon Hoare
7f938f4945 Move the ty_item_table into ty::ctxt.items, move variant_info to ty, and start sketching the contains_pointer property on types. 2011-05-19 17:21:36 -07:00
Graydon Hoare
1d67ee0e88 Remove type_glue.rs, don't think it's going to work. 2011-05-19 17:21:36 -07:00
Patrick Walton
bc87ecf110 rustc: Unify variables using a single type instead of keeping a list and doing it all at the end. This will give us better error messages. 2011-05-19 16:07:12 -07:00
Graydon Hoare
a4dd57705c Move type cache and node type table into type context. 2011-05-19 15:47:15 -07:00
Marijn Haverbeke
8a7b544995 Finish name collision testing.
And fix a the single screw-up in the source code it caught.
2011-05-19 21:58:57 +02:00
Graydon Hoare
31d65453d4 OptLevel changes. Accepts levels 0 to 3 only. '-O' is synonym for --OptLevel=2. 2011-05-19 12:46:10 -07:00
Paul Stansifer
533d3055f3 No functional change. Largely removed the native module/non-native module distinction from resolve.rs 2011-05-19 12:13:35 -07:00