Commit Graph

3362 Commits

Author SHA1 Message Date
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
Eric Holk
edf73f0512 Setting rt optimization on OS X to -O0 when using clang, like we already do with gcc. Tail-call elimination was causing valgrind errors with stack switching. Closes #494. 2011-06-21 13:13:33 -07: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
Brian Anderson
72f90f0f5f Turn doc FIXMEs into comments 2011-06-21 06:17:54 -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
Graydon Hoare
1ad8efa86e Fix 'reformat' mk target to handle recent libdir changes. 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
Rafael Ávila de Espíndola
164230dcb6 Finish the transition to having the std library in stageN/lib. 2011-06-20 13:38:11 -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