Graydon Hoare
750dcc05e4
Make tests a little more friendly to combine.
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
Patrick Walton
a2ce532337
rt: Remove the lock around upcall_vec_append. Add a test case. Closes #156 .
2011-06-29 10:33:51 -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
Graydon Hoare
5059c5f8fd
Actually notice xfail-stage2 as different from xfail-stage2. Fix affected tests.
2011-06-28 17:36:51 -07:00
Michael Sullivan
b944d8d72e
Require that both sides of a swap be lvals.
2011-06-28 17:28:06 -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
49a8cb34d2
Removed dom_owned, splitting things between task_owned and kernel_owned. Had to re-xfail a few tests brson recently un-xfailed.
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
46b83a92d6
Add test case for non-matching crate metadata in use statements
2011-06-28 15:58:22 -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
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
926049eddd
Tests only: more tests with constraints and loops
2011-06-28 11:49:11 -07:00
Brian Anderson
cab73f8897
Write metadata for more meta_item types. Issue #487
2011-06-28 10:12:05 -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
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
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
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
Michael Sullivan
12d9d07a84
Improve the tests for vector self appending.
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
Rafael Ávila de Espíndola
ac081c30be
Record and link with used native libraries.
2011-06-27 15:24:44 -04: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
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
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
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
781a265b88
Remove variable name 'res' from test suite
2011-06-25 21:15:04 +02: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
4499ebe858
Add a test that tests typestate checking inside of fn exprs.
2011-06-24 15:46:20 -07:00
Paul Stansifer
142ff011da
Make a test compile faster.
2011-06-24 14:47:36 -07:00
Brian Anderson
1e7f06b17a
test: Improve ternary operator tests
2011-06-23 23:27:32 -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
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
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
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
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
Brian Anderson
cc2a514cdc
test: Enable more tests
2011-06-22 08:35:02 -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
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
Brian Anderson
34040be580
test: Add a test for distinguishing attributes from extensions
...
Issue #487
2011-06-21 11:50:55 -07:00
Brian Anderson
23d6a6bde1
rustc: Remove unused slice call from extfmt. Closes #532
2011-06-21 07:49:40 -07:00
Eric Holk
a2dcd08cc2
Added string duplication to deep_copy. Closes #520 .
2011-06-20 13:47:02 -07: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
Brian Anderson
3852f1eee3
Typecheck block tail expressions that are fn return values
2011-06-18 20:23:05 -07: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
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
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
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
Eric Holk
9adacfb26a
Adding a test case for getcwd and related functions.
2011-06-17 15:53:20 -07:00
Eric Holk
71e1db596c
Added a test case for #507
2011-06-17 15:17:46 -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
Patrick Walton
982f51aa95
stdlib: Fix reserve on zero-length interior vectors; uncomment test_unsafe_ptrs()
2011-06-16 18:01:57 -07:00
Patrick Walton
d47101703e
stdlib: Sketch out ivec::init_fn, currently segfaulting
2011-06-16 17:48:59 -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
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
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
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
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
f3996d32b0
rustc: Parse inner attributes of modules
...
Issue #487
2011-06-16 14:21:42 -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
a9d62e5a90
Write some tests for swap.
2011-06-16 11:47:54 -07:00
Brian Anderson
6c2f322f82
Improve and test failure behavior for malformed attributes
2011-06-15 19:30:10 -07:00
Eric Holk
67360ae618
Fixed a problem where spawn arguments were getting lost again. Also, fixed up stack alignment, which closes #496
2011-06-15 18:16:59 -07:00
Eric Holk
c4f9bd9470
Re-enabled join.
2011-06-15 18:16:59 -07:00
Brian Anderson
14c5900a70
test: Add a compile-fail test for attribute/syntax parsing
...
I don't currently know how to deal with syntax extensions that appear betweeen
an attribute and an item, so this test captures the error that occurs.
Issue #487
2011-06-15 16:01:39 -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
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
Brian Anderson
95bdedf12d
test: Add missing fn test cases to run-pass/item-attributes.rs
...
Issue #487
2011-06-15 15:45:41 -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
Lindsey Kuper
fa5a7e7453
Simple anonymous objects get through translation.
2011-06-15 12:18:52 -07:00
Graydon Hoare
766d54df93
Fix a bunch of compile-command lines to use RBUILD
2011-06-15 12:01:19 -07:00
Graydon Hoare
ce72993488
Reformat source tree (minus a couple tests that are still grumpy).
2011-06-15 11:19:50 -07:00
Brian Anderson
6c6d7c3916
test: Add tests for multiple outer attributes on items
...
Issue #487
2011-06-15 09:48:59 -07:00
Brian Anderson
697fdaac24
test: Add test cases for outer attributes on all item types
2011-06-15 09:46:38 -07:00
Brian Anderson
0eefa5f9d3
rustc: Parse module attributes
...
Issue #487
2011-06-15 09:46:37 -07:00
Marijn Haverbeke
c7ab88cc35
Implement checking against assignments to immutable obj fields
2011-06-15 14:59:51 +02:00
Marijn Haverbeke
0ddade3d7a
Extend alias analysis to check assignments
...
This is a somewhat odd place to put these checks, but the data tracked
by that pass, and the available functions, make it trivial to do such
a check there.
2011-06-15 14:10:07 +02:00
Marijn Haverbeke
5fb518abc9
Fix assignments to immutable fields throughout the code
2011-06-15 14:10:07 +02:00
Graydon Hoare
b7f043eeb7
Add new testcase to show the nature of our exciting block-expr / trailing unop interaction.
2011-06-14 17:07:48 -07:00
Tim Chevalier
36755e42df
Remove some unnecessary xfails
2011-06-14 15:11:48 -07:00
Tim Chevalier
1cc7165e62
Un-xfail test/run-fail/pred.rs
2011-06-14 14:17:28 -07:00
Tim Chevalier
206429e075
Un-xfail working test cases
2011-06-14 13:58:10 -07:00
Tim Chevalier
6142c731a0
Un-xfail some tests that work
2011-06-14 12:27:23 -07:00
Tim Chevalier
7532681612
Add xfail-stage0 to some tests (not sure if it matters...)
2011-06-14 12:27:23 -07:00
Marijn Haverbeke
471436a299
Implement function expressions/anonymous functions
...
Looks like 'fn(..arg..) -> ret {body;}. They don't support type
parameters or upvars yet.
2011-06-14 18:22:46 +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
1595c9d767
rustc: Assignment expressions have nil type. Closes #483
2011-06-13 17:57:43 -07:00
Tim Chevalier
b0a80104a3
Un-XFAIL pred-on-wrong-slots
2011-06-10 19:17:15 -07:00
Brian Anderson
2723e1c48f
test: Add tests for issue #452
2011-06-11 00:42:52 +00:00
Graydon Hoare
9671d21408
Implement meta tag matching in creader. Start using it in rustc.rc. Close #459 . Close #457 .
2011-06-10 15:54:41 -07:00
Tim Chevalier
774c6d0198
Friendlier error message for break outside a loop
...
The typechecker should really check for this, but at least now
there's an error message rather than an inexhaustive match failure
in trans.
2011-06-10 14:34:01 -07:00
Tim Chevalier
e5eacf8ea9
Use RHS type when translating assignments
...
In code like "auto foo = fail", a type gets inferred for foo
depending on how it's used. However, fail still has type _|_ and
still should be treated that way: particularly, its value shouldn't
be copied. Fixed trans to reflect that.
2011-06-10 14:05:06 -07:00
Patrick Walton
d8b271e3b1
test: Change bitwise.rs to use ! instead of ~. Should put out burning tinderbox.
2011-06-10 11:34:07 -07:00
Patrick Walton
7b7c746c1e
Merge pull request #447 from paulstansifer/quick_error_message_fix
...
Error message, instead of segfault, when recursive types are used.
2011-06-10 10:53:42 -07:00
Marijn Haverbeke
e25e05539e
Handle mutable references in alias analysis
2011-06-10 16:44:33 +02:00
Marijn Haverbeke
f28796ed99
Fix unsafe uses of mutable references
2011-06-10 16:44:32 +02:00
Marijn Haverbeke
fccf065266
Implement mutable/immutable alias distinction.
...
Before, all aliases were implicitly mutable, and writing
&mutable was the same as writing &. Now, the two are
distinguished, and assignments to regular aliases are
no longer allowed.
2011-06-10 12:15:58 +02:00
Tim Chevalier
1cc3fe567c
Improve error message for wrong number of type arguments
...
Improve error message in the case where a use of a polymorphic tag has
insufficient type arguments given. Before, the typechecker was
just crashing with a bounds check error.
2011-06-09 14:50:49 -07:00
Marijn Haverbeke
beda82ddf1
A revised, improved alias-checker
...
The old system tried to ensure that the location an alias pointed at
would retain its type. That turned out to not be strong enough in the
face of aliases to the inside of tags.
The new system instead proves that values pointed to by aliases are
not replaced (or invalidated in some other way) at all. It knows of
two sufficient conditions for this, and tries to prove at least of
them:
A) The alias is 'immutably rooted' in a local, and this local is not
reassigned for the lifetime of the alias. Immutably rooted means
the alias refers to the local itself, or to something reachable
from the local through immutable dereferencing.
B) No value whose type might include the type of the 'inner mutable
element' of the thing the alias refers to (for example, the box in
rec(mutable x = @mutable int)) is from the outer scope is accessed
for the lifetime of the alias. This means for functions, no other
argument types may include the alias's inner mutable type. For alt,
for each, and for, it means the body does not refer to any locals
originating from outside their scope that include this type.
The lifetime of an alias in an alt, for each, or for body is defined
as the range from its definition to its last use, not to the point
where it goes out of scope. This makes working around these
restrictions somewhat less annoying. For example, you can assign to
your alt-ed value you don't refer to any bindings afterwards.
2011-06-09 13:11:29 +02:00
Marijn Haverbeke
bd90c7a3cb
Add new visitor framework
2011-06-09 13:08:38 +02:00
Patrick Walton
537d4ac65a
rustc: Fix error pattern in compile-fail/arg-count-mismatch.rs
2011-06-08 18:42:34 -07:00
Patrick Walton
2f853ddb8d
test: Add a test case for issue #362 , "ret none".
2011-06-08 12:52:36 -07:00
Josh Matthews
2235fb73ef
Add optional message to fail.
2011-06-08 04:02:55 -04:00
Patrick Walton
0857d22c04
rustc: Print out a real error message on unresolved types. Puts out burning tinderbox.
2011-06-07 23:03:41 -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
Josh Matthews
df9cf0be9b
Add multiline, whitespace-eating strings.
2011-06-07 11:21:10 +02:00
Rafael Ávila de Espíndola
ee54fa5c7d
Implement enough support for pointer to get an identity function working.
2011-06-06 16:36:01 -04:00
Marijn Haverbeke
4bd5f834b0
First take on an alias-safety checker
...
The alias checker works by ensuring that any value to which an alias
is created is rooted in some way that ensures it outlives the alias.
It is now disallowed to create an alias to the content of a mutable
box, or to a box hanging off a mutable field. There is also machinery
in place to prevent assignment to local variables whenever they are
the root of a live alias.
2011-06-06 21:24:03 +02:00
Brian Anderson
53ea2a4751
stdlib: Use spans for #fmt errors originating in std
...
Issue #444
2011-06-04 19:48:19 -04:00
Brian Anderson
3ca5fff195
rustc: Use spans for #env errors
...
Issue #444
2011-06-04 17:14:32 -04:00
Brian Anderson
ecf1bd7651
rustc: Use spans on extfmt error messages
...
Issue #444
2011-06-04 17:10:04 -04:00
Paul Stansifer
dbd066a02a
"macro" -> "syntax extension" for now
2011-06-03 18:47:11 -07:00
Paul Stansifer
79fcd51b46
Make the macro system more modular.
2011-06-03 18:47:11 -07:00
Rafael Ávila de Espíndola
18b63865ce
Accept *foo as a pointer to foo.
...
This is accepted everywhere, since just passing a pointer is safe.
2011-06-03 14:34:19 -04:00
Marijn Haverbeke
07667d29aa
Temporarily xfail compile-fail/pattern-tyvar
...
So that the tinderboxes can go green again. Patrick, please look into
this at some point.
2011-06-03 10:23:13 +02:00
Tim Chevalier
76bcbfd269
Un-XFAIL break-value
...
It passes thanks to the previous two commits.
2011-06-02 17:52:04 -07:00
Paul Stansifer
1377e9b341
Implement pcwalton's code review suggestions.
2011-06-02 15:12:17 -07:00
Paul Stansifer
5cd10d2fef
Error message, instead of segfault, when recursive types are used.
2011-06-02 14:03:17 -07:00
Marijn Haverbeke
fd5428a95e
Re-xfail lib-io test. Seems to only work on Linux
2011-06-02 17:58:49 +02:00
Marijn Haverbeke
5144f790fe
Fix and un-xfail vec-append test
2011-06-02 16:45:26 +02:00
Marijn Haverbeke
75ffe657db
Un-xfail multi test
2011-06-02 16:21:14 +02:00
Marijn Haverbeke
8ac94d59e8
Un-xfail lib-io test
2011-06-02 16:19:30 +02:00
Marijn Haverbeke
830c58b651
Un-xfail obj-dtor-2
2011-06-02 16:12:20 +02:00
Lindsey Kuper
528c6516f0
Use span_err instead of err. Fixes issue #444 .
2011-06-01 17:22:23 -07:00
Paul Stansifer
9f5dddf08c
Now imports are not re-exported unless 'export' is explicitly used.
2011-05-31 18:43:26 -07:00
Michael Sullivan
78b0d33c35
More tests for <-.
2011-05-31 17:39:14 -07:00
Michael Sullivan
68b4688875
Add some simple tests for move.
2011-05-31 17:39:14 -07:00
Brian Anderson
9daa00bf83
rustc: Teach rustc to use block results as fn return values. Closes #372
2011-05-31 19:18:55 -04:00
Tim Chevalier
18a1cce2bc
change fn to pred in pred-on-wrong-slots (but it's still xfailed
2011-05-31 10:13:25 -07:00
Brian Anderson
c7e3f88c93
rustc: Pushdown type params for tag patterns. Closes #363
2011-05-31 00:00:04 -04:00
Tim Chevalier
18883fea3a
In pre/postcondition computation, failing calls should set the postcondition
...
A non-returning call should have a postcondition in which all predicates
are true -- not just a poststate. Otherwise, alt expressions where
one or more branches terminate in a non-returning call and others
initialize a variable get rejected.
Includes a test case.
2011-05-27 20:43:51 -07:00
Tim Chevalier
b6e0c5829f
Check the declaration type in a for loop against the sequence type
...
Changed the typechecker to correctly typecheck the declared variable
type in a for or for-each loop against the vector element type (for
a for loop) or the iterator type (for a for-each loop). Added a
test case.
2011-05-27 17:42:09 -07:00
Graydon Hoare
85a2b0bfb9
Re-XFAIL, not valgrind-clean.
2011-05-27 15:52:00 -07:00
Eric Holk
8cfc388d40
Switched calling conventions so that spawn with multiple arguments works.
2011-05-27 15:20:58 -07:00
Eric Holk
d49998f0ed
Switching over to wrappers for spawning functions of multiple arguments. Doesn't quite work yet.
2011-05-27 15:20:58 -07:00
Eric Holk
842bf7cad1
Un-XFAILing spawn tests.
2011-05-27 15:20:58 -07:00
Eric Holk
a88af906c5
Programs using spawn terminate
2011-05-27 15:20:58 -07:00
Eric Holk
dad426419c
Working on 2 argument spawn. The arguments seem to be copied correctly once, but then they get lost.
2011-05-27 15:20:58 -07:00
Eric Holk
bb4c7a9c68
Arguments seem to be correctly passed to child processes now.
2011-05-27 15:20:58 -07:00
Lindsey Kuper
867e9fb030
Test case showing that issue 324 is resolved.
2011-05-27 12:45:01 -07:00
Michael Sullivan
a7a42c24be
Change the syntax for RECV from "var <- port" to "port |> var".
2011-05-27 12:01:20 -07:00
Michael Sullivan
ea16e582eb
Remove parser support for recv as an initializer in preparation for changing the recv syntax.
2011-05-27 12:01:20 -07:00
Tim Chevalier
147b088125
Test for use of break as an expression
...
The test was meant to verify that the typechecker correctly
allows a _|_ value (break, here) to be used in any context.
However, the compiler fails with an LLVM assertion failure.
I xfailed it, but wanted it to be on the record anyway.
2011-05-26 20:52:05 -07:00
Tim Chevalier
1a96e79fe0
Make _|_ unify with anything
...
The typechecker had a number of special cases for unifying types
with _|_ (as with checking if and alt). But, a value of type _|_
should be usable in any context, as such a value always diverges,
and will never be used by its immediate context. Changed unify
accordingly, removed special cases.
2011-05-26 20:50:25 -07:00
Paul Stansifer
af6b4821c1
Handle circularity in glob imports in a more elegant fashion.
2011-05-27 02:42:33 +00:00
Paul Stansifer
7fe3d821ac
Add a map from def_id s to items in resolve::env.
...
Use it to provide better error messages in the event of
glob-importing the same name multiple times.
2011-05-27 02:42:33 +00:00
Paul Stansifer
54ca8565c9
Fix bugs: make sure glob imports show up in the right module,
...
and make sure that circular glob imports don't diverge.
2011-05-27 02:42:33 +00:00
Paul Stansifer
3375b8fba2
Add list function 'has'.
2011-05-27 02:42:33 +00:00
Paul Stansifer
40fe44d23e
"import module::*;" now works.
2011-05-27 02:42:33 +00:00
Paul Stansifer
22953f52fa
Added filter_map.
2011-05-27 02:42:33 +00:00
Graydon Hoare
fc31aa7f85
Fix testcase to be slightly less fussy about line number of error, as it just drifted.
2011-05-26 18:29:28 -07:00
Tim Chevalier
4f792f2dbb
Track spans for each local variable in typestate
...
This lets us print better messages in situations with name
shadowing.
2011-05-26 18:14:32 -07:00
Graydon Hoare
8e945dcd81
Remove native glues. All calls to C are direct now.
2011-05-26 16:45:01 -07:00
Brian Anderson
29a801565a
rustc: Fail better when the first argument to #fmt is not a string literal
2011-05-25 23:50:19 -04:00
Brian Anderson
c4e9d8fb91
rustc: Fail when #fmt is given too many arguments
2011-05-25 23:43:04 -04:00
Brian Anderson
70106f35ce
test: Fix run-fail testing and bring tests up to date
...
A typo in the Makefile was causing these to not run. Happily, a lot of these
tests pass, so un-xfailed.
2011-05-24 22:09:12 -04:00
Brian Anderson
763380a2cc
test: xfail vector-no-ann-2 in stage0
2011-05-24 22:08:08 -04:00
Brian Anderson
6473b73174
rustc: Use demand functions instead of open-coded typecheck for spawn
...
Un-xfail spawn-non-nil-fn
2011-05-24 20:23:21 -04: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
Marijn Haverbeke
fbc0e840e3
Stop showing a 'cyclic import' message for unresolved imports
...
This only happened for single-length import paths, because the import
was being looked up in its own scope.
2011-05-24 20:58:38 +02:00
Tim Chevalier
bad05e20a3
Improve nonexistent-module error message
...
The error message for (for example) "import vec;" without "use std;"
was "cyclic import", which was misleading because there were no
cycles. I changed it to "cyclic import or nonexistent module",
which doesn't break existing tests.
2011-05-24 10:47:58 -07:00
Brian Anderson
029c1e71ff
test: Remove compile-fail/export-boot.rs
...
This was a rustboot-specific test which is covered by other tests in rustc.
2011-05-23 23:13:18 -04:00
Brian Anderson
e5e2811bc6
test: Un-xfail some compile-fail tests
...
Changed a few error patterns to match rustc's errors where it seemed
reasonable.
2011-05-23 23:13:18 -04:00
Tim Chevalier
c22100ab2d
Un-XFAIL vector-no-ann
...
and update it to reflect the new friendly error message
2011-05-23 19:46:27 -07:00
Brian Anderson
776977b755
test: Un-xfail some working tests
2011-05-23 22:41:37 -04:00
Tim Chevalier
b620be9cd2
Typecheck @[] correctly
...
Previously, if you wrote
let @vec[int] foo = @[];
that would be a type error. That didn't seem right, so I changed
pushdown to unify the inner type in an unop application with the
argument type of the operator type.
2011-05-23 17:17:49 -07:00
Marijn Haverbeke
edf95efae8
Un-xfail test/run-pass/mlist
2011-05-23 23:25:55 +02:00
Marijn Haverbeke
dc2cdbf4a1
Un-xfail test/run-pass/use-import-export
2011-05-23 23:25:54 +02:00
Brian Anderson
10c904bc6a
stdlib: Add regression tests for std::str
2011-05-22 12:28:27 -04:00
Brian Anderson
f6777db615
stdlib: Add regression tests for std::map
2011-05-22 12:28:20 -04:00
Brian Anderson
bac68e4af3
stdlib: Add regression tests for std::list
2011-05-22 02:10:10 -04:00
Brian Anderson
b4c9f782e4
stdlib: Add list::from_vec
2011-05-22 02:10:10 -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
079711d5f6
stdlib: Add regression tests for std::getopts
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
d7d387171c
test: Un-xfail alias-uninit-value.rs. Closes #374 .
...
This started working correctly at some point.
2011-05-22 02:03:07 -04:00
Brian Anderson
8102926b4b
test: Use more sensible cases in expr-alt-fail-all.
...
Thanks for the review, Jesse.
2011-05-21 20:01:38 -04:00
Brian Anderson
420d18a448
test: Adda test that all arms of an alt may result in fail
2011-05-21 18:31:40 -04:00
Brian Anderson
4bcdf57d78
test: Add a test for mismatched types of if branches
2011-05-21 18:18:48 -04:00
Brian Anderson
e24d7ae967
rustc: If all if branches are _|_, then the entire if is _|_
2011-05-21 18:18:48 -04:00
Brian Anderson
b62bf8cede
rustc: Allow if expressions to fail
2011-05-21 14:22:01 -04:00
Brian Anderson
6824f119fc
rustc: Allow alt expressions to fail
2011-05-21 13:22:01 -04:00
Tim Chevalier
7b4eec215c
Some tests for ! annotations
2011-05-20 19:54:14 -07:00
Tim Chevalier
a1b440baaa
Un-XFAIL some tests that now pass.
2011-05-20 19:54:14 -07:00
Tim Chevalier
77f56f3154
XFAIL two tests for stage0
2011-05-20 19:54:14 -07:00
Tim Chevalier
467b938ea8
Merge remote-tracking branch 'graydon/master' into typestate_4
2011-05-20 18:23:03 -07:00
Tim Chevalier
5de9d27fcc
un-XFAIL forgot-ret and update error pattern
2011-05-20 18:20:54 -07:00
Lindsey Kuper
c3410bf927
More work on anonymous objects.
2011-05-20 17:59:56 -07:00
Eric Holk
51e1ce292d
Added a couple of test cases for sending messages. One works as expected, the other succeeds unexpectedly.
2011-05-20 16:51:08 -07:00
Brian Anderson
b6d2fe4d74
rustc: Translate else if blocks the same as other blocks. Closes #388
2011-05-19 23:32:09 -04:00
Brian Anderson
879a952a37
rustc: Find the correct outer scope in trans_block
2011-05-19 23:32:08 -04: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
Marijn Haverbeke
8a7b544995
Finish name collision testing.
...
And fix a the single screw-up in the source code it caught.
2011-05-19 21:58:57 +02:00
Graydon Hoare
0a74ffaea3
xfail vector-no-ann.rs.
2011-05-19 12:18:23 -07:00
Lindsey Kuper
38b37fcbdb
Checking to make sure we know what 'self' is in nested objects.
2011-05-19 11:52:27 -07:00
Tim Chevalier
8cbdaf4f93
Make trans use span_err for the dreaded "ty_var in trans::type_of" error
...
This required quite a bit of tiresome plumbing about of spans.
On the bright side, now other errors can be converted to span_err too.
Includes test cases.
2011-05-19 11:40:16 -07:00
Brian Anderson
a98ea4f3ef
rustc: Run block cleanups on else if blocks
...
With the scheme used to translate 'else if' currently the if expression is
translated in a new (else) scope context. If that if expression wants to
result in a value that requires refcounting then it will need to drop the
refcount in the cleanups of the else block.
2011-05-17 22:25:24 -04:00
Marijn Haverbeke
09d8ef8d51
Finally rename std::_xxx to std::xxx
...
Except for _task, which is still a keyword.
2011-05-17 20:41:41 +02:00
Paul Stansifer
1fdc75ee7c
Parser fix: 'fail' was eating the next token that came after it.
2011-05-17 05:40:17 +00:00
Brian Anderson
fbfd8552ab
Return a better result from blocks. Closes issue #377
...
Blocks return in a copy of the result of their ending expression, not the
direct result of the ending expression, as that may be a local variable which
gets zeroed by drop_slot.
2011-05-17 00:46:56 -04:00
Graydon Hoare
cc27e0f8c6
Update a couple tests that slipped through.
2011-05-16 19:08:59 -07:00
Graydon Hoare
a2e2e78103
Merge remote branch 'origin/master' into HEAD
...
Conflicts:
src/comp/middle/trans.rs
2011-05-16 19:04:45 -07:00
Graydon Hoare
fbbc1a77d2
Rewrite everything to use [] instead of vec() in value position.
2011-05-16 18:21:22 -07:00
Tim Chevalier
b42bb2cff2
Two tests that the typechecker correctly unifies type arguments in patterns with their expected tag types
2011-05-16 16:59:30 -07:00
Tim Chevalier
971b5d5151
Started adding support for return checking and non-returning function annotations
...
* Reorganized typestate into several modules.
* Made typestate check that any function with a non-nil return type
returns a value. For now, the check is a warning and not an error
(see next item).
* Added a "bot" type (prettyprinted as _|_), for constructs like be, ret, break, cont, and
fail that don't locally return a value that can be inspected. "bot"
is distinct from "nil". There is no concrete syntax for _|_, while
the concrete syntax for the nil type is ().
* Added support to the parser for a ! annotation on functions whose
result type is _|_. Such a function is required to have either a
fail or a call to another ! function that is reached in all control
flow paths. The point of this annotation is to mark functions like
unimpl() and span_err(), so that an alt with a call to err() in one
case isn't a false positive for the return-value checker. I haven't
actually annotated anything with it yet.
* Random bugfixes:
* * Fixed bug in trans::trans_binary that was throwing away the
cleanups for nested subexpressions of an and or or
(tests: box-inside-if and box-inside-if2).
** In typeck, unify the expected type arguments of a tag with the
actual specified arguments.
2011-05-16 16:59:25 -07:00
Brian Anderson
f33d490032
Remove xfail-boot lines from tests
2011-05-14 21:05:22 -04:00
Brian Anderson
ec30c71296
Add a regression test for issue #374 (XFAILed)
2011-05-14 13:29:49 -04:00
Brian Anderson
fb76c25729
WIP
2011-05-14 13:11:37 -04:00
Lindsey Kuper
5679f5c55e
'with' no longer a token; whitespace police.
...
Plus renaming the anonymous objects test to a more descriptive name,
and XFAILing it because it doesn't work yet.
2011-05-13 17:37:01 -07:00
Lindsey Kuper
d3242b9644
Bug fixes.
...
Fixed infinite loop on anonymous objects in parser; added
expr_anon_obj to walk.rs; fixed syntax of test case.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
6c1c5b3948
More progress on anonymous objects.
...
Still segfaulting on the method-overriding.rs test, though.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
7c2979e26f
Starting on support for anonymous objects. Just syntax so far.
2011-05-13 17:35:12 -07:00
Marijn Haverbeke
7647b838a1
Remove reserved word tests (since reserved words were removed)
...
Ping me if you disagree, but I think that in a language that's as
in-flux as rust currently is, it is silly to try and enforce a single
future-compatibility. The reserved words didn't work well with the
parser refactor, so I dropped them for the time being. We can,
eventually, bring them back as type-only reserved words.
2011-05-13 22:00:13 +02:00
Marijn Haverbeke
ae26b775b4
Implement module namespaces
...
Module names no longer clash with type and value names. The
tokenizer/parser still needs to be taught to be more careful in
identifying keywords, so that we can use 'str' and 'vec' and so as
module names.
2011-05-13 17:20:46 +02:00
Marijn Haverbeke
1a12a7b04b
Make module indices hold a list of items
...
This way, they can support having both a type and a value
of the same name.
2011-05-13 13:34:59 +02:00
Marijn Haverbeke
58ec5d1654
Move capture checking into resolve.rs
...
Drops capture.rs. The new algorithm also checks for captures function
arguments and obj fields.
2011-05-13 12:44:05 +02:00
Marijn Haverbeke
9419c5df77
Fix mistaken replacements in error-pattern comments in tests
2011-05-12 21:45:29 +02:00
Marijn Haverbeke
3816e57fd2
Downcase std modules again, move to :: for module dereferencing
...
This should be a snapshot transition.
2011-05-12 21:30:44 +02:00
Marijn Haverbeke
5bea22d75c
Add a missed xfail-stage0
2011-05-11 16:44:42 +02:00
Marijn Haverbeke
e9c12ab1d0
Rewrite comp/middle/resolve.rs
...
* Cleans up the algorithm
* Move first pass to walk (second still folds)
* Support part of a type/value namespace split
(crate metadata and module indices still need to be taught about this)
* Remove a few blatant inefficiencies (import tables being recreated for
every lookup, most importantly)
2011-05-11 12:32:37 +02:00
Brian Anderson
e4c3287367
Reuse a single work buffer every time the SHA1 message block is processed.
...
This finally allows the full lib-sha1 test to run in a reasonable amount of
time. Was 30s, now 3s. Trims a second or two from stage2/rustc. XFAIL lib-sha1
in stage0 since it will be very slow until the next snapshot.
2011-05-11 01:38:17 -04:00
Brian Anderson
e35984b6c6
Introduce str_slice runtime function
...
This reduces the time to execute the new lib-str tests from 1:40ish to a few
seconds and will eventually allow the full lib-sha1 test to run in a
reasonable amount of time. XFAIL lib-str in stage0 - it will run very slowly
until the next snapshot.
2011-05-11 01:38:16 -04:00
Brian Anderson
4c70ddb162
Un-XFAIL syntax-extension-fmt.rs
2011-05-10 19:46:22 -04:00
Brian Anderson
92471efff4
Un-XFAIL compile-fail export tests for stage0
2011-05-10 19:18:38 -04:00
Patrick Walton
70c759030c
rustc: Alias fix part 2 -- Check that the aliasness of function parameters matches. Add a test case.
2011-05-09 14:00:50 -07:00
Marijn Haverbeke
d39ca857fc
Remove a few more superfluous 'mutable' keywords
2011-05-06 22:52:02 +02:00
Marijn Haverbeke
a3ec0b1f64
Rename std modules to be camelcased
...
(Have fun mergining your stuff with this.)
2011-05-06 22:51:19 +02:00
Kelly Wilson
850dff486e
Add quick sort function to the std lib.
2011-05-05 16:40:57 -07:00
Tim Chevalier
6b742aec91
Enforce in typechecker that preds return a bool
...
as well as a test case
2011-05-05 11:26:07 -07:00
Tim Chevalier
acf9bd7909
Test cases for pred / check stuff
2011-05-05 11:26:07 -07:00
Tim Chevalier
3060eadcba
Check well-formedness of constraints
...
Check that the operand in a constraint is an explicit name,
and that the operands are all local variables or literals. Still need
to check that the name refers to a pure function.
2011-05-05 11:26:07 -07:00
Tim Chevalier
bc5650a9d0
Change checks to asserts in test/bench files
2011-05-05 11:26:07 -07:00
Tim Chevalier
4f892dd9d7
Check that the operand in a check is a call
...
In addition, fix bug in fold that was turning asserts into checks.
More typechecking still needs to be done.
2011-05-05 11:26:07 -07:00
Tim Chevalier
59a0e98096
Un-XFAILed not-a-pred in stage0 (it fails correctly)
2011-05-05 11:26:07 -07:00
Marijn Haverbeke
1f45dda9d2
Remove 'deprecated mutable...' from our code
...
This should make compilation a bit less noisy.
2011-05-05 20:19:43 +02:00
Marijn Haverbeke
3d738e9e06
Return a fresh, unreachable context after ret, break, and cont
...
This ensures we don't get compile errors on unreachable code (see
test/run-pass/artificial-block.rs for an example of sane code that
wasn't compiling). In the future, we might want to warn about
non-trivial code appearing in an unreachable context, and/or avoid
generating unreachable code altogether (though I'm sure LLVM will weed
it out as well).
2011-05-05 20:19:43 +02:00
Brian Anderson
bd34770a92
Add missing ret statements to check_mod
...
Un-XFAIL compile-fail export tests
2011-05-04 19:29:27 -04:00
Graydon Hoare
b73a640ce0
More export XFAILs.
2011-05-04 15:35:41 -07:00
Graydon Hoare
978e3d0f4a
XFAIL some compile-fail tests mysteriously failing on win32 tinderbox.
2011-05-04 14:44:57 -07:00
Graydon Hoare
4642d7a355
extend xfail-stage0 to stage1, stage2 on obj-dtor-2.rs
2011-05-04 11:23:05 -07:00
Graydon Hoare
456398a403
Change two compile-fail patterns to match rustc output.
2011-05-04 11:20:47 -07:00
Graydon Hoare
c36645b358
Assume xfail-stage0 implies stage1 and stage2 in tests, for now.
2011-05-03 18:14:02 -07:00
Patrick Walton
2bc17adc29
Revert "Rename the "llvm" API to "llvm-intrinsic"" due to tinderbox bustage
...
This reverts commit 6871c245a6
.
2011-05-03 17:50:37 -07:00
Patrick Walton
6871c245a6
Rename the "llvm" API to "llvm-intrinsic"
2011-05-03 15:55:01 -07:00
Brian Anderson
3014a5887d
Add some tests of tag-export interaction
2011-05-02 22:06:35 -04:00
Brian Anderson
2fc58fc6a0
Revert "Use check instead of assert in export-unexported-dep"
...
This reverts commit 480eda0f10
. The commit
adding the assert keyword has been restored.
2011-05-02 20:56:46 -04:00
Patrick Walton
a833f152ba
rustc: Remove the artificial block in ty.rs. Fixes self-hosting. Add a test case for this, XFAIL'd.
2011-05-02 17:50:46 -07:00
Patrick Walton
147a2d655f
Un-revert "Use different syntax for checks that matter to typestate", fixing the problem.
...
This reverts commit d08b443fff
.
2011-05-02 17:50:46 -07:00
Brian Anderson
480eda0f10
Use check instead of assert in export-unexported-dep
2011-05-02 20:48:52 -04:00
Graydon Hoare
d08b443fff
Revert "Use different syntax for checks that matter to typestate"
...
This reverts commit aa25f22f19
. It broke stage2, not sure why yet.
2011-05-02 17:35:33 -07:00
Brian Anderson
764de078e7
Add a regression test that exports can expose unexported items
...
While those unexported items can't be used by name outside the module in which
they are defined, they can be used as a sort of ADT.
2011-05-02 19:42:00 -04:00
Tim Chevalier
aa25f22f19
Use different syntax for checks that matter to typestate
...
This giant commit changes the syntax of Rust to use "assert" for
"check" expressions that didn't mean anything to the typestate
system, and continue using "check" for checks that are used as
part of typestate checking.
Most of the changes are just replacing "check" with "assert" in test
cases and rustc.
2011-05-02 12:16:29 -07:00
Brian Anderson
a5ccead3fd
Add a test that imports can't circumvent exports
2011-05-01 17:22:20 -04:00
Brian Anderson
f25e678365
Add a regression test for use of unexported fully-qualified paths
...
An unexported foo.baz can't be resolved from inside foo when called as foo.baz
instead of just baz. This behavior may want to change eventually.
2011-05-01 16:57:36 -04:00
Brian Anderson
a697210234
Hide unexported tag variants
2011-05-01 16:57:36 -04:00
Brian Anderson
459b0ec833
Implement simple module export
2011-05-01 16:57:36 -04:00
Brian Anderson
e75edd5e43
Fix expr-alt-generic-box2.rs and un-XFAIL
2011-05-01 12:21:08 -04:00
Brian Anderson
831b0a7501
Un-XFAIL various tests in stage0
2011-05-01 12:15:42 -04:00
Graydon Hoare
02336e670f
Re-XFAIL lib-io.rs, not quite working yet.
2011-04-29 16:55:45 -07:00
Graydon Hoare
c11d9f4268
Un-XFAIL most library tests.
2011-04-29 15:06:53 -07:00
Patrick Walton
6daf440037
rustc: Fix vec append glue for strings. Add a test case.
2011-04-28 20:16:32 -07:00
Patrick Walton
3e08609ed7
rustc: Add some value names to the vec append glue function. Un-XFAIL vec-growth.rs.
2011-04-28 18:45:56 -07:00
Patrick Walton
96d4577376
test: Add a test case for vec growth
2011-04-28 18:23:39 -07:00
Graydon Hoare
e300b8047f
Consider unop deref as an lval. Un-XFAIL vec-push.
2011-04-28 16:37:18 -07:00
Patrick Walton
f2fe26a821
rustc: Add a testcase for vector push (mutable aliases with *, really)
2011-04-28 16:22:13 -07:00
Graydon Hoare
f0e1bb75d1
Change vec-ref-count to handle 1 or 2, so long as non-leaky and non-creeping. un-XFAIL.
2011-04-28 14:50:03 -07:00
Patrick Walton
ffbbf42edd
test: Add a test for vector reference counts, XFAIL'd in rustc
2011-04-28 14:35:22 -07:00
Tim Chevalier
26e177a97a
Enable typestate_check
...
Enable typestate checking (just for uninitialized vars) and un-XFAIL the
relevant tests for stage0.
2011-04-28 13:26:19 -07:00
Tim Chevalier
844fe20720
Fix some nested patterns in rustc
...
In rustc, nested patterns were potentially matching when they shouldn't
match, because a loop index wasn't being incremented. Fixed it and added
one test case.
2011-04-28 13:26:19 -07:00
Tim Chevalier
25694582d9
Fix bug in handling of expr_alt (postcond for alts was being intersected with postcond for scrutinee)
2011-04-28 13:26:19 -07:00
Tim Chevalier
0190ebfe07
Support all expression forms in typestate
...
Added support for self_method, cont, chan, port, recv, send, be,
do_while, spawn, and ext; handled break and cont correctly.
(However, there are no non-xfailed test cases for ext or spawn in
stage0 currently.)
Although the standard library compiles and all test cases pass with
typestate enabled, I left typestate checking disabled as rustc
terminates abnormally when building the standard library if so,
even though it does generate code correctly.
2011-04-28 13:26:19 -07:00
Tim Chevalier
7c4f8cb459
Further work on typestate_check
...
Lots of work on typestate_check, seems to get a lot of the way
through checking the standard library.
* Added for, for_each, assign_op, bind, cast, put, check, break,
and cont. (I'm not sure break and cont are actually handled correctly.)
* Fixed side-effect bug in seq_preconds so that unioning the
preconditions of a sequence of statements or expressions
is handled correctly.
* Pass poststate correctly through a stmt_decl.
* Handle expr_ret and expr_fail properly (after execution of a ret
or fail, everything is true -- this is needed to handle ifs and alts
where one branch is a ret or fail)
* Fixed bug in set_prestate_ann where a thing that needed to be
mutated wasn't getting passed as an alias
* Fixed bug in how expr_alt was treated (zero is not the identity
for intersect, who knew, right?)
* Update logging to reflect log_err vs. log
* Fixed find_locals so as to return all local decls and exclude
function arguments.
* Make union_postconds work on an empty vector (needed to handle
empty blocks correctly)
* Added _vec.cat_options, which takes a list of option[T] to a list
of T, ignoring any Nones
* Added two test cases.
2011-04-28 13:26:19 -07:00
Brian Anderson
8216b5fc10
Fix the interaction between various flags in #fmt
2011-04-26 20:49:03 -04:00
Brian Anderson
2e12fbfc06
Support octal #fmt conversions
2011-04-26 20:20:17 -04:00
Brian Anderson
66b59e4b05
Make #fmt char conversions behave like printf
2011-04-26 20:20:17 -04:00
Graydon Hoare
912c1fc81c
Fix busted iter/put code. Un-XFAIL foreach-box-drop.rs.
2011-04-23 14:22:10 -07:00
Graydon Hoare
3b047bad6e
New minimal test for current stage2 blocker.
2011-04-22 02:07:41 +00:00
Patrick Walton
c78b73b71d
test: Un-XFAIL drop-parametric-closure-with-bound-box.rs, oops.
2011-04-21 17:36:10 -07:00
Patrick Walton
11c359962e
test: XFAIL lib-box on stage0. Upstream LLVM doesn't have the library reading patch yet.
2011-04-21 17:35:25 -07:00
Patrick Walton
735435bf96
stdlib: Add a pointer equality function to the standard library and a test case
2011-04-21 16:44:17 -07:00
Graydon Hoare
9034a8fbd6
Fix #335 , log context needs to be a scope to capture cleanups.
2011-04-20 04:55:55 +00:00
Graydon Hoare
d1b9ddc8d4
Add testcase for bootstrap blocker and fix for each result type to nil.
2011-04-19 16:53:12 -07:00
Graydon Hoare
928b25c9fb
Un-XFAIL a few recently passing tests.
2011-04-19 15:41:45 -07:00
Patrick Walton
0ee997cee6
rustc: Make structured comparison glue instead of emitting it inline
2011-04-19 15:29:27 -07:00
Tim Chevalier
b7dd75c904
Handle nested items correctly in typestate_check
...
Summary says it all. Actually, only nested objects and functions
are handled, but that's better than before. The fold that I was using
before to traverse a crate wasn't working correctly, because annotations
have to reflect the number of local variables of the nearest enclosing
function (in turn, because annotations are represented as bit vectors).
The fold was traversing the AST in the wrong order, first filling in
the annotations correctly, but then re-traversing them with the bit
vector length for any outer nested functions, and so on.
Remedying this required writing a lot of tedious boilerplate code
because I scrapped the idea of using a fold altogether.
I also made typestate_check handle unary, field, alt, and fail.
Also, some miscellaneous changes:
* added annotations to blocks in typeck
* fix pprust so it can handle spawn
* added more logging functions in util.common
* fixed _vec.or
* added maybe and from_maybe in option
* removed fold_block field from ast_fold, since it was never used
2011-04-19 14:56:28 -07:00
Graydon Hoare
d2bd07dcb0
Remove effect system from src.
2011-04-19 13:35:49 -07:00
Brian Anderson
7f90000ab6
Precision overrides 0-padding in #fmt
2011-04-18 22:53:26 -04:00
Brian Anderson
869b28e393
Left-justification overrides 0-padding in #fmt
2011-04-18 21:36:04 -04:00
Brian Anderson
d4f1a48111
Support 0 flag in #fmt
2011-04-18 21:36:04 -04:00
Graydon Hoare
8a6590a75f
Remove use of 'use' from type-params-in-for-each.rs, put out darwin fire.
2011-04-18 12:20:50 -07:00
Brian Anderson
9976bb93d6
Support the space flag in #fmt
2011-04-17 19:50:58 -04:00
Brian Anderson
86a43c24d6
Support + flag in #fmt
2011-04-17 18:19:26 -04:00
Brian Anderson
1bec738c56
Support #fmt precision for bools, with same rules as strings
...
Not totally confident this is desirable. The alternative would be to make it a
compile error.
2011-04-17 17:24:17 -04:00
Brian Anderson
da996d6e6b
Fix indentation in syntax-extension-fmt.rs
2011-04-17 17:12:20 -04:00
Brian Anderson
685e820465
Treat char #fmt conversions just like str conversions
...
Add missing tests
2011-04-17 17:06:55 -04:00
Brian Anderson
8f6603f58e
Support #fmt precision for signed types
2011-04-17 16:51:17 -04:00
Brian Anderson
4c0aea69da
Support #fmt precision for unsigned types
2011-04-17 16:18:25 -04:00
Brian Anderson
c7edcb3a72
Support #fmt precision for string types
2011-04-17 13:10:02 -04:00
Brian Anderson
96e3e29e88
Support left-justification in #fmt conversions
2011-04-16 19:43:29 -04:00
Brian Anderson
f7b68e9edd
Add another test for #fmt conversion widths
2011-04-16 18:22:14 -04:00
Brian Anderson
dcfdb02fab
Make #fmt support explicit conversion widths
2011-04-16 18:01:17 -04:00
Brian Anderson
07e820089f
More tests for #fmt
2011-04-16 18:01:17 -04:00
Patrick Walton
0c288720b6
rustc: Capture type parameters into for-each blocks. Add a test case.
2011-04-15 18:14:29 -07:00
Graydon Hoare
232c450957
Work on destructors, not entirely functional yet (no tydesc integration).
2011-04-14 16:50:59 -07:00
Patrick Walton
55ab187c9c
rustc: Add a test case for previous commit
2011-04-14 12:51:27 -07:00
Brian Anderson
99a697b56a
Add support for upper-case hex and binary output to #fmt.
...
Only works for uints at present. Necessitated the addition of _str.to_upper.
2011-04-13 22:14:54 -04:00
Brian Anderson
4844e1c08a
Add support for printing uints as lower-case hex to ExtFmt.
...
Begin passing an ExtFmt.RT.conv parsed format description to each of the
ExtFmt.RT.conv* functions.
2011-04-13 22:14:24 -04:00
Brian Anderson
44aed626bf
Add ExtFmt test for unsigned type
2011-04-13 22:13:04 -04:00
Brian Anderson
330fdd2b04
Fix a typo in test expr-alt-generic-box1.rs
2011-04-13 21:46:20 -04:00
Graydon Hoare
eb33a5307b
Remove gc() call from end of lib-map.rs, works on stage0 otherwise (stage0 produces no gc info)
2011-04-13 15:47:05 -07:00
Graydon Hoare
afeb3a417c
Fix temporary-spilling logic in trans_args, uncomment most of lib-deque.rs (which now passes on stage0).
2011-04-13 15:21:54 -07:00
Graydon Hoare
0910a7323c
Add generic-temporary.rs minimal test showing cause of lib-deque.rs failure on stage0.
2011-04-13 13:21:06 -07:00
Graydon Hoare
2c65e10a9f
Fix lib-deque.rs to pass typarams by alias.
2011-04-13 12:29:34 -07:00
Graydon Hoare
80a4b1ba53
Slight updates to match API drift in io, lib-io.rs passes.
2011-04-13 12:05:15 -07:00
Graydon Hoare
5f6abdc0e8
Un-XFAIL generic-tag-corruption.rs.
2011-04-12 12:58:43 -07:00
Brian Anderson
bba245f3e6
Add support for bool, char to extfmt.
...
XFAIL syntax-extension-fmt in rustboot.
2011-04-11 21:54:03 -04:00
Graydon Hoare
d218df02bf
Add new minimal testcase showing generic tag memory corruption.
2011-04-11 15:00:18 -07:00
Rafael Ávila de Espíndola
cca6335c26
Implement the "attempted dynamic environment-capture" error in rustc.
2011-04-11 15:35:01 -04:00
Brian Anderson
1f04c3dcef
Un-XFAIL expr-block-fn.rs
...
It mysteriously works now.
2011-04-10 16:25:09 -04:00
Marijn Haverbeke
6109dba305
Disable effect checking in rustboot
2011-04-08 18:44:58 +02:00
Brian Anderson
0abccc6370
Add a test case for calling generic functions taking alias args with box types
2011-04-07 22:23:07 -04:00
Brian Anderson
a4f8de382a
Add an XFAILed test for blocks that result in functions
2011-04-07 22:13:39 -04:00
Brian Anderson
d2d42fd4c7
Make block results work for generic types
...
I think just about every type can be used as a block result now. There's quite
a proliferation of tests here, but they all test slightly different things and
some are split out to remain XFAILed. The tests of generic vectors are still
XFAILed because generic aliased boxes still don't work in general.
2011-04-07 21:58:36 -04:00
Lindsey Kuper
21b31a350a
Updated test to use 'check' rather than just logging results.
2011-04-07 15:22:34 -07:00
Lindsey Kuper
1092bbfff0
Support for self-calls that take arguments.
...
Nicer parsing of self-calls (expr_self_method nodes inside expr_call
nodes, rather than a separate expr_call_self) makes typechecking
tractable. We can now write self-calls that take arguments and return
values (see: test/run-pass/obj-self-*.rs).
2011-04-07 14:26:34 -07:00
Patrick Walton
08bf4d1f19
"xfail-stage0", not "XFAIL-stage0"
2011-04-07 13:53:11 -07:00
Patrick Walton
3236e6008c
XFAIL lib-option.rs in stage0 due to crash on Darwin on tinderbox
2011-04-07 13:44:20 -07:00
Patrick Walton
a97a200413
Fix effect on deref-lval
2011-04-07 13:30:50 -07:00
Patrick Walton
015c0d0d59
rustc: Allow dereference expressions to be used as lvalues. Add a test case.
2011-04-07 12:51:27 -07:00
Patrick Walton
cd6962f29d
rustc: Link to external tag discriminants. Un-XFAIL test/run-pass/lib-option.rs.
2011-04-07 11:42:40 -07:00
Graydon Hoare
36d75d6391
Minimal testcase for next bootstrap blocker.
2011-04-06 08:33:24 -07:00
Graydon Hoare
52abd912c0
Brute force and ignorance workaround for tag-and-generic-obj; un-XFAIL it.
2011-04-05 21:08:13 -07:00
Graydon Hoare
8382990627
Add new minimal test for current blocker on bootstrapping.
2011-04-05 17:27:55 -07:00
Brian Anderson
1326d424c9
Add more tests for alt expressions
2011-04-02 20:35:51 -04:00
Brian Anderson
21fb49ad95
Join the results of alt arms so alt can be used as an expression.
...
Un-XFAIL expr-alt.rs.
2011-04-02 20:35:50 -04:00
Brian Anderson
1bc06bc59b
Cleanup typos and newlines
2011-04-01 00:05:13 -04:00
Brian Anderson
efb738153c
Add an XFAILed test for treating alts as expressions
2011-03-31 23:23:27 -04:00
Brian Anderson
dcf04ffbad
Un-XFAIL expr-if-box.rs
2011-03-31 23:15:11 -04:00
Brian Anderson
cf16f4f7e5
Add a test for block expressions of generic types. XFAILed
2011-03-31 23:15:11 -04:00
Brian Anderson
c27b72e323
Add another test for blocks as expressions
2011-03-31 23:15:11 -04:00
Brian Anderson
19a949c15e
Un-XFAIL expr-block-box.rs
2011-03-31 23:15:11 -04:00
Brian Anderson
bd1c61548e
Move str test from expr-if.rs to expr-if-box.rs in preperation for breaking that code path.
2011-03-31 23:15:11 -04:00
Brian Anderson
2490cd3275
Add a test for block expressions that have results. XFAILed.
2011-03-31 23:15:11 -04:00
Graydon Hoare
b5a4336487
Re-XFAIL lib-int.rs and lib-uint.rs.
2011-03-29 23:10:28 -07:00
Graydon Hoare
61e5587eab
Re-XFAIL lib-bitv.rs harder
2011-03-29 22:58:50 -07:00
Graydon Hoare
51807ad628
Re-XFAIL lib-bitv.rs
2011-03-29 22:08:35 -07:00
Patrick Walton
b09e09c673
rustc: Un-XFAIL lib-uint.rs
2011-03-29 18:16:53 -07:00
Patrick Walton
601cf8c97f
rustc: Un-XFAIL lib-int.rs.
2011-03-29 17:31:48 -07:00
Patrick Walton
626bdaaa1f
rustc: Parse parameter IDs in external crate metadata. Un-XFAIL lib-bitv.rs.
2011-03-29 17:25:55 -07:00
Lindsey Kuper
55fbed3d8d
Beginnings of support for magical self prefix; nothing profound happening yet.
2011-03-29 15:59:15 -07:00
Brian Anderson
8f2a97a562
Add partial support for if expressions resulting in generic types
2011-03-28 21:14:08 -07:00
Brian Anderson
38d5453584
Add an XFAILed test for if expressions resulting in boxes
2011-03-28 21:14:06 -07:00
Brian Anderson
aced4ce145
Handle structural types as the result of if expressions
2011-03-28 21:14:04 -07:00
Brian Anderson
a5a319fa04
Teach rustc to use the result of if expressions
2011-03-28 21:14:03 -07:00
Graydon Hoare
268b2140dc
Add long-while.rs to check on frame growth.
2011-03-28 18:07:29 -07:00
Graydon Hoare
540d29f641
Move all allocas to dedicated basic block at top of function, to keep frames finite. Un-comment next size in nbody.rs.
2011-03-28 18:07:29 -07:00
Patrick Walton
1cb3ce89dd
shootout: Hoist out the movement too; switch square root to an LLVM intrinsic
2011-03-28 08:24:58 -07:00
Marijn Haverbeke
6ecdc04788
Add support for break and cont to rustc
...
Testing proper cleanup is hampered by
https://github.com/graydon/rust/issues/293
2011-03-27 14:11:23 +02:00
Patrick Walton
9c5affda1a
shootout: Hoist out the vector indexing on nbody; don't rely on LICM, which isn't working for some reason (insufficient alias info?) Speeds up nbody a bit.
2011-03-26 23:10:28 -07:00
Lindsey Kuper
2650487120
Got the nbody demo working, and hopefully faster, too!
2011-03-26 17:51:54 -07:00
Lindsey Kuper
1c1c67229a
Updates to the nbody demo.
2011-03-26 17:51:42 -07:00
Graydon Hoare
49d9d5688e
Switch xfail system to use comments embedded in source files.
2011-03-25 12:19:20 -07:00
Tim Chevalier
a47cd50dfb
Parse FP literals without coercing to int. This allows parsing 64-bit
...
floats. However, if someone writes a literal that can't be represented
precisely in 64 bits, the front-end will accept it while the back-end
will (presumably) complain.
2011-03-25 11:20:30 -07:00
Brian Anderson
ef1bcdea70
Add test for local declarations with receive. XFAIL in rustc.
2011-03-25 11:01:52 -07:00
Marijn Haverbeke
a045514477
Start making the standard-lib utf-8 aware
...
Finally implements _str.is_utf8, adds from_chars, from_char, to_chars,
char_at, char_len, (push|pop|shift|unshift)_char. Also, proper
character I/O for streams.
2011-03-25 08:22:52 -07:00
Lindsey Kuper
bcc104ce79
A first stab at the 'nbody' demo, with support for calling C sqrt().
2011-03-25 00:15:56 -07:00
Lindsey Kuper
0b63512f4c
Support for 'float' in type signatures.
2011-03-23 16:01:29 -07:00