Commit graph

305 commits

Author SHA1 Message Date
Brian Anderson
b4c9f782e4 stdlib: Add list::from_vec 2011-05-22 02:10:10 -04:00
Brian Anderson
1e9aef828c stdlib: Reindent list.rs 2011-05-22 02:10:10 -04:00
Brian Anderson
d4f5f69930 stdlib: Use if/alt expressions in std::io 2011-05-22 02:10:10 -04:00
Brian Anderson
d4da3f5172 stdlib: Use if/alt expressions in std::int 2011-05-22 02:10:09 -04:00
Brian Anderson
d85447c4fb stdlib: Use initial caps for all error messages in std::getopts 2011-05-22 02:10:09 -04:00
Brian Anderson
3a2d64f044 stdlib: Use if/alt expressions in std::getopts 2011-05-22 02:10:09 -04:00
Brian Anderson
a0f855e488 stdlib: Report an error when getopts is given an argument to a flag option 2011-05-22 02:10:09 -04:00
Brian Anderson
c1a6c2e6c2 stdlib: Only export what's necessary from std::getopts 2011-05-22 02:10:09 -04:00
Brian Anderson
264c3b5be4 stdlib: Use if/alt expressions in std::generic_os 2011-05-22 02:10:09 -04:00
Brian Anderson
da0e961f61 stdlib: Use if/alt expressions in std::fs 2011-05-22 02:10:09 -04:00
Brian Anderson
85bcf75da1 stdlib: Add regression test for fs::connect and a FIXME 2011-05-22 02:10:09 -04:00
Brian Anderson
0755a30051 stdlib: Use if/alt expressions in std::deque 2011-05-22 02:10:08 -04:00
Brian Anderson
6432599c5d stdlib: Use if/alt expressions in std::bitv 2011-05-22 02:10:08 -04:00
Brian Anderson
90e6453f46 stdlib: Use if/alt expressions in std::extfmt 2011-05-22 02:10:08 -04:00
Brian Anderson
01c13a3878 stdlib: Add io::writer.write_line 2011-05-20 22:32:41 -04:00
Brian Anderson
fc8b9671bb stdlib: Export only what's needed from std::bitv 2011-05-20 22:12:57 -04:00
Brian Anderson
04ce99b83c stdlib: Export only what's needed from std::sort 2011-05-20 22:12:16 -04:00
Brian Anderson
7817824205 stdlib: export ptr_eq from box, but not rustrt 2011-05-20 21:32:57 -04:00
Patrick Walton
4eb476fc75 stdlib: Modify union-find to guarantee that root nodes are always less than or equal to leaf nodes; add a "prune" method 2011-05-20 15:50:43 -07:00
Eric Holk
5d09e12e15 Added two version of reverse and a swap function to the standard library. 2011-05-19 17:25:37 -07:00
Patrick Walton
6b95584df5 stdlib: Add vec growth functions that use a thunk to initialize elements 2011-05-19 16:07:12 -07:00
Tim Chevalier
e16b097599 Rewrite tstate.annotate to use walk instead of fold
and various other tidying in typestate
2011-05-19 11:40:16 -07:00
Tim Chevalier
ea1701de8c Add a set_all function in bitv that's the inverse of clear 2011-05-19 11:40:16 -07:00
Patrick Walton
6417610788 rustc: Generalize variable bindings so that we can use it for locals too 2011-05-19 11:14:44 -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
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
Brian Anderson
63cf381ca1 stdlib: Remove transitional extfmt.RT module 2011-05-17 00:58:52 -04:00
Graydon Hoare
fbbc1a77d2 Rewrite everything to use [] instead of vec() in value position. 2011-05-16 18:21:22 -07:00
Marijn Haverbeke
57ffa2a487 Make the parser more careful about keywords
Keywords are now only recognized in contexts where they are valid. The
lexer no longer recognizes them, all words are lexed as IDENT tokens,
that get interpreted by the parser.
2011-05-13 22:00:13 +02: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
Brian Anderson
02fdd2d2d9 Rename std.extfmt.CT to std.extfmt.RT to ct and rt
Temporarily duplicate the entire RT module, leaving it with the old name to
accomodate the stage0 compiler. Will be removed after the next snapshot.
2011-05-12 22:22:28 -04: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
88621bc53c Remove a few more 'mutable' words
Didn't see these before because they live in non-Linux code.
2011-05-11 15:39:39 +02:00
Marijn Haverbeke
e9c12ab1d0 Rewrite comp/middle/resolve.rs
* Cleans up the algorithm
 * Move first pass to walk (second still folds)
 * Support part of a type/value namespace split
   (crate metadata and module indices still need to be taught about this)
 * Remove a few blatant inefficiencies (import tables being recreated for
   every lookup, most importantly)
2011-05-11 12:32:37 +02:00
Brian Anderson
e4c3287367 Reuse a single work buffer every time the SHA1 message block is processed.
This finally allows the full lib-sha1 test to run in a reasonable amount of
time. Was 30s, now 3s. Trims a second or two from stage2/rustc. XFAIL lib-sha1
in stage0 since it will be very slow until the next snapshot.
2011-05-11 01:38:17 -04:00
Brian Anderson
7e7d134e3c Remove unnecessary array access from SHA1
Provides a very small speedup.
2011-05-11 01:38:17 -04:00
Brian Anderson
e35984b6c6 Introduce str_slice runtime function
This reduces the time to execute the new lib-str tests from 1:40ish to a few
seconds and will eventually allow the full lib-sha1 test to run in a
reasonable amount of time. XFAIL lib-str in stage0 - it will run very slowly
until the next snapshot.
2011-05-11 01:38:16 -04:00
Patrick Walton
869e9017eb rustc: Create mutable vectors in macos_OS.rs. Should put out Darwin tinderbox. 2011-05-10 17:50:39 -07:00
Graydon Hoare
4b5b96c511 Remove a couple more spurious 'mutable' value qualifiers from macos_OS.rs. 2011-05-10 17:04:41 -07:00
Patrick Walton
813636d52e stdlib: Remove Str.unsafe_from_mutable_bytes(). rustc now self-hosts 18 seconds faster. 2011-05-10 15:20:36 -07:00
Graydon Hoare
10a2093d37 Failure to re-stage changes strikes again. 2011-05-06 16:54:50 -07:00
Graydon Hoare
0f23bbac01 Fix GenericOS.getenv returning a raw str, return an Option.t[str] instead. 2011-05-06 16:30:39 -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
Kelly Wilson
850dff486e Add quick sort function to the std lib. 2011-05-05 16:40:57 -07:00
Graydon Hoare
50ac893b00 Attempt to fix fs.dirname harder. 2011-05-05 14:31:45 -07:00
Graydon Hoare
2131f2bb6b Because good hackers at least check to see if the code compiles. 2011-05-05 13:53:57 -07:00
Graydon Hoare
c80255e510 Fix assumption that only os_fs.path_sep can separate paths, sigh. 2011-05-05 13:42:52 -07:00
Marijn Haverbeke
1f45dda9d2 Remove 'deprecated mutable...' from our code
This should make compilation a bit less noisy.
2011-05-05 20:19:43 +02:00
Patrick Walton
147a2d655f Un-revert "Use different syntax for checks that matter to typestate", fixing the problem.
This reverts commit d08b443fff.
2011-05-02 17:50:46 -07:00
Graydon Hoare
d08b443fff Revert "Use different syntax for checks that matter to typestate"
This reverts commit aa25f22f19. It broke stage2, not sure why yet.
2011-05-02 17:35:33 -07:00
Tim Chevalier
aa25f22f19 Use different syntax for checks that matter to typestate
This giant commit changes the syntax of Rust to use "assert" for
"check" expressions that didn't mean anything to the typestate
system, and continue using "check" for checks that are used as
part of typestate checking.

Most of the changes are just replacing "check" with "assert" in test
cases and rustc.
2011-05-02 12:16:29 -07:00
Patrick Walton
5d3e553141 stdlib: Add a Time module to the standard library 2011-04-29 11:54:06 -07:00
Patrick Walton
66e5dfbde6 stdlib: Provide "array" as a friendlier shorthand for "vec[mutable? T]" 2011-04-28 17:15:32 -07:00
Patrick Walton
660c742902 stdlib: Add a color_supported() function to Term 2011-04-28 14:54:00 -07:00
Patrick Walton
5f60937318 stdlib: Add getenv(3) to win32_os. 2011-04-28 14:35:22 -07:00
Tim Chevalier
7c4f8cb459 Further work on typestate_check
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.

* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)

* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.

* Pass poststate correctly through a stmt_decl.

* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)

* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias

* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)

* Update logging to reflect log_err vs. log

* Fixed find_locals so as to return all local decls and exclude
function arguments.

* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)

* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones

* Added two test cases.
2011-04-28 13:26:19 -07:00
Patrick Walton
616ae95f6b stdlib: Use an unsafe cast to speed up the memory writer 2011-04-27 18:18:28 -07:00
Patrick Walton
180a389832 stdlib/rt: Add an unsafe function to cast immutable vectors to mutable ones 2011-04-27 18:14:56 -07:00
Graydon Hoare
4c7886de80 Fix _str.bytes to trivial version. 2011-04-27 13:06:19 -07:00
Patrick Walton
fef8314c2e stdlib: Real fix for _uint.parse_buf(). 2011-04-27 11:59:22 -07:00
Patrick Walton
73044b3455 stdlib: Fix a crazy underflow bug in _uint.parse_buf. Oops. 2011-04-27 11:49:06 -07:00
Brian Anderson
8216b5fc10 Fix the interaction between various flags in #fmt 2011-04-26 20:49:03 -04:00
Brian Anderson
2e12fbfc06 Support octal #fmt conversions 2011-04-26 20:20:17 -04:00
Brian Anderson
66b59e4b05 Make #fmt char conversions behave like printf 2011-04-26 20:20:17 -04:00
Patrick Walton
79d27ccb58 stdlib: Add a silly ANSI color library 2011-04-26 13:08:48 -07:00
Marijn Haverbeke
74c7457131 Add GetOpts module to std 2011-04-26 20:30:44 +02:00
Marijn Haverbeke
d0ed2e384a Add _str.slice to std lib 2011-04-26 17:38:14 +02:00
Graydon Hoare
5fe21b5af0 Skip likely-zero initial probe, speed up map.rs. 2011-04-25 04:12:33 +00:00
Graydon Hoare
d3eb3b42aa Minimize calls to hash function in map.rs 2011-04-22 01:06:20 -07:00
Patrick Walton
735435bf96 stdlib: Add a pointer equality function to the standard library and a test case 2011-04-21 16:44:17 -07:00
Tim Chevalier
b7dd75c904 Handle nested items correctly in typestate_check
Summary says it all. Actually, only nested objects and functions
are handled, but that's better than before. The fold that I was using
before to traverse a crate wasn't working correctly, because annotations
have to reflect the number of local variables of the nearest enclosing
function (in turn, because annotations are represented as bit vectors).
The fold was traversing the AST in the wrong order, first filling in
the annotations correctly, but then re-traversing them with the bit
vector length for any outer nested functions, and so on.

Remedying this required writing a lot of tedious boilerplate code
because I scrapped the idea of using a fold altogether.

I also made typestate_check handle unary, field, alt, and fail.

Also, some miscellaneous changes:
* added annotations to blocks in typeck
* fix pprust so it can handle spawn
* added more logging functions in util.common
* fixed _vec.or
* added maybe and from_maybe in option
* removed fold_block field from ast_fold, since it was never used
2011-04-19 14:56:28 -07:00
Graydon Hoare
3d9cf15d0b Remove half-baked 'opacity' layer qualifier. 2011-04-19 14:00:04 -07:00
Graydon Hoare
d2bd07dcb0 Remove effect system from src. 2011-04-19 13:35:49 -07:00
Marijn Haverbeke
6511d471ba replace error logging with log_err in stdlib and rustc 2011-04-19 16:57:13 +02:00
Brian Anderson
7f90000ab6 Precision overrides 0-padding in #fmt 2011-04-18 22:53:26 -04:00
Brian Anderson
59d5267936 Rearrange ExtFmt.RT.pad to recover some horizontal space 2011-04-18 21:36:04 -04:00
Brian Anderson
869b28e393 Left-justification overrides 0-padding in #fmt 2011-04-18 21:36:04 -04:00
Brian Anderson
d4f1a48111 Support 0 flag in #fmt 2011-04-18 21:36:04 -04:00
Brian Anderson
9976bb93d6 Support the space flag in #fmt 2011-04-17 19:50:58 -04:00
Brian Anderson
86a43c24d6 Support + flag in #fmt 2011-04-17 18:19:26 -04:00
Brian Anderson
1bec738c56 Support #fmt precision for bools, with same rules as strings
Not totally confident this is desirable. The alternative would be to make it a
compile error.
2011-04-17 17:24:17 -04:00
Brian Anderson
685e820465 Treat char #fmt conversions just like str conversions
Add missing tests
2011-04-17 17:06:55 -04:00
Brian Anderson
8f6603f58e Support #fmt precision for signed types 2011-04-17 16:51:17 -04:00
Brian Anderson
4c0aea69da Support #fmt precision for unsigned types 2011-04-17 16:18:25 -04:00
Brian Anderson
c7edcb3a72 Support #fmt precision for string types 2011-04-17 13:10:02 -04:00
Brian Anderson
96e3e29e88 Support left-justification in #fmt conversions 2011-04-16 19:43:29 -04:00
Brian Anderson
dcfdb02fab Make #fmt support explicit conversion widths 2011-04-16 18:01:17 -04:00
Patrick Walton
3e922e2ecf stdlib: Add some vector functions: empty, empty_mut, grow_set, and freeze. Change _vec.grow to use uint arguments. 2011-04-15 17:46:16 -07:00
Patrick Walton
ec5a60d5e2 rustc: Use union-find for variable substitution 2011-04-14 11:24:25 -07:00
Brian Anderson
99a697b56a Add support for upper-case hex and binary output to #fmt.
Only works for uints at present. Necessitated the addition of _str.to_upper.
2011-04-13 22:14:54 -04:00
Brian Anderson
5c0f4c1939 Add more commentary about ExtFmt 2011-04-13 22:14:40 -04:00
Brian Anderson
4844e1c08a Add support for printing uints as lower-case hex to ExtFmt.
Begin passing an ExtFmt.RT.conv parsed format description to each of the
ExtFmt.RT.conv* functions.
2011-04-13 22:14:24 -04:00
Brian Anderson
aebdef0cd6 Move #fmt conversion model into ExtFmt.CT namespace 2011-04-13 22:13:21 -04:00
Tim Chevalier
7c6e6fc5d4 Make expr_while work in typestate_check
Also did some refactoring in typestate_check. All test cases in
compile-fail that involve uninitialized vars now fail correctly!
(All eight of them, that is.)
2011-04-13 15:50:34 -07:00
Graydon Hoare
80a4b1ba53 Slight updates to match API drift in io, lib-io.rs passes. 2011-04-13 12:05:15 -07:00
Tim Chevalier
d7e8818414 Further work on typestate. Handles expr_rec and expr_assign now.
Also changed the ts_ann field on statements to be an ann instead,
which explains most of the changes.

As well, got rid of the "warning: no type for expression" error
by filling in annotations for local decls in typeck (not sure whether
this was my fault or not).

Finally, in bitv, added a clone() function to copy a bit vector,
and fixed is_true, is_false, and to_str to not be nonsense.
2011-04-12 14:31:46 -07:00
Brian Anderson
73eecbd0ca Factor out creation of calls into ExtFmt.RT 2011-04-11 21:55:03 -04:00
Brian Anderson
bba245f3e6 Add support for bool, char to extfmt.
XFAIL syntax-extension-fmt in rustboot.
2011-04-11 21:54:03 -04:00