Commit graph

115 commits

Author SHA1 Message Date
Tim Chevalier
fed0486c33 Annotate erroring functions in session and parser 2011-05-20 18:20:54 -07:00
Graydon Hoare
36c083b14c Options fix from erickt. 2011-05-20 15:20:48 -07:00
Graydon Hoare
a4dd57705c Move type cache and node type table into type context. 2011-05-19 15:47:15 -07: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
Tim Chevalier
b74d0d7c3d Typestate checking code no longer uses fold -- only walk. 2011-05-19 11:40:16 -07:00
Patrick Walton
ace8058277 rustc: Have typechecking no longer rebuild the AST 2011-05-17 20:13:04 -07:00
Patrick Walton
7a3812afc3 rustc: Add a typed pretty-printing mode for debugging 2011-05-17 17:43:06 -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
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
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
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
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
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
Brian Anderson
2f440b1452 rustc: lowercase the link and link::write modules 2011-05-13 16:55:37 -04:00
Brian Anderson
c124404d0e Fix naming of libc that was mangled by recent module changes
It doesn't appear that rustc makes use of these strings so it didn't actually
break anything yet.
2011-05-13 13:55:57 -04:00
Marijn Haverbeke
58ec5d1654 Move capture checking into resolve.rs
Drops capture.rs. The new algorithm also checks for captures function
arguments and obj fields.
2011-05-13 12:44:05 +02:00
Marijn Haverbeke
89490e416b Change resolve to use walk instead of fold
Possibly, at some point, we should add a state-passing variant of
walk, or a wrapper that makes it easier to thread state. (See the
repetetive pop_state_for_* functions in this commit.)
2011-05-13 11:35:25 +02:00
Patrick Walton
0b7dd0d918 rustc: Pass a node type table around, unused as of yet 2011-05-12 16:41:55 -07:00
Graydon Hoare
5ceaf345ed Add stats option and lazily emit glue. 2011-05-12 15:42:51 -07:00
Marijn Haverbeke
3816e57fd2 Downcase std modules again, move to :: for module dereferencing
This should be a snapshot transition.
2011-05-12 21:30:44 +02:00
Marijn Haverbeke
358a1aeec9 Keep resolve data in external hash table, rather than embedded defs
One step closer to removing fold and having a single, immutable AST.
Resolve still uses fold, because it has to detect and transform
expr_field expressions. If we go through on our plan of moving to a
different syntax for module dereferencing, the parser can spit out
expr_field expressions, and resolve can move to walk.

(I am truly sorry for the things I did in typestate_check.rs. I expect
we'll want to change that to walk as well in the near future, at which
point it should probably pass around a context record, which could
hold the def_map.)
2011-05-12 15:40:21 +02:00
Brian Anderson
a459bcd127 Give the lexer a session so that it can fail more informatively 2011-05-11 23:04:16 -04:00
Marijn Haverbeke
7f222423b7 Use a const for crate-num-zero (ast.local_crate) 2011-05-11 12:59:34 +02:00
Patrick Walton
7da9101e11 rustc: Make -g not take an argument 2011-05-10 17:50:39 -07:00
Graydon Hoare
d6f1fcff6b Add --time-llvm-passes. 2011-05-10 16:10:08 -07:00
Marijn Haverbeke
a3ec0b1f64 Rename std modules to be camelcased
(Have fun mergining your stuff with this.)
2011-05-06 22:51:19 +02:00
Kelly Wilson
b4a0d891c0 Ge the host triple using LLVM. Fix a few 'mutable' warnings also. 2011-05-06 11:30:39 -07:00
Graydon Hoare
1e03f00404 Use #env to bake a git revision string into rustc's --version output. 2011-05-06 11:21:51 -07:00
Graydon Hoare
f5f2f76339 Add --help, --version and -v flags (not yet supporting GIT_REV env var, waiting on snapshot). 2011-05-05 13:09:43 -07:00
Patrick Walton
fea623211f rustc: Add a Link module; move crate writing to it to slim down trans slightly 2011-05-05 10:48:02 -07:00
Patrick Walton
bde44a03a9 rustc: Detect the system root and allow the user to override if necessary 2011-05-04 19:27:54 -07:00
Graydon Hoare
cdb6822405 Add a structure for passing option flags around the compiler, put it in session, and use it. 2011-05-04 16:59:21 -07:00
Graydon Hoare
ce9468761c Support new -g flag, only mangle glue names by type when it's passed. 2011-05-04 15:36:42 -07:00
Graydon Hoare
b453c3c728 Start sketching --depend support in rustc. 2011-05-03 15:56:00 -07:00
Patrick Walton
ebc236e91c rustc: Time the Rust translation and LLVM passes separately 2011-05-02 17:50:46 -07:00
Brian Anderson
d88776726a rustc: Preserve dots in input path when using an implicit output path
This avoids outputing, e.g. /test.bc for ../test.rs
2011-05-01 14:42:45 -04:00
Patrick Walton
9aeb67987c rustc: Temporarily add a switch and a corresponding makefile variable to disable typestate 2011-04-29 12:16:14 -07:00
Patrick Walton
adfacc5031 rustc: Add a --time-passes option 2011-04-29 11:55:20 -07:00
Patrick Walton
c52fb52fbc rustc: Remove the wrong-compiler warning; we're self-hosting now. 2011-04-29 10:23:53 -07:00
Patrick Walton
171883f437 rustc: Only use color if it's supported 2011-04-28 14:59:16 -07:00
Tim Chevalier
2c3808b511 Enable typestate_check
This was supposed to be in a previous commit. I don't know what happened.
2011-04-28 13:26:19 -07:00
Tim Chevalier
34dae82b48 Add a session field to ty_ctxt and change an err to span_err
I changed instantiate to print out a more helpful error message,
which required passing it a session argument. To avoid
threading extra arguments through a lot of functions,
I added a session field to ty_ctxt.
2011-04-28 13:26:19 -07:00
Patrick Walton
91fe4ae090 rustc: Joseph and the Amazing Technicolor Error Messages 2011-04-28 10:51:12 -07:00
Marijn Haverbeke
6b11f6c46f Change rustc to use GetOpts rather than ad-hoc command-line parsing
NOTE: all 'long' parameters now use a double dash, so --shared, rather
than gcc-style -shared.
2011-04-26 20:32:14 +02:00
Patrick Walton
e0479c902b rustc: Add a -save-temps option to save bitcode and write output simultaneously; document command line switches 2011-04-25 14:08:12 -07:00
Patrick Walton
e102413aad rustc: Pass a "type context" around instead of directly passing the type store; prep for removing type annotations 2011-04-25 12:15:55 -07:00
Patrick Walton
5dbf554bb3 rustc: Pass a type store around, which does nothing yet 2011-04-21 14:30:27 -07:00
Patrick Walton
1080ac5349 rustc: Add a -noverify option 2011-04-19 18:31:27 -07:00