Tim Chevalier
4519f54857
Warn for unused variables
...
Modify typestate to check for unused variables and emit warnings
where relevant. This exposed a (previously harmless) bug in
collect_locals where outer functions had bit-vector entries
for init constraints for variables declared in their inner
nested functions. Fixing that required changing collect_locals to
use visit instead of walk -- probably a good thing anyway.
2011-06-30 12:37:30 -07:00
Patrick Walton
add9031dd5
rustc: Use interior vectors for record types
2011-06-30 12:02:40 -07:00
Patrick Walton
fd0d1cb7d8
rustc: Make mk_imm_tup() take an interior vector
2011-06-30 11:35:05 -07:00
Patrick Walton
b841152a40
rustc: Use interior vectors for tuple types
2011-06-30 11:35:05 -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
Brian Anderson
4165d3640a
Add a pass to fold out items that do not belong in the current configuration
...
The parser needs to parse unconfigured items into the AST so that they can
make the round trip back through the pretty printer, but subsequent passes
shouldn't care about items not being translated. Running a fold pass after
parsing is the lowest-impact way to make this work. The performance seems
fine.
Issue #489
2011-06-30 10:06:26 -07:00
Brian Anderson
3483c65b1f
Add missing item variants to fold_item_underscore
2011-06-30 10:06:26 -07:00
Brian Anderson
aa6a3debf3
Add missing expression variants to fold_expr
2011-06-30 10:06:26 -07:00
Brian Anderson
1f0c25406c
Fold the crate-level module in front::fold
2011-06-30 10:06:26 -07:00
Brian Anderson
5de916dd5c
Move middle::attr to front::attr
2011-06-30 10:06:26 -07:00
Brian Anderson
afc8a5c031
Convert the eval::env to an ast::crate_cfg
...
crate_cfg will replace eval::env as the mechanism for conditional compilation.
This is a transitional step so they can both exist together.
Issue #489
2011-06-30 10:06:25 -07:00
Brian Anderson
d53bfad8e7
Introduce a config property to the crate AST node
...
This represents the compilation environment, defined as AST meta_items, Used
for driving conditional compilation and will eventually replace the
environment used by the parser for the current conditional compilation scheme.
Issue #489
2011-06-30 10:06:25 -07:00
Brian Anderson
78a82b9fd1
Switch rustc's crate metadata to use the link attribute
2011-06-30 10:03:07 -07:00
Marijn Haverbeke
86f16b90cd
Support type parameters in resources
...
Some rather dodgy code was added to trans in the process. I'd love to
discuss it with someone who knows more about types during translation.
2011-06-30 18:36:12 +02:00
Marijn Haverbeke
31ec26d46a
Make calling resource destructors work cross-crate
...
Tydescs are currently re-created for each compilation unit (and I
guess for structural types, they have to be, though the duplication
still bothers me). This means a destructor can not be inlined in the
drop glue for a resource type, since other crates don't have access to
the destructor body.
Destructors are now compiled as separate functions with an external
symbol that can be looked up in the crate (under the resource type's
def_id), and called from the drop glue.
2011-06-30 18:36:12 +02:00
Rafael Ávila de Espíndola
5b7ce80ffa
Second try to remove -lssp.
2011-06-30 08:55:25 -04:00
Graydon Hoare
afabde19dc
More fixes to fast-check.
2011-06-29 17:54:05 -07:00
Graydon Hoare
c796a8f24d
Re-enable tidy (it was broken) and fix various non-tidy things.
2011-06-29 15:14:55 -07:00
Brian Anderson
190644063e
Be more strategic about linking to rust crates
...
Instead of linking directly to the rust crate, try to figure out the location
and name of the library from the file name, then call gcc with appropriate -L,
-l flags. This will allow dynamic linking to be more forgiving about where it
loads the library from at runtime - currently a stage3 compiler can't run
correctly from the stage0 directory. Only tested on Linux. Fingers crossed.
2011-06-29 14:35:39 -07:00
Brian Anderson
e130e7b598
Display an error when linking fails
2011-06-29 14:35:39 -07:00
Brian Anderson
e60cb9197f
Add session.note method
2011-06-29 14:35:39 -07:00
Brian Anderson
4ffa5ddf76
session.err shouldn't take a span
2011-06-29 14:35:39 -07:00
Tim Chevalier
76b755f9ad
Remove workaround for a compiler bug that, I guess, got fixed
2011-06-29 14:28:03 -07:00
Tim Chevalier
88447a47c0
Eliminate the --check-claims compiler flag
...
The option can only be toggled at runtime now.
2011-06-29 14:28:02 -07:00
Tim Chevalier
1ba85932b1
Add a runtime flag to enable/disable claims en masse
...
Now, if the environment variable CHECK_CLAIMS is set, then all
claims turn into checks. Otherwise, claims are no-ops.
2011-06-29 14:28:02 -07:00
Brian Anderson
d4b5b48e0a
Correctly locate the crate's version from the link attribute
2011-06-29 14:21:39 -07:00
Brian Anderson
29afe1a518
Write metadata for sythesized name/vers items to the crate's link attr
...
If the crate doesn't specify it's name or version, the defaults need to be
exported in the crate metadata
2011-06-29 14:21:39 -07:00
Brian Anderson
308bc31f24
Encapsulate more crate meta calculations
2011-06-29 14:21:39 -07:00
Brian Anderson
325f46da06
Move the calculation of the crate name, vers and cmh to a single function
2011-06-29 14:21:39 -07:00
Graydon Hoare
5b2c17fba5
Fix resource encoding bugs.
2011-06-29 12:14:29 -07:00
Patrick Walton
b18cefdfd7
rustc: Fix a leak that resulted from copying a structural interior type containing interior vectors. Add a test case.
2011-06-29 12:16:07 -07:00
Rafael Ávila de Espíndola
54f618128e
Revert ""Try" push without -lssp on windows to see what needs it."
...
This reverts commit 47b3e087e9
.
2011-06-29 13:25:52 -04:00
Patrick Walton
bbd0d58955
rustc: Unbreak self assignment
2011-06-29 10:22:53 -07:00
Rafael Ávila de Espíndola
47b3e087e9
"Try" push without -lssp on windows to see what needs it.
2011-06-29 12:56:54 -04:00
Michael Sullivan
1d05718c2d
Extend visit to use visit_fn to visit fn expressions.
2011-06-29 09:04:00 -07:00
Brian Anderson
7c500fc0a0
Replace common::new_seq_hash with an adapter around std::smallintmap
...
It would be better to either convert ast_map to use smallintmap or make
smallintmap and hashmap follow the same interface, but I don't feel up to
it just now. Closes #585 .
2011-06-28 19:48:33 -07:00
Lindsey Kuper
7b5d34aa9a
Comments and cleanup.
2011-06-28 19:06:44 -07:00
Lindsey Kuper
57e5cde3a2
Comments and cleanup.
2011-06-28 18:54:56 -07:00
Lindsey Kuper
684c0dc494
Comments and cleanup.
2011-06-28 18:54:56 -07:00
Brian Anderson
6832f75f0b
Support attaching attributes to modules via the crate file. Issue #487
2011-06-28 18:39:34 -07:00
Patrick Walton
74f8eb51ae
rustc: Move duplicate_heap_parts to copy glue; add a test case
2011-06-28 17:59:30 -07:00
Tim Chevalier
db478ed4de
Remove outdated comments
2011-06-28 17:50:07 -07:00
Michael Sullivan
b944d8d72e
Require that both sides of a swap be lvals.
2011-06-28 17:28:06 -07:00
Brian Anderson
83b7215366
Cleanup attribute code. Issue #487
2011-06-28 16:55:07 -07:00
Brian Anderson
82a74fcb3f
Remove the last traces of the distinction between export / local meta items
...
Issue #487
2011-06-28 16:55:07 -07:00
Patrick Walton
dfcfef41df
rustc: Rename take glue to copy glue
2011-06-28 16:52:59 -07:00
Tim Chevalier
9f1444c701
Implement "claim"
...
Implement "claim" (issue #14 ), which is a version of "check" that
doesn't really do the check at runtime. It's an unsafe feature.
The new flag --check-claims turns claims into checks automatically --
but it's off by default, so by default, the assertion in a claim
doesn't execute at runtime.
2011-06-28 16:41:06 -07:00
Eric Holk
866ee6ecb4
Re-enabling some tests.
2011-06-28 16:12:34 -07:00
Eric Holk
c6d8324830
There is only one domain per kernel now.
2011-06-28 16:12:33 -07:00
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
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
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
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
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
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
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
Brian Anderson
fcbdac96dd
Update README files
2011-06-26 22:27:22 -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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
2ba7729ae7
rustc: Cache results of type_has_pointers. 70% translation speedup.
2011-06-18 00:41:25 -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
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
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
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
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
Paul Stansifer
391348ec86
Consistify ast::local.
2011-06-16 17:56:24 -07:00
Patrick Walton
ab7ebb608a
rustc: Fix dominance issue when translating generic interior vectors
2011-06-16 17:48:32 -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
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
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
e7575b9f3a
rustc: Add cases for istr and ivec to visit
2011-06-16 14:26:11 -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
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
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
Michael Sullivan
bd8f6097a7
Get rid of old vec_append glue.
2011-06-16 11:58:29 -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
Michael Sullivan
cfd1f74ebb
Bring swap through typechecking and typestate.
2011-06-16 11:47:54 -07:00
Michael Sullivan
066599104a
Parse swap.
2011-06-16 11:47:54 -07:00
Michael Sullivan
e8d2d27a88
Add "<->" to the token definition and the lexer.
2011-06-16 11:47:54 -07:00
Patrick Walton
4673eb6839
rustc: Fix LLVM type error when generating cmp glue for interior vectors
2011-06-16 11:16:03 -07:00
Patrick Walton
66c52036da
rustc: Change interior vector syntax to T[]
2011-06-16 10:13:39 -07:00
Marijn Haverbeke
15f71b3600
Refactor ast::item representation
...
Most of the fields in an AST item were present in all variants. Things
could be simplified considerably by putting them in the rec rather
than in the variant tags.
2011-06-16 13:32:35 +02:00
Brian Anderson
6c2f322f82
Improve and test failure behavior for malformed attributes
2011-06-15 19:30:10 -07:00
Patrick Walton
1fa9133b76
rustc: Implement interior vector concatenation
2011-06-15 18:03:25 -07:00
Eric Holk
260aa408f3
Merge branch 'master' of github.com:graydon/rust into fastcall
2011-06-15 17:45:24 -07:00
Brian Anderson
94d971c0e8
rustc: Remove unused variable from check_assignment
2011-06-15 16:48:59 -07:00
Brian Anderson
2772a29e92
rustc: Support outer attributes on items that are defined as statements
...
Issue #487
2011-06-15 16:01:35 -07:00
Tim Chevalier
a5bca7df88
Refactor data structures representing constraints (again...)
...
I added a "resolved" version of the ast::constr type -- ty::constr_def
-- that has a def_id field instead of an ann_field. This is more
consistent with other types and eliminates some checking.
Incidentally, I removed the def_map argument to the top-level function
in middle::alias, since the ty::ctxt already has a def_map field.
2011-06-15 15:38:12 -07:00