Commit Graph

2474 Commits

Author SHA1 Message Date
Graydon Hoare
6f8b9e176f Factor free paths out of drop glue, into free glue as in rustboot. 2011-05-18 17:28:08 -07:00
Patrick Walton
0aee8b3bd7 rustc: Thread statement contexts through unification 2011-05-18 15:36:14 -07:00
Rafael Ávila de Espíndola
bb7d4e15a8 Remove dead code. 2011-05-18 16:33:22 -04:00
Marijn Haverbeke
28c4a5586e Start checking name collisions in modules
(And remove a boatload of duplicate imports from the typestate files.)

Name collision checking in local scopes will follow soon.
2011-05-18 22:24:20 +02:00
Rafael Ávila de Espíndola
843739ee98 A quick hack to get the bots green while I refactor this code. 2011-05-18 16:16:52 -04:00
Patrick Walton
13d9f6a264 rustc: Split out type variable fixups from unification 2011-05-18 13:08:54 -07:00
Rafael Ávila de Espíndola
96516e9ca2 One exit_task_glue to rule them all. 2011-05-18 15:43:48 -04:00
Patrick Walton
37d5dd9471 rustc: Group the variable binding machinery into a separate data structure during unification 2011-05-18 11:54:12 -07:00
Rafael Ávila de Espíndola
a795d0e5b2 And yet more dead code. 2011-05-18 14:28:08 -04:00
Rafael Ávila de Espíndola
d108bfe2ee Remove a bit more dead code. 2011-05-18 14:02:53 -04:00
Rafael Ávila de Espíndola
cebc9b359d Remove dead rustboot code. 2011-05-18 13:48:57 -04:00
Patrick Walton
f4e049c415 rustc: Thread a statement context through the typechecker; use it for generating variable IDs. 40% typechecking speedup. 2011-05-17 22:21:31 -07:00
Graydon Hoare
49b90d37ed Add mirror-all-snapshots.py script for extra crowdsourced backup power. 2011-05-17 22:06:55 -07:00
Patrick Walton
fdf8c49882 rustc: Don't rebuild the AST when typechecking statements 2011-05-17 21:09:34 -07:00
Erick Tryzelaar
4d0cbd4310 Move vim syntax file, add indent file. 2011-05-17 20:35:46 -07:00
Patrick Walton
ace8058277 rustc: Have typechecking no longer rebuild the AST 2011-05-17 20:13:04 -07:00
Patrick Walton
df9801c9f0 rustc: Fix type mismatch in lib/sha1.rs constants 2011-05-17 20:13:03 -07:00
Brian Anderson
a98ea4f3ef rustc: Run block cleanups on else if blocks
With the scheme used to translate 'else if' currently the if expression is
translated in a new (else) scope context. If that if expression wants to
result in a value that requires refcounting then it will need to drop the
refcount in the cleanups of the else block.
2011-05-17 22:25:24 -04:00
Patrick Walton
e840a37f33 rustc: Remove typeck::check_item_fn(); it's entirely superfluous! 2011-05-17 19:20:24 -07:00
Patrick Walton
87288a186d rustc: Make check_const() not rebuild the AST (although it's not called at the moment!) 2011-05-17 19:13:16 -07:00
Patrick Walton
d21741843c rustc: Make check_block not rebuild the AST 2011-05-17 19:10:24 -07:00
Patrick Walton
10503a4a02 rustc: Don't rebuild the AST when writing back locals 2011-05-17 19:00:29 -07:00
Patrick Walton
3ffe390570 rustc: Print the types of declarations in --typed-pretty mode 2011-05-17 19:00:16 -07:00
Patrick Walton
8637a4eaf3 rustc: Pull the type out of the correct expression when typechecking channel types. Puts out burning tinderbox. 2011-05-17 18:19:45 -07:00
Patrick Walton
83e1dc63c2 rustc: Fix return value of expr_spawn case in pushdown_expr. Should put out soon-to-be-burning tinderbox. 2011-05-17 17:44:30 -07:00
Patrick Walton
c6d4c31ee4 rustc: Don't rebuild the AST when typechecking expressions 2011-05-17 17:43:06 -07:00
Patrick Walton
7a3812afc3 rustc: Add a typed pretty-printing mode for debugging 2011-05-17 17:43:06 -07:00
Eric Holk
cff9a3cc2a Fixing compile problems from recent changes. 2011-05-17 14:38:32 -07:00
Eric Holk
cf02c67137 Removing the TODO comment. 2011-05-17 14:38:32 -07:00
Eric Holk
8d10594ed5 Added a few more expr_spawn cases so the spawn.rs test case gets a little further before failing. 2011-05-17 14:38:32 -07:00
Patrick Walton
37768cba92 rustc: Don't rebuild call or bind expressions during typechecking 2011-05-17 14:37:23 -07:00
Patrick Walton
f300de2963 rustc: Make return value checking warnings a little prettier. Also introduce a new "note" diagnostic level. 2011-05-17 14:12:49 -07:00
Patrick Walton
5047ab0b0c rustc: Flatten annotations 2011-05-17 13:55:32 -07:00
Marijn Haverbeke
a90df393f9 Alias-ify the parser and lexer
This only shaves a measly 19k off the rustc binary... but hey, every
little thing helps.
2011-05-17 20:45:49 +02:00
Marijn Haverbeke
09d8ef8d51 Finally rename std::_xxx to std::xxx
Except for _task, which is still a keyword.
2011-05-17 20:41:41 +02:00
Paul Stansifer
1fdc75ee7c Parser fix: 'fail' was eating the next token that came after it. 2011-05-17 05:40:17 +00:00
Marijn Haverbeke
f7df3696de Switch pretty printer to new vec syntax 2011-05-17 07:19:34 +02:00
Brian Anderson
63cf381ca1 stdlib: Remove transitional extfmt.RT module 2011-05-17 00:58:52 -04:00
Brian Anderson
fbfd8552ab Return a better result from blocks. Closes issue #377
Blocks return in a copy of the result of their ending expression, not the
direct result of the ending expression, as that may be a local variable which
gets zeroed by drop_slot.
2011-05-17 00:46:56 -04:00
Graydon Hoare
4539b3f6ab Register new snapshots. 2011-05-16 19:57:03 -07:00
Graydon Hoare
4c5e315843 Rename aux.rs to auxiliary.rs since win32 doesn't like files named "aux". Really. 2011-05-16 19:21:29 -07:00
Graydon Hoare
cc27e0f8c6 Update a couple tests that slipped through. 2011-05-16 19:08:59 -07:00
Graydon Hoare
a2e2e78103 Merge remote branch 'origin/master' into HEAD
Conflicts:
	src/comp/middle/trans.rs
2011-05-16 19:04:45 -07:00
Graydon Hoare
fbbc1a77d2 Rewrite everything to use [] instead of vec() in value position. 2011-05-16 18:21:22 -07:00
Graydon Hoare
ae030c5bf2 Begin vec() -> [] transition. 2011-05-16 17:04:12 -07:00
Tim Chevalier
41b7af9652 make the return-checker happy about pretty::pp::base_indent 2011-05-16 16:59:30 -07:00
Tim Chevalier
387a8888ee Fix get_os and get_arch
get_os and get_arch were failing to return a value in the error
case; they were also assuming that strings are indexed from 1. No
idea how they ever worked, but anyway, fixed.
2011-05-16 16:59:30 -07:00
Tim Chevalier
b42bb2cff2 Two tests that the typechecker correctly unifies type arguments in patterns with their expected tag types 2011-05-16 16:59:30 -07:00
Tim Chevalier
971b5d5151 Started adding support for return checking and non-returning function annotations
* Reorganized typestate into several modules.

* Made typestate check that any function with a non-nil return type
  returns a value. For now, the check is a warning and not an error
  (see next item).

* Added a "bot" type (prettyprinted as _|_), for constructs like be, ret, break, cont, and
  fail that don't locally return a value that can be inspected. "bot"
  is distinct from "nil". There is no concrete syntax for _|_, while
  the concrete syntax for the nil type is ().

* Added support to the parser for a ! annotation on functions whose
  result type is _|_. Such a function is required to have either a
  fail or a call to another ! function that is reached in all control
  flow paths. The point of this annotation is to mark functions like
  unimpl() and span_err(), so that an alt with a call to err() in one
  case isn't a false positive for the return-value checker. I haven't
  actually annotated anything with it yet.

* Random bugfixes:

* * Fixed bug in trans::trans_binary that was throwing away the
    cleanups for nested subexpressions of an and or or
    (tests: box-inside-if and box-inside-if2).

** In typeck, unify the expected type arguments of a tag with the
   actual specified arguments.
2011-05-16 16:59:25 -07:00
Tim Chevalier
c75125fcce Noticed that metadata::Encode::enc_sty didn't have a case for ty_task, so I added one (though this wasn't causing the problem I was seeing... 2011-05-16 16:13:11 -07:00
Patrick Walton
f74298215c rustc: Fix indentation in typeck::check_lit() 2011-05-16 15:24:32 -07:00
Patrick Walton
1fc1ad91ce rustc: Don't rebuild the call expression in typeck::replace_expr_type() 2011-05-16 15:20:11 -07:00
Patrick Walton
278d64dafc rustc: Don't unpack annotations in trans::lval_generic_fn() 2011-05-16 15:20:11 -07:00
Graydon Hoare
d577f5bdf9 Let the snapshot-file parser parse empty T lines, since they are used to start a transition. 2011-05-16 15:14:44 -07:00
Patrick Walton
3ea3d9eed6 rustc: Make the parser use the interner 2011-05-16 14:54:10 -07:00
Kelly Wilson
b91ef944c8 Replace --bitcode with the canonical --emit-llvm 2011-05-16 14:07:43 -07:00
Kelly Wilson
196351aa44 Add automatic exe generation capabilities. Add --bitcode flag to generate only an LLVM bitcode file. 2011-05-16 14:07:43 -07:00
Patrick Walton
32b8dcb97c rustc: Factor out the code that interns types into an "interner" data structure 2011-05-16 13:58:13 -07:00
Patrick Walton
3760bfab87 rustc: Don't rebuild AST patterns during typechecking 2011-05-16 11:45:00 -07:00
Patrick Walton
ca51b49c0a rustc: Replace the redundant typeck::node_ann_ty_params() with ty::ann_to_type_params() 2011-05-16 11:43:50 -07:00
Patrick Walton
3aaf02b907 rustc: Make the type collection pass no longer rebuild the AST 2011-05-16 10:34:32 -07:00
Patrick Walton
525a5c582f rustc: Fix indentation in ty_param_count_and_ty_for_def() 2011-05-16 10:32:38 -07:00
Patrick Walton
594c70f788 rustc: Add an item_ann() accessor function 2011-05-16 10:32:38 -07:00
Brian Anderson
f77c5ba512 rustc: Wait until generic glue is actually emitted to define it as internal
The verifier was not liking this when generating unoptimized bitcode. Per LLVM
docs it is not valid for function declarations to be marked internal, but
their implementations may be.
2011-05-15 19:53:06 -04:00
Brian Anderson
8eaafdaa2d rustc: Rename 'Unify' modules to 'unify' 2011-05-14 21:13:47 -04:00
Brian Anderson
f33d490032 Remove xfail-boot lines from tests 2011-05-14 21:05:22 -04:00
Patrick Walton
de421afa55 rustc: Use walk instead of fold for the first item collection pass 2011-05-14 11:03:10 -07:00
Patrick Walton
8b3f359442 rustc: Change "Collect" to "collect" 2011-05-14 11:03:10 -07:00
Brian Anderson
ec30c71296 Add a regression test for issue #374 (XFAILed) 2011-05-14 13:29:49 -04:00
Brian Anderson
fb76c25729 WIP 2011-05-14 13:11:37 -04:00
Marijn Haverbeke
b7d6934ef3 fix a long line that i forgot to commit 2011-05-14 13:27:21 +02:00
Marijn Haverbeke
ee45fd80c6 Mark IDENT tokens that are followed by ::
So that the type parser won't go off and try to parse a vec
type when it sees vec::init_op.
2011-05-14 12:57:42 +02:00
Brian Anderson
1ad58d4dd6 rustllvm: Free TargetMachine in LLVMRustWriteOutputFile 2011-05-14 00:48:51 -04:00
Brian Anderson
aaf41815b1 rustc: Dispose intrinsics memory buffer 2011-05-14 00:29:24 -04:00
Brian Anderson
371dbf9834 rustc: Dispose the intrinsics LLVMModuleRef 2011-05-14 00:22:44 -04:00
Brian Anderson
0b73b29383 rt: Don't overshoot the end of the logging spec during parsing 2011-05-13 23:22:29 -04:00
Brian Anderson
9e9d57657d rt: Allocate room for null terminator in logging spec 2011-05-13 23:22:25 -04:00
Patrick Walton
85120d9959 rustc: Look types up in the side table 2011-05-13 18:46:44 -07:00
Graydon Hoare
6997adf763 Remove rustboot from the repository. 2011-05-13 18:38:28 -07:00
Patrick Walton
ef75860a0a rustc: Write nil types into the node type table wherever plain_ann() is used 2011-05-13 17:55:07 -07:00
Lindsey Kuper
5679f5c55e 'with' no longer a token; whitespace police.
Plus renaming the anonymous objects test to a more descriptive name,
and XFAILing it because it doesn't work yet.
2011-05-13 17:37:01 -07:00
Lindsey Kuper
cd31d5d532 More anon obj work; whitespace police in middle::fold
Passing args to middle::fold::fold_expr_anon_obj by reference to be
consistent with the other folds; adding a dummy fold_expr_anon_obj to
typeck to be filled in later.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
814b17352c Use new module namespace syntax. 2011-05-13 17:35:13 -07:00
Lindsey Kuper
b6f35c6a4b More work toward anonymous objects. 2011-05-13 17:35:13 -07:00
Lindsey Kuper
d3242b9644 Bug fixes.
Fixed infinite loop on anonymous objects in parser; added
expr_anon_obj to walk.rs; fixed syntax of test case.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
6c1c5b3948 More progress on anonymous objects.
Still segfaulting on the method-overriding.rs test, though.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
6a53e39e71 Correct capitalization of "Option". 2011-05-13 17:35:12 -07:00
Lindsey Kuper
7c2979e26f Starting on support for anonymous objects. Just syntax so far. 2011-05-13 17:35:12 -07:00
Graydon Hoare
ae784df3ce Add support for 'T' transition snapshots, which are identical to S snapshots except they tell the makefile to stop at stage1. 2011-05-13 17:06:58 -07:00
Patrick Walton
fac1342513 rustc: Move replace_expr_type() from ty to typeck, as it's only used in the latter 2011-05-13 17:06:30 -07:00
Brian Anderson
843e9435ab rustc: Fix long lines in typeck.rs 2011-05-13 20:06:02 -04:00
Patrick Walton
23d3b0ec57 rustc: Get ann_to_type_params() on board the ann_to_ty_param_substs_opt_and_ty() train 2011-05-13 16:53:35 -07:00
Patrick Walton
0739849e9f rustc: Make all type lookups go through the one ty::ann_to_ty_param_substs_opt_and_ty() function 2011-05-13 16:40:21 -07:00
Patrick Walton
4f2eb31870 rustc: Write types contained in "trivial annotations" to the table 2011-05-13 16:27:55 -07:00
Patrick Walton
e888fe6f9b rustc: Change ty::triv_ann() to take a node ID instead of a full annotation 2011-05-13 14:39:00 -07:00
Brian Anderson
2f440b1452 rustc: lowercase the link and link::write modules 2011-05-13 16:55:37 -04:00
Graydon Hoare
0d32ff723a Slight adjustments to shape, rename to type_glue.rs. 2011-05-13 13:29:50 -07:00
Patrick Walton
c97b05141a rustc: Add write_type() wherever ann_types are written, except for triv_ann() 2011-05-13 13:06:34 -07:00
Marijn Haverbeke
7647b838a1 Remove reserved word tests (since reserved words were removed)
Ping me if you disagree, but I think that in a language that's as
in-flux as rust currently is, it is silly to try and enforce a single
future-compatibility. The reserved words didn't work well with the
parser refactor, so I dropped them for the time being. We can,
eventually, bring them back as type-only reserved words.
2011-05-13 22:00:13 +02:00
Marijn Haverbeke
571afe71ba Safeguard against using statement or item keywords as value ids
This prevents insane things like 'auto while = 2', which would parse
in the previous revision, but then break when you tried to mutate it
with 'while = 10'.
2011-05-13 22:00:13 +02:00