Commit Graph

3373 Commits

Author SHA1 Message Date
Eric Holk
64596e6583 Teach the parser and typechecker to understand port[int](). Closes #588 2011-06-28 16:11:04 -07:00
Brian Anderson
1c6ae8cadf Use span_fatal for failure to find crates 2011-06-28 16:04:09 -07:00
Brian Anderson
46b83a92d6 Add test case for non-matching crate metadata in use statements 2011-06-28 15:58:22 -07:00
Brian Anderson
8ac60e99ea Extract meta_item sorting from back::link to middle::attr 2011-06-28 15:46:09 -07:00
Brian Anderson
aecc5e6e0f Add comments to middle::attr. Issue #487 2011-06-28 15:34:27 -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
Brian Anderson
0608e277b6 Add some helper functions for attributes. 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
Tim Chevalier
d832f7abec Another test for typestate and expr_fn 2011-06-28 13:14:52 -07:00
Tim Chevalier
28459ca0eb Handle lazy binops properly in typestate
The typestate analysis now reflects that the second operand of a
logical and or or may not be evaluated.
2011-06-28 13:07:52 -07:00
Tim Chevalier
a7c4c19d4b add a predicate that determines whether a binop is lazy (and and or are lazy) 2011-06-28 13:07:52 -07:00
Rafael Ávila de Espíndola
d5fc01caef Move glue.o to stageN/lib. 2011-06-28 15:20:43 -04:00
Tim Chevalier
926049eddd Tests only: more tests with constraints and loops 2011-06-28 11:49:11 -07:00
Patrick Walton
1ca0db5421 rustc: Add a "type-owns-heap-mem" cache. 2x translation speedup. 2011-06-28 11:36:11 -07:00
Patrick Walton
5f5b7e3348 rustc: Don't call cmp glue if the type is a simple scalar 2011-06-28 11:24:34 -07:00
Graydon Hoare
0dc2aa3d09 Bit more work on mingw cross. Pending on other changes now (test combination, build artifact locations) 2011-06-28 11:18:34 -07:00
Brian Anderson
cab73f8897 Write metadata for more meta_item types. Issue #487 2011-06-28 10:12:05 -07:00
Brian Anderson
f53c4f79d7 Write metadata for crate attributes. Issue #487 2011-06-28 10:03:41 -07:00
Brian Anderson
894e2229ac Add emacs variables to encoder.rs 2011-06-28 10:03:40 -07:00
Brian Anderson
d328c7e03e List crate attributes when running rustc with '--ls' 2011-06-28 10:03:40 -07:00
Marijn Haverbeke
9561def209 Use 'resource' rather than 'res' as a keyword
Resources are now defined like...

    resource fd(int n) { close(n); }

Calling fd with an int will then produce a non-copyable value
that, when dropped, will call close on the given int.
2011-06-28 18:00:39 +02:00
Marijn Haverbeke
fb14afd5eb Add test cases for resources 2011-06-28 18:00:38 +02:00
Marijn Haverbeke
07125aa38b Fix bug that prevented boxes-in-resources from being freed 2011-06-28 18:00:05 +02:00
Marijn Haverbeke
e2cb97a2fc Add some missing cases for ty_res in ty.rs 2011-06-28 18:00:05 +02:00
Marijn Haverbeke
d730bb730a Make it possible to use * to dereference a resource 2011-06-28 18:00:05 +02:00
Paul Stansifer
b3443eb049 '#simplext' -> '#macro' 2011-06-28 15:02:12 +00:00
Paul Stansifer
c3901cdf8e Add simple syntax extension (#simplext) 2011-06-28 15:02:12 +00:00
Paul Stansifer
b632681780 Add AST fold. 2011-06-28 15:02:12 +00:00
Marijn Haverbeke
be748fc215 Properly guard resource values against double-drop
Ths involved adding an extra field to their representation, so that there is
something to check for zero.
2011-06-28 16:14:15 +02: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
Patrick Walton
663aa76635 rustc: Call cmp glue directly if we statically know it 2011-06-27 18:35:01 -07:00
Patrick Walton
dfccd5a138 rustc: Fix stack explosion on -O0 from Alloca() instead of alloca() in cmp glue 2011-06-27 18:27:26 -07:00
Tim Chevalier
85b5b2a8e4 Tests for while loops that may invalidate constraints
Wrote some small test cases that use while loops and moves, to
make sure the poststate for the loop body gets propagated into the
new prestate and deinitialization gets reflected.

Along with that, rewrite the code for intersecting states. I still
find it dodgy, but I guess I'll continue trying to add more tests.
Also, I'll probably feel better about it once I start formalizing
the algorithm.
2011-06-27 18:14:23 -07:00
Tim Chevalier
6d1050b1c7 pure_exp should set the state, not extend it
This fixes a bug where de-initializations were getting masked
(and programs that used a variable that had been de-initialized
snuck through).
2011-06-27 18:14:23 -07:00
Brian Anderson
a72481f90b Rename metadata::defs to metadata::tags 2011-06-27 16:43:50 -07:00
Brian Anderson
55944f4e7f Don't export some of the metadata modules 2011-06-27 16:38:57 -07:00
Brian Anderson
df2cfac07f Move what's left of metadata::cwriter into middle::trans 2011-06-27 16:30:27 -07:00
Brian Anderson
45efb1f02a Cleanup in metadata module 2011-06-27 16:30:27 -07:00
Brian Anderson
119193497e Extract metadata::decoder from metadata::creader 2011-06-27 16:30:27 -07:00
Brian Anderson
a3a2cc3d98 Extract metadata::tydecode from metadata::creader 2011-06-27 16:30:27 -07:00
Brian Anderson
33294c7293 Extract llvm-independent code from cwriter to metadata::encoder 2011-06-27 16:30:27 -07:00
Brian Anderson
279a229414 Move metadata tag definition to metadata::defs 2011-06-27 16:30:27 -07:00
Brian Anderson
6c23e09454 Limit exports from metadata::tyencode 2011-06-27 16:30:27 -07:00
Brian Anderson
5601a6f534 Move metadata::cwriter::encode to metadata::tyencode 2011-06-27 16:30:27 -07:00
Brian Anderson
ba5c7a570d Rename middle::metadata to metadata::cwriter. Move creader to metadata
Preparation for a lot more metadata refactoring
2011-06-27 16:30:27 -07:00
Brian Anderson
d4a5487e1c Limit exports from middle::metadata 2011-06-27 16:30:27 -07:00
Patrick Walton
e4b5d910dc rustc: Directly emit calls to glue if possible 2011-06-27 15:38:21 -07:00
Michael Sullivan
12d9d07a84 Improve the tests for vector self appending. 2011-06-27 12:34:45 -07:00
Michael Sullivan
99b4fff4d2 Properly handle the case where src==dst but we have to allocate a new vector. 2011-06-27 12:34:45 -07:00
Michael Sullivan
ec80918865 Add a test written by jdm that tests repeated vector self appending. 2011-06-27 12:34:45 -07:00
Michael Sullivan
8ad7f3b56b Properly handle the case where src==dst in upcall_vec_append. 2011-06-27 12:34:44 -07:00
Brian Anderson
36fb754476 Index obj and res ctor metadata by ctor id, not item id
Both the type and the ctor were trying to use the same id and this was making
creader unable to find the ctor when running 'rustc --ls'
2011-06-27 12:34:44 -07:00
Patrick Walton
b55277002b etc: Eliminate dyld valgrind errors on OS X 2011-06-27 12:34:13 -07:00
Rafael Ávila de Espíndola
ac081c30be Record and link with used native libraries. 2011-06-27 15:24:44 -04:00
Tim Chevalier
a6f36ba3f5 removing log statement that snuck in there 2011-06-27 11:38:07 -07:00
Tim Chevalier
1656fa19ef Implement move for scalar values
Before, something like:

let int y = 42;
let int x;
x <- y;

would cause an LLVM assertion failure. Fixed it.
2011-06-27 11:32:06 -07:00
Graydon Hoare
bc9fa31618 A little tidying in rt. 2011-06-27 10:08:57 -07:00
Eric Holk
022ebc198b Implementation mising features in lock_and_signal for Win32. Also lowered the minimum stack size to get the pfib benchmark to run without exhausting its address space on Windows. 2011-06-27 09:58:39 -07:00
Eric Holk
681c063ec0 Conservatively serialize nearly all upcalls. Successfuly ran make check with RUST_THREADS=8, so we're probably fairly safe now. In the future we can relax the synchronization to get better performance. 2011-06-27 09:58:39 -07:00
Eric Holk
6367bcf427 Fixed a few concurrency bugs. Still not perfect, but overall it seems much more reliable. 2011-06-27 09:58:39 -07:00
Eric Holk
4d99bf9af2 Added some locking to ports to prevent the case where two threads simultaneously wake up a task blocked on a certain port. 2011-06-27 09:58:39 -07:00
Eric Holk
cb00befff0 Added an environment variable to control how many threads to use. 2011-06-27 09:58:39 -07:00
Eric Holk
4bc773465f Basic multithreading support. The infinite loops test successfully maxes out the CPU. 2011-06-27 09:58:39 -07:00
Eric Holk
91eadfd1ea Added a parallel fibonacci program. It doesn't actually run in parallel yet, but it will give us something fun to test threading with. 2011-06-27 09:58:39 -07:00
Rafael Ávila de Espíndola
bea28ea537 Easy fix for using newer LLVMs: just use the MachOObjectFile.cpp they provide. 2011-06-27 11:52:23 -04:00
Brian Anderson
fcbdac96dd Update README files 2011-06-26 22:27:22 -07:00
Brian Anderson
f2d76bcd7d Remove src/run.py
This script is totally bitrotted
2011-06-26 22:01:32 -07:00
Brian Anderson
29a8219c4c Add a very simple map implementation for sequential integer keys
Use it for the ast_map. Cuts 40% off the time spent prior to LLVM.
2011-06-26 20:37:08 -07:00
Brian Anderson
08b49a5d8f Reformulate an assert in ty::tag_variants
This was doing a redundant hashmap lookup. Removing the redundancy trims 5%
(2.8s) off rustc's compile time
2011-06-26 18:02:47 -07:00
Brian Anderson
cfaa0f4b91 Fail typechecking for bad binop/type combinations
Includes assignment operations. Add regression tests for lots of less useful,
less used or unexpected combinations, as well as a selection of compile-fail
tests. Closes #500 (again!)
2011-06-25 19:42:59 -07:00
Brian Anderson
51d07830ba Add a test for mismatched types when comparing functions 2011-06-25 19:28:19 -07:00
Marijn Haverbeke
afa632124f Use single-bar or to make tstate/states.rs prettier
Sorry. This is the kind of thing I do when I'm on a plane and too
tired to manage anything that requires thinking.
2011-06-25 21:16:03 +02:00
Marijn Haverbeke
7432017d5e Primitive support for non-copyable values 2011-06-25 21:15:11 +02:00
Marijn Haverbeke
f6753be655 Allow moving out of temporary values
This will probably need more work, as moving doesn't appear to do
quite the right thing yet in general, and we should also check
somewhere that we're not, for example, moving out the content out of
an immutable field (probably moving out of fields is not okay in
general).
2011-06-25 21:15:11 +02:00
Marijn Haverbeke
61fc12d0d0 Partial implementation of resources
Non-copyability is not enforced yet, and something is still flaky with
dropping of the internal value, so don't actually use them yet. I'm
merging this in so that I don't have to keep merging against new
patches.
2011-06-25 21:15:11 +02:00
Marijn Haverbeke
781a265b88 Remove variable name 'res' from test suite 2011-06-25 21:15:04 +02:00
Tim Chevalier
c772269f08 Fix inexhaustive match in parser 2011-06-24 22:38:01 -07: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
Michael Sullivan
818d7c9398 Use visit_fn_{pre,post} to avoid going past lambdas during writeback instead of explicitly casing. 2011-06-24 15:55:08 -07:00
Michael Sullivan
4499ebe858 Add a test that tests typestate checking inside of fn exprs. 2011-06-24 15:46:20 -07:00
Michael Sullivan
b732ec6f82 Have walk call visit_fn_pre and visit_fn_post on fn expressions.
As a side effect, this fixes a bug where typestate would not properly be checked
inside of fn expressions.
2011-06-24 15:46:20 -07:00
Michael Sullivan
f3717da1b1 Modify the fn vistors in walk so that they can handle functions without names. Update the typestate code to understand this. 2011-06-24 15:46:20 -07:00
Paul Stansifer
142ff011da Make a test compile faster. 2011-06-24 14:47:36 -07:00
Patrick Walton
baf474443a rustc: Increment by the unit size in iter_structural_ty when iterating over interior vectors if the unit size is dynamic 2011-06-24 17:36:30 -04:00
Marijn Haverbeke
2ebd19477b Sanitize use of ids for obj constructors.
Typeck and trans used to, by historical coincidence, use the item_obj
node id, which was used to identify the obj type by the rest of the
system, for the constructor function. This is now identified by the
ctor id stored in the tag throughout.
2011-06-24 21:22:52 +02:00
Marijn Haverbeke
9643aedb04 Remove uses of variable name 'res' from rustc
This in preparation of making 'res' a keyword for defining resources.
Please don't introduce too many new ones in the meantime...
2011-06-24 21:22:23 +02:00
Marijn Haverbeke
d507d5fe91 Remove res idents from stdlib 2011-06-24 21:13:26 +02:00
Marijn Haverbeke
3d7fdb509a Remove def_obj
Since obj constructors and types have different def_ids now,
their def can simply be a def_fn and a def_ty.
2011-06-24 21:13:25 +02:00
Patrick Walton
b4c0893a39 rustc: If needed, duplicate types' heap parts recursively through structural types 2011-06-24 14:32:50 -04:00
Brian Anderson
1e7f06b17a test: Improve ternary operator tests 2011-06-23 23:27:32 -07:00
Brian Anderson
3aa8d7ff45 rustc: Pretty-print ternary operator 2011-06-23 23:14:40 -07:00
Brian Anderson
b9fc4dfc54 rustc: Cleanup trans_if, trans_alt 2011-06-23 22:16:16 -07:00
Brian Anderson
05c0216654 rustc: Add ternary operator. Closes #565
The implementation is so simple it might be considered cheating: at almost
every step the expr_ternary is just converted to expr_if.
2011-06-23 22:16:11 -07:00
Michael Sullivan
5495ad17d1 Fix type inference inside of anonymous functions. 2011-06-23 21:36:10 -07:00
Eric Holk
860e8fd98b Combined set_registers and get_registers into swap_registers. 2011-06-23 20:23:04 -07:00
Eric Holk
98dee91f25 Wrote swap_context in assembly. Closes #548. This also allows us to re-enable optimization on OSX for both gcc and clang. Also, re-enamed task-comm-1.rs, which was previously broken by optimization. 2011-06-23 18:49:29 -07:00
Rafael Ávila de Espíndola
3c534b2bef Remove parse_str_lit_or_env_ident.
We decided to use metadata for the more complex cases, and a simple
string is enough for rustc right now.
2011-06-23 18:42:55 -04:00
Graydon Hoare
14c31c26c2 Flesh out type pp code. 2011-06-23 18:40:44 -04:00
Patrick Walton
f3798fd213 rustc: Load immediate types when iterating over interior vectors 2011-06-23 17:43:03 -04:00
Tim Chevalier
3cf00c1577 Correct error message for argument mode mismatch
If you use a function expecting an alias argument in a context that
expects a function expecting a value argument, or vice versa, the
previous error message complained that the number of arguments was
wrong. Fixed the error message to be accurate.
2011-06-23 11:54:10 -07:00
Lindsey Kuper
5bd65de289 Typo fix in test case. 2011-06-23 10:47:29 -07:00
Tim Chevalier
9a48bd2f21 Compute typestate properly for move
typestate now drops constraints correctly in the post-state of
a move expression or a declaration whose op is a move. It doesn't
yet drop constraints mentioning variables that get updated.

To do this, I had to change typestate to use trit-vectors instead
of bit-vectors, because for every constraint, there are three
possible values: known-to-be-false (e.g. after x <- y, init(y) is
known-to-be-false), known-to-be-true, and unknown. Before, we
conflated known-to-be-false with unknown. But move requires them
to be treated differently. Consider:

(program a)
(a1) x = 1;
(a2) y <- x;
(a3) log x;

(program b)
(b1) x = 1;
(b2) y <- z;
(b3) log x;

With only two values, the postcondition of statement a2 for
constraint init(x) is the same as that of b2: 0. But in (a2)'s
postcondition, init(x) *must* be false, but in (b2)'s condition,
it's just whatever it was in the postcondition of the preceding statement.
2011-06-22 22:13:42 -07:00
Brian Anderson
7105cd1761 test: Add test for string matching in pattern alts. Closes #53 2011-06-22 22:05:11 -07:00
Brian Anderson
54566e9037 rustc: Convert field access on invalid types from an ICE to a fatal error
Closes #367
2011-06-22 21:31:32 -07:00
Lindsey Kuper
d9f452a2a8 Some work on supporting forwarding slots in vtables (issue #539). 2011-06-22 21:07:20 -07:00
Brian Anderson
523a088451 rustc: Use the rhs span when unifying binops
This makes the error message correctly identify the term that wasn't the
expected type. Issue #516.
2011-06-22 20:50:53 -07:00
Brian Anderson
ae234d61ea rustc: Remove some unneeded type annotations 2011-06-22 20:45:02 -07:00
Brian Anderson
d2b7ea877c rustc: Don't commit unification changes until unify succeeds
This is so that subsequent reports about type mismatches get the types
correct.

Issue #516
2011-06-22 20:43:50 -07:00
Brian Anderson
d9b56ec2ea rustc: Limit creader exports 2011-06-22 19:04:04 -07:00
Brian Anderson
ab98f16373 rustc: Downcase metadata::Encode 2011-06-22 18:09:53 -07:00
Brian Anderson
8746b84eec rustc: Handle valueless ret expressions as block results. Closes #521 2011-06-22 17:20:01 -07:00
Paul Stansifer
b4c3b83f26 Fix bug: globbed imports were importing everything visible from the other
module, not just everything exported.
2011-06-22 15:41:39 -07:00
Brian Anderson
adc18bb24a rustc: Introduce and parse additional meta_item forms
Examples: #[test], #[link(name = "vers")]

Issue #487
2011-06-22 13:55:58 -07:00
Rafael Ávila de Espíndola
64513808ca Use fast regalloc and codegen at OptLevel=0. 2011-06-22 16:50:30 -04:00
Brian Anderson
a6e188f8bf rustc: Rename parser.err to parser.fatal 2011-06-22 12:55:26 -07:00
Paul Stansifer
fe0925678c Remove a simidgeon of dead code. 2011-06-23 03:32:57 +08:00
Brian Anderson
cc2a514cdc test: Enable more tests 2011-06-22 08:35:02 -07:00
Michael Sullivan
7a4fb084f1 Pull environment loading out into a function. 2011-06-22 07:03:16 -07:00
Michael Sullivan
6b40cedcb1 Pull building the environment for for_each into a seperate function. 2011-06-22 07:03:16 -07:00
Michael Sullivan
c07443e6eb Removing out-of-date comment. 2011-06-22 07:03:15 -07:00
Tim Chevalier
1a6d029b07 Emit a better error message for unbound type parameters in nested functions
This code was causing a bounds check failure:

fn hd[U](&vec[U] v) -> U {
  fn hd1(&vec[U] w) -> U {
    ret w.(0);
  }
  ret hd1(v);
}

because in hd1, U was being treated as if it referred to a type
parameter of hd1, rather than referring to the lexically enclosing binding
for U that's part of hd.

I'm actually not sure whether this is a legit program or not. But I wanted
to get rid of the bounds check error, so I assumed that program shouldn't
compile and made it a proper error message.
2011-06-21 17:58:49 -07:00
Lindsey Kuper
efd8ff4647 Comments for all the anon obj tests. 2011-06-21 16:35:21 -07: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
Marijn Haverbeke
3b6d94d489 Move names and ids of native items into their recs, rather than their tags 2011-06-21 23:11:00 +02:00
Lindsey Kuper
26d8eaefa7 Puts out burning tinderbox (oops, AST nodes don't have def_ids/anns). 2011-06-21 14:07:28 -07:00
Lindsey Kuper
84005fadbf Some progress on support for extending objects with new fields (issue
into four separate issues (#538, #539, #540, #543) with corresponding
tests.
2011-06-21 13:31:27 -07:00
Lindsey Kuper
718ee98f43 More descriptive identifiers. 2011-06-21 13:31:27 -07:00
Marijn Haverbeke
c34e9b33d9 Move expr ids into the expr record type
This simplifies the tag variants a bit and makes expr_node_id
obsolete.
2011-06-21 22:25:32 +02:00
Brian Anderson
34040be580 test: Add a test for distinguishing attributes from extensions
Issue #487
2011-06-21 11:50:55 -07:00
Patrick Walton
c109c9dd73 rustc: Output an unimplemented message when alias encounters an unknown sequence type 2011-06-21 11:10:14 -04:00
Patrick Walton
062c6b946b rustc: Implement "for" over interior vectors 2011-06-21 11:10:14 -04:00
Brian Anderson
23d6a6bde1 rustc: Remove unused slice call from extfmt. Closes #532 2011-06-21 07:49:40 -07:00
Rafael Ávila de Espíndola
28d1626221 Remove the old library names. These were unused since rustboot.
Right now rustc hardcodes -lrustllvm. The idea is to instead remember all the native
modules used and convert them to -l directives to the linker. In the case of a
library that is installed in an unusual location, Graydon suggested using metadata:

native module foo = "bar" {
}
2011-06-20 18:09:24 -04:00
Rafael Ávila de Espíndola
2ad0954941 Merge remote branch 'upstream/master' 2011-06-20 17:58:37 -04:00
Rafael Ávila de Espíndola
a355505a5f Fix line length. 2011-06-20 17:57:29 -04:00
Marijn Haverbeke
56eb986584 Fix some uses of span_warn in alias.rs that should be span_fatal 2011-06-20 23:53:29 +02:00
Marijn Haverbeke
588dc3897b Make trans use the new ast_map instead of building its own 2011-06-20 23:53:28 +02:00
Marijn Haverbeke
854b3a9b73 Use ast_map in typeck, instead of building another index 2011-06-20 23:53:28 +02:00
Marijn Haverbeke
40db3aa6fb Add a separate AST mapping phase
This will replace the various node_id-to-node mappings done in several
other passes. This commit already uses the new map in resolve, dropping
the ast_map that was built there before.
2011-06-20 23:53:28 +02:00
Marijn Haverbeke
77af54bf6f Reduce confusing variable naming in resolve
'id' is now used for node_ids, 'name' for idents
2011-06-20 23:53:28 +02:00
Marijn Haverbeke
75681f9ad7 Get rid of def_ids and anns in AST nodes, use single node_id
This reduces some redundancy in the AST data structures and cruft in
the code that works with them. To get a def_id from a node_id, apply
ast::local_def, which adds the local crate_num to the given node_id.
Most code only deals with crate-local node_ids, and won't have to
create def_ids at all.
2011-06-20 23:53:28 +02:00
Rafael Ávila de Espíndola
3d8a5cb9e6 Remember the library files we used in rustc and pass them to the "linker".
This avoid the hardcoded -lstd, allows programs to use other crates and avoids
any differences that may exist in the rustc and ld search logic.
2011-06-20 17:44:12 -04:00
Eric Holk
a2dcd08cc2 Added string duplication to deep_copy. Closes #520. 2011-06-20 13:47:02 -07:00
Graydon Hoare
c051501784 Tighten up the hardbreak rules a bit. 2011-06-20 19:58:23 +00:00
Graydon Hoare
8cd0695230 Suppress hardbreaks when following hardbreaks. 2011-06-20 19:58:23 +00:00
Graydon Hoare
035d60d533 Fix interference between if-check and if printing. 2011-06-20 19:58:23 +00:00
Eric Holk
992153672b Removed duplicated ret_ty_of_fn. This also means the native function branch is working now, so this commit closes #506. 2011-06-20 12:04:33 -07:00
Eric Holk
ce50ae3212 Added a test case for #506 2011-06-20 12:04:33 -07:00
Eric Holk
5640bead58 Teach ret_ty_of_fn_ty to understand native functions. Closes #506. 2011-06-20 12:04:33 -07:00
Rafael Ávila de Espíndola
283744ba78 Remove flags that are not used during linking. 2011-06-20 15:00:07 -04:00
Graydon Hoare
97cf57adc1 Fix pp blank-lines insertion at beginning of file and before 'let' decls. 2011-06-20 10:45:33 -04:00
Brian Anderson
200dbe4c4f Remove various rustboot workarounds 2011-06-19 20:48:20 -07:00
Graydon Hoare
9b6ae59b22 Fix pp blank-line insertion after isolated comments in cboxes. 2011-06-19 22:55:58 -04: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
Patrick Walton
8cdef277b2 rt: Fix size miscalculation in ivec_reserve 2011-06-19 18:03:19 -07:00
Brian Anderson
6cf9b17086 rustc: Make name resolution errors less fatal
Failure happens at the end of name resolution

Issue #440
2011-06-19 15:23:11 -07:00
Brian Anderson
c5238d57eb rustc: Make import resolution errors less fatal
Failure happens at the end of import resolution

Issue #440
2011-06-19 14:35:50 -07:00
Brian Anderson
76a752e7a4 rustc: Export only what's needed from middle::ty
The list is formidable.
2011-06-19 12:27:43 -07:00
Brian Anderson
80a8af7b47 rustc: Export only what's used from middle::resolve 2011-06-19 12:27:43 -07:00
Brian Anderson
942fcbe7a1 rustc: Re-introduce session.span_err, session.err
These errors are non-fatal. The session.abort_if_errors function needs to be
called at strategic points to convert the previous errors to utter failure.

Issue #440
2011-06-19 12:19:53 -07:00
Brian Anderson
43427dae0c rustc: Rename session.span_err -> span_fatal, err -> fatal
Issue #440
2011-06-19 12:19:53 -07:00
Brian Anderson
cf9ed08a50 Revert previous 6 commits. Hopefully put out Windows fire.
Revert "rustc: Export only what's needed from middle::ty"

This reverts commit 4255d58aa5.

Revert "rustc: Make name resolution errors less fatal"

This reverts commit b8ab9ea89c.

Revert "rustc: Make import resolution errors less fatal"

This reverts commit 92a8ae94b9.

Revert "rustc: Export only what's used from middle::resolve"

This reverts commit 4539a2cf7a.

Revert "rustc: Re-introduce session.span_err, session.err"

This reverts commit 7fe9a88e31.

Revert "rustc: Rename session.span_err -> span_fatal, err -> fatal"

This reverts commit c394a7f49a.
2011-06-19 03:29:19 -07:00
Brian Anderson
4255d58aa5 rustc: Export only what's needed from middle::ty
The list is formidable.
2011-06-19 02:42:05 -07:00
Brian Anderson
b8ab9ea89c rustc: Make name resolution errors less fatal
Failure happens at the end of name resolution

Issue #440
2011-06-19 02:42:05 -07:00
Brian Anderson
92a8ae94b9 rustc: Make import resolution errors less fatal
Failure happens at the end of import resolution

Issue #440
2011-06-19 02:42:01 -07:00
Brian Anderson
4539a2cf7a rustc: Export only what's used from middle::resolve 2011-06-19 02:41:03 -07:00
Brian Anderson
7fe9a88e31 rustc: Re-introduce session.span_err, session.err
These errors are non-fatal. The session.abort_if_errors function needs to be
called at strategic points to convert the previous errors to utter failure.

Issue #440
2011-06-19 02:41:02 -07:00
Brian Anderson
c394a7f49a rustc: Rename session.span_err -> span_fatal, err -> fatal
Issue #440
2011-06-19 02:40:59 -07:00
Brian Anderson
514813148b rustc: Store the lhs and rhs of receive exprs in left to right order
With the changing of receive semantics the parser has been putting the rhs
expression in the first argument of expr_recv and the lhs in the second, and
all subsequent passes have been referring to them backwords (but still doing
the right thing because they were assuming that lhs was the port and rhs was
the receiver).

This makes all code agree on what lhs and rhs mean for receive expressions.
2011-06-18 20:23:05 -07:00
Brian Anderson
364cd5763c rustc: receive is spelled |> now 2011-06-18 20:23:05 -07:00
Brian Anderson
3852f1eee3 Typecheck block tail expressions that are fn return values 2011-06-18 20:23:05 -07:00
Brian Anderson
ddbb31eb8e rustc: Remove the meta keyword
Issue #487
2011-06-18 20:23:05 -07:00
Brian Anderson
f58de2d687 Replace unexported meta tags with attributes
Issue #487
2011-06-18 20:23:05 -07:00
Brian Anderson
60023047a4 rustc: Replace 'export meta' with attributes
Issue #487
2011-06-18 20:23:05 -07:00
Graydon Hoare
814beaafdf Add -lssp on windows in attempt to put out tinderbox; no idea why ssp seems required on mingw. 2011-06-18 22:07:02 -04:00
Patrick Walton
7bb6733f2c test: Add a test case for derived-tydescs-before-dynamic-allocas 2011-06-18 18:44:21 -07:00
Patrick Walton
4f13879218 rustc: Allocate derived tydescs before dynamically sized allocas 2011-06-18 18:43:07 -07:00
Patrick Walton
877f001512 rustc: Don't bother to supply an alignment argument to the memmove intrinsic; LLVM is very fussy about what it considers a constant. 2011-06-18 16:59:44 -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
ef65542b1d test: Add test cases for ivec::init_elt, ivec::last, and ivec::slice 2011-06-18 16:05:44 -07:00
Patrick Walton
2ba7729ae7 rustc: Cache results of type_has_pointers. 70% translation speedup. 2011-06-18 00:41:25 -07:00
Patrick Walton
b2bcafe6fd stdlib: Add some more ivec functions, untested as of yet 2011-06-17 19:16:26 -07:00
Patrick Walton
5894e400b6 rustc: Add missing case for interior vectors in alias.rs 2011-06-17 19:16:26 -07:00
Tim Chevalier
7fc89f573d Restructure the "checking" pass in typestate
I noticed that typestate was being lazier than it should be,
because it was only checking typestate for statements and
top-level expression (that is, the expression in a stmt_expr, but
not any subexpressions). So I rewrote the checks in tstate/ck.rs
to use walk, which exposed a few bugs in typestate that I fixed.

Also added some more test cases for if-check.
2011-06-17 19:09:18 -07:00
Patrick Walton
a4eb6630f3 rustc: Increment by the dynamically-computed size in ivec::trans_append. Uncomment init_fn test in lib-ivec. 2011-06-17 19:01:14 -07:00
Brian Anderson
77189f834c rustc: Use correct version key in metadata 2011-06-17 18:33:07 -07:00
Brian Anderson
bd93e1abcd Register new snapshots. Update location of stage0's libstd 2011-06-17 18:19:37 -07:00
Patrick Walton
e0afcb400b test: Comment out the init-fn line in lib-ivec. Puts out burning tinderbox. 2011-06-17 17:53:43 -07:00
Patrick Walton
5fb9325848 rustc: Fix a bunch of memory management bugs relating to generic interior vectors. Uncomment all tests in lib-ivec. 2011-06-17 17:31:24 -07:00
Patrick Walton
68122edac3 Revert "rustc: Fix a bunch of memory management bugs relating to generic interior vectors"
This reverts commit 2b5e40311d.
2011-06-17 16:38:47 -07:00
Patrick Walton
2b5e40311d rustc: Fix a bunch of memory management bugs relating to generic interior vectors 2011-06-17 16:23:06 -07:00
unknown
8c6354ceb9 Made sure getcwd and friends work well on Windows. 2011-06-17 15:53:21 -07:00
Eric Holk
7c57b8baf5 Updating rustrt.def.in so that the path manipulation functions work on OS X. 2011-06-17 15:53:20 -07:00
Eric Holk
9adacfb26a Adding a test case for getcwd and related functions. 2011-06-17 15:53:20 -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
175fd8ee73 Update snapshot scripts to understand new dir layout 2011-06-17 15:39:58 -07:00
Eric Holk
2c1b269960 Implemented enough of deep_copy that we can pass scalars and channels to tasks. Closes #507. 2011-06-17 15:17:46 -07:00
Eric Holk
81fc51a8d7 Started using deep_copy for spawn arguments. 2011-06-17 15:17:46 -07:00
Eric Holk
71e1db596c Added a test case for #507 2011-06-17 15:17:46 -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
Brian Anderson
81a187e8be rustc: Remove metadata from the session.
This mechanism was not being used for anything. Issue #487.
2011-06-17 14:46:59 -07:00
Rafael Ávila de Espíndola
342dbd7abe Put std in stageN/lib. This avoids windows trying to load stageN/std.ll when
stageN/runstc.exe is run.
2011-06-17 15:34:59 -04:00
Patrick Walton
e43a3755dd rustc: Add a type_owns_heap_mem() predicate 2011-06-17 12:32:18 -07:00
Patrick Walton
dfb806b367 rustc: Cast to opaque interior vector types in trans_vec_append if necessary. Puts out burning tinderbox. 2011-06-17 12:23:04 -07:00
Patrick Walton
4918c99f69 rustc: Copy the contents of generic interior vectors 2011-06-17 12:22:53 -07:00
Patrick Walton
4bb7597542 Revert "rustc: Copy the contents of generic interior vectors"
This reverts commit 5bdbe1dfc2.
2011-06-17 12:03:21 -07:00
Patrick Walton
5bdbe1dfc2 rustc: Copy the contents of generic interior vectors 2011-06-17 11:45:51 -07:00
Brian Anderson
e8228e1260 rustc: Demand that if conditions have bool type
Closes #513
2011-06-17 11:35:00 -07:00
Brian Anderson
a4d88dacc9 rustc: Fail to unify if two ty_vars don't unify
Closes #500
2011-06-17 11:35:00 -07:00
Brian Anderson
2a69db5b76 test: Fix mismatched types in prep for typechecker fixes
Issue #500
2011-06-17 11:35:00 -07:00
Brian Anderson
753da64fd6 rustc: Demand unification of both sides of a binop
Issue #500
2011-06-17 11:35:00 -07:00
Rafael Ávila de Espíndola
1dbc0442cd Automatically add a -L to the directory the binary is in. 2011-06-17 13:36:08 -04:00
Patrick Walton
982f51aa95 stdlib: Fix reserve on zero-length interior vectors; uncomment test_unsafe_ptrs() 2011-06-16 18:01:57 -07:00
Paul Stansifer
391348ec86 Consistify ast::local. 2011-06-16 17:56:24 -07:00
Patrick Walton
d47101703e stdlib: Sketch out ivec::init_fn, currently segfaulting 2011-06-16 17:48:59 -07:00
Patrick Walton
ab7ebb608a rustc: Fix dominance issue when translating generic interior vectors 2011-06-16 17:48:32 -07:00
Brian Anderson
a68a5c9b5e Disable lib-ivec's test_unsafe_ptrs. Not working here 2011-06-16 17:34:39 -07:00
Brian Anderson
6f4326c54d Add better error messages for bad attributes in .rc files
Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
4b8fba5f34 rustc: Fix regressed handling of bad attributes
Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
ffa7c76ed2 rustc: Change print_file to print_crate
The pretty-printer needs access to the crate attributes in order to reproduce
inner crate attributes in standalone .rs files

Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
e83a115d79 rustc: Parse crate attributes in standalone .rs files
Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
ffae642663 rustc: Parse attributes in crate files
Issue #487
2011-06-16 17:23:20 -07:00
Brian Anderson
62939e41b2 rustc: Parse inner items of file-level modules linked from crate files
Issue #487
2011-06-16 17:23:20 -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
Patrick Walton
e50c918e6b rustc: Implement type walking and comparison glue for unsafe pointers 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
Graydon Hoare
eb9969f546 Add support for marking files no-reformat. 2011-06-16 16:42:29 -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
Patrick Walton
94cd2985b2 rustc: Parse T[mutable?] 2011-06-16 15:17:06 -07:00
Patrick Walton
d90ad442b4 rustc: Work around leak when translating interior vectors. Un-XFAIL interior-vec.rs. 2011-06-16 15:07:21 -07:00
Patrick Walton
5b341443da test: Add an interior-vec test case, XFAIL'd for now because of leaks in the compiler 2011-06-16 14:30:10 -07:00
Patrick Walton
e7575b9f3a rustc: Add cases for istr and ivec to visit 2011-06-16 14:26:11 -07:00
Brian Anderson
99301ff830 test: Add a test for outer attributes on the first module in a file
Issue #487
2011-06-16 14:21:43 -07:00
Brian Anderson
b727d079ed rustc: Pretty print module inner attributes
Issue #487
2011-06-16 14:21:43 -07:00
Brian Anderson
43cbbabccb rustc: Correctly mark attributes as inner attributes
Issue #487
2011-06-16 14:21:43 -07:00
Brian Anderson
f3996d32b0 rustc: Parse inner attributes of modules
Issue #487
2011-06-16 14:21:42 -07:00
Brian Anderson
0efd7fac8a stdlib: Add option::is_some 2011-06-16 14:21:42 -07:00
Tim Chevalier
49a4867da6 Pretty-print if-check 2011-06-16 14:08:48 -07:00
Patrick Walton
4fc286e24e rustc: Parse interior vector types in which the base type is a path properly 2011-06-16 14:03:07 -07:00
Patrick Walton
9210afc8a5 rustc: Pretty print interior vector types 2011-06-16 14:03:07 -07:00
Eric Holk
6ed6791df4 Removing dead upcall_join. Closes #509. 2011-06-16 12:23:13 -07:00
Lindsey Kuper
a5563e173e Clean up whitespace oddities perpetrated by pretty-printer. 2011-06-16 12:21:49 -07:00
Lindsey Kuper
efc55b2a3d Simple anonymous objects compile with stage0. 2011-06-16 12:21:49 -07:00
Tim Chevalier
219924e669 Bring back if-check
Add "if check" (expr_if_check), a variation on check that executes
an "else" clause rather than failing if the check doesn't hold.
2011-06-16 12:13:20 -07:00
Tim Chevalier
94ae4590c5 if-check test case 2011-06-16 12:13:20 -07:00
Michael Sullivan
bd8f6097a7 Get rid of old vec_append glue. 2011-06-16 11:58:29 -07:00
Michael Sullivan
a9d62e5a90 Write some tests for swap. 2011-06-16 11:47:54 -07:00
Michael Sullivan
272c7e2e87 Translate the swap operator. 2011-06-16 11:47:54 -07:00
Michael Sullivan
bc33a5fe50 Fix bug in move on structure types. 2011-06-16 11:47:54 -07:00