Commit graph

384 commits

Author SHA1 Message Date
Patrick Walton
219cd4b21f stdlib: Change ivec::rustrt::ivec_on_heap() to use a 32-bit return value 2011-07-05 15:34:50 -07:00
Marijn Haverbeke
6fd6fdea93 Move everything syntax-related to syntax/, break deps on rest of compiler
src/comp/syntax is currently just a sub-module of rustc, but it will,
in the near future, be its own crate. This includes:

 - The AST data structure
 - The parser
 - The pretty-printer
 - Visit, walk, and fold
 - The syntax extension system
 - Some utility stuff that should be in the stdlib*

*) Stdlib extensions currently require a snapshot before they can be
   used, and the win build is very broken right now. This is temporary
   and will be cleaned up when one of those problems goes away.

A lot of code was moved by this patch, mostly towards a more organized
layout. Some package paths did get longer, and I guess the new layout
will take some getting used to. Sorry about that!

Please try not to re-introduce any dependencies in syntax/ on any of
the other src/comp/ subdirs.
2011-07-05 15:57:21 +02:00
Patrick Walton
001397da3c stdlib: Add ivec::any() and ivec::all(); put out burning tinderbox 2011-07-04 23:52:47 -07:00
Patrick Walton
f71c8dd918 stdlib: Implement interior vector map 2011-07-04 22:48:42 -07:00
Patrick Walton
d3a4102bc1 stdlib: Add an inefficient implementation of ivec::pop 2011-07-04 21:20:18 -07:00
Patrick Walton
b4465aca5a stdlib: Fix long line in sort.rs 2011-06-30 22:21:30 -07:00
Patrick Walton
4c76bfdc1f stdlib: Add an interior vector version of sort and a test case 2011-06-30 19:09:52 -07:00
Brian Anderson
64d6081429 Use attributes for conditional compilation in std.rc 2011-06-30 14:13:49 -07:00
Tim Chevalier
a0cdb23892 Get rid of an unused variable 2011-06-30 12:37:30 -07:00
Eric Holk
b4a145e60f Added a nanosecond timer to time.rs, support for some floating point casts, and a commandline-driven mode for pfib.rs 2011-06-30 11:32:10 -07:00
Eric Holk
63dcd325b9 Adding support for pinning tasks to the currently running thread. Closes #598. 2011-06-29 18:47:47 -07:00
Lindsey Kuper
9155544a5a Comments. 2011-06-28 18:54:56 -07:00
Graydon Hoare
d79330de26 Fix logic bug in std::fs::dirname. 2011-06-28 17:24:30 -07:00
Brian Anderson
a83b64d15d Rework how linkage attributes are determined
The meta items within a crate's link attribute are used in linkage:

 #[link(name = "std",
        vers = "1.0",
        custom = "whatever")];

Name and vers are treated specially, and everything else is hashed together
into the crate meta hash.

Issue #487
2011-06-28 15:25:47 -07:00
Patrick Walton
7554423423 stdlib: Remove old botch from ufind 2011-06-28 14:16:09 -07:00
Paul Stansifer
c3901cdf8e Add simple syntax extension (#simplext) 2011-06-28 15:02:12 +00:00
Rafael Ávila de Espíndola
ecc080ed0b Use "" in the native_name as an indication that no extra options have to
be passed to the "linker". Use that for libc.
2011-06-28 08:21:13 -04:00
Rafael Ávila de Espíndola
ac081c30be Record and link with used native libraries. 2011-06-27 15:24:44 -04:00
Tim Chevalier
582e1f13f0 Invalidate constraints correctly after an assignment expression
Modified typestate to throw away any constraints mentioning a
variable on the LHS of an assignment, recv, assign_op, or on
either side of a swap.

Some code cleanup as well.
2011-06-24 22:36:53 -07:00
Marijn Haverbeke
d507d5fe91 Remove res idents from stdlib 2011-06-24 21:13:26 +02:00
Tim Chevalier
7fb35ecf84 Serialize constraints in types (literal arguments still not supported)
This involved, in part, changing the ast::def type so that a def_fn
has a "purity" field. This lets the typechecker determine whether
functions defined in other crates are pure.

It also required updating some error messages in tests. As a test
for cross-crate constrained functions, I added a safe_slice function
to std::str (slice(), with one of the asserts replaced with a
function precondition) and some test cases (various versions of
fn-constraint.rs) that call it. Also, I changed "fn" to "pred" for
some of the boolean functions in std::uint.
2011-06-21 14:37:33 -07:00
Brian Anderson
200dbe4c4f Remove various rustboot workarounds 2011-06-19 20:48:20 -07:00
Patrick Walton
3f7380ccec rustc: Change smallintmap to use an ivec and use it for the node type table. 3x typechecking speedup. 2011-06-19 18:03:19 -07:00
Brian Anderson
f58de2d687 Replace unexported meta tags with attributes
Issue #487
2011-06-18 20:23:05 -07:00
Patrick Walton
ca2ff9c50d stdlib: Add ivec::grow_set() 2011-06-18 16:41:09 -07:00
Patrick Walton
5d90b1df4b stdlib: Add ivec::grow() and ivec::grow_fn() 2011-06-18 16:29:45 -07:00
Patrick Walton
b2bcafe6fd stdlib: Add some more ivec functions, untested as of yet 2011-06-17 19:16:26 -07:00
unknown
8c6354ceb9 Made sure getcwd and friends work well on Windows. 2011-06-17 15:53:21 -07:00
Eric Holk
a40116b398 stdlib: added getcwd and a convenience function to make relative paths absolute. This will be helpful for #441. 2011-06-17 15:53:19 -07:00
Brian Anderson
6e6bc5076c rustc: Support both meta tags and attributes for crate metadata
This is a transitional patch for converting from 'meta' to attributes.

Issue #487
2011-06-17 15:07:34 -07:00
Patrick Walton
d47101703e stdlib: Sketch out ivec::init_fn, currently segfaulting 2011-06-16 17:48:59 -07:00
Patrick Walton
40746fa447 rustc: Implement conversions from interior vector data to unsafe pointers and vice-versa 2011-06-16 17:07:02 -07:00
Graydon Hoare
b84fffaa4e Reformat a bunch of recent churn. 2011-06-16 16:55:46 -07:00
Patrick Walton
050f62983d stdlib: Introduce an ivec module into the standard library; add a minimal test case 2011-06-16 16:08:26 -07:00
Brian Anderson
0efd7fac8a stdlib: Add option::is_some 2011-06-16 14:21:42 -07:00
Eric Holk
c4f9bd9470 Re-enabled join. 2011-06-15 18:16:59 -07:00
Michael Sullivan
a91d301b31 Add xterm to the term lib's list of supported terms. 2011-06-15 17:33:37 -07:00
Brian Anderson
f50fd6d8ae stdlib: Add color support for GNU screen 2011-06-15 16:38:17 -07:00
Brian Anderson
c19a026f46 stdlib: Add emacs variables to term.rs 2011-06-15 16:28:14 -07:00
Brian Anderson
b8a5440b2d stdlib: Add an either module
Like Haskell's, with left and right tags, various conversion functions
2011-06-15 15:45:41 -07:00
Marijn Haverbeke
b2b8002fd3 Fix unsafe uses of aliases in tail calls 2011-06-15 21:39:27 +02:00
Graydon Hoare
766d54df93 Fix a bunch of compile-command lines to use RBUILD 2011-06-15 12:01:19 -07:00
Graydon Hoare
7e806c5e87 Attempt to put out windows tinderbox. 2011-06-15 11:39:31 -07:00
Graydon Hoare
ce72993488 Reformat source tree (minus a couple tests that are still grumpy). 2011-06-15 11:19:50 -07:00
Marijn Haverbeke
5fb518abc9 Fix assignments to immutable fields throughout the code 2011-06-15 14:10:07 +02:00
Eric Holk
d1857d30fc This is the mega-ucontext commit. It replaces the task switching mechanism with a new one inspired by ucontext. It works under Linux, OS X and Windows, and is Valgrind clean on Linux and OS X (provided the runtime is built with gcc).
This commit also moves yield and join to the standard library, as requested in #42. Join is currently a no-op though.
2011-06-13 18:14:13 -07:00
Brian Anderson
10a4ecbd96 stdlib: Remove a FIXME for issue #452 2011-06-11 00:42:52 +00:00
Graydon Hoare
52c4c9014f Encode meta tags in the crate and start sketching enhanced logic for resolving crate "use" directives.
Now with extra "works on OSX" kludging.
2011-06-10 12:57:29 -07:00
Patrick Walton
dfdd6dbc54 rustc: Remove the bitwise not operator 2011-06-10 10:47:33 -07:00
Marijn Haverbeke
f28796ed99 Fix unsafe uses of mutable references 2011-06-10 16:44:32 +02:00
Marijn Haverbeke
798bbd2e22 Fix all occurrences of writing to immutable aliases
You'd be surprised.
2011-06-10 12:15:28 +02:00
Tim Chevalier
17ff2a0d79 Further support for predicate constraints
Changed function types to include a list of constraints. Added
code for parsing and pretty-printing constraints. This necessitated
splitting pprust into two files (pprust and ppaux) to break a
circulate dependency, as ty_to_str now needs to print out constraints,
which may include literals, but pprust depended on ty.
2011-06-09 11:37:52 -07:00
Patrick Walton
80f86d1e9b stdlib: Make union-find not create loops when unifying two already-unified sets 2011-06-09 10:51:51 -07:00
Marijn Haverbeke
537d879dc1 Properly handle lifetime of aliases in nested blocks
There was a bug that would cause the alias analyser to allow you to
invalidate an alias that was no longer directly referred to, even if
another alias was rooted in it. It now properly tracks dependencies
between live aliases.

Required another case of copying values in map.rs.
2011-06-09 14:19:13 +02:00
Marijn Haverbeke
43fbb07126 Add vec::member 2011-06-09 13:11:28 +02:00
Marijn Haverbeke
77c1b9650f Some more workarounds to please the alias checker
Some of the vec utilities now only work on immutable vecs, since they
would have to be rewritten to do a lot more copying to be alias-safe.

Some forced copying was added to map.rs, showing a weakness in the
alias checker (or maybe the alias system): when fn args are passed
into a function, calling them must assume all aliases that are not
immutably rooted (directly connected to a local or temporary without
any mutable edges) become invalid. This will be a drag on functional
programming in Rust.

Work around alias issues in the stdlib
2011-06-09 13:08:39 +02:00
Graydon Hoare
8691a1a1e5 Tidy up 'export meta' situation now that snapshot understands it. 2011-06-08 15:58:03 -07:00
Patrick Walton
ddec6b5f47 rustc: Use a set-based approach to unification; remove ty_bound_param and ty_local.
Sorry, big perf regression; will fix soon.
2011-06-07 19:33:18 -07:00
Graydon Hoare
721c5bbee8 More work on proper linkage name-mangling. Almost right, aside from version numbers. 2011-06-07 18:08:17 -07:00
Graydon Hoare
319156c8d1 Begin tidying up name-mangling rules. 2011-06-06 15:48:47 -07:00
Brian Anderson
53ea2a4751 stdlib: Use spans for #fmt errors originating in std
Issue #444
2011-06-04 19:48:19 -04:00
Patrick Walton
cb4c969ba6 rustc: Add a "smallintmap" implementation 2011-06-03 16:15:14 -07:00
Marijn Haverbeke
5144f790fe Fix and un-xfail vec-append test 2011-06-02 16:45:26 +02:00
Patrick Walton
8c3809afd0 stdlib: Add some functions to getopts to deal with optional arguments more easily 2011-06-01 18:32:05 -07:00
Paul Stansifer
9f5dddf08c Now imports are not re-exported unless 'export' is explicitly used. 2011-05-31 18:43:26 -07:00
Brian Anderson
ed0eb8f45a stdlib: Remove unneeded type params from alt patterns 2011-05-31 01:23:53 -04:00
Paul Stansifer
3375b8fba2 Add list function 'has'. 2011-05-27 02:42:33 +00:00
Paul Stansifer
22953f52fa Added filter_map. 2011-05-27 02:42:33 +00:00
Tim Chevalier
83cdb47a7c Add a list append function, which I didn't end up using, but why not add it? 2011-05-26 19:13:56 -07:00
Kelly Wilson
31de8e15c0 Add quick_sort3 function based on 'QuicksortIsOptimal.pdf' (see comments in file). Cleanup the quick_sort function a little, as well. Add test file. 2011-05-24 18:38:41 -04:00
Brian Anderson
8637c09cf9 stdlib: Make the bound vector an alias in std::deque
Workaround for issue #375
2011-05-23 19:45:51 -04:00
Brian Anderson
837dff9226 stdlib: Export match type from std::getopts 2011-05-22 16:41:06 -04:00
Brian Anderson
c1122a6707 stdlib: Use if/alt expressions in std::uint 2011-05-22 12:28:27 -04:00
Brian Anderson
1ecd6a82ab stdlib: Use if/alt expressions in std::str 2011-05-22 12:28:27 -04:00
Brian Anderson
443e1e4557 stdlib: Use if/alt expressions in std::option 2011-05-22 12:28:27 -04:00
Brian Anderson
820ccf4a13 stdlib: Do tail calls in std::map. Remove FIXMEs 2011-05-22 12:28:20 -04:00
Brian Anderson
2d17d9101d stdlib: Use if/alt expressions in std::map 2011-05-22 12:28:20 -04:00
Brian Anderson
f1c1887cab stdlib: Remove unneeded fail statements from std::list. Remove FIXMEs 2011-05-22 12:28:14 -04:00
Brian Anderson
f6beec6c43 stdlib: Do tail calls in std::list. Remove FIXMEs 2011-05-22 12:28:08 -04:00
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