Commit Graph

709 Commits

Author SHA1 Message Date
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
Tim Chevalier
23e23bd762 Further support for floating-point. Literals with exponents work
and literals with the 'f32' or 'f64' suffixes work as well. In
addition, logging things with the f32 or f64 type works. (float is
still assumed to be a synonym for f64).
2011-03-22 17:31:27 -07:00
Patrick Walton
804771510e Add a test case for empty mutable vector literals, XFAIL'd in rustboot 2011-03-22 16:48:00 -07:00
Tim Chevalier
8556b2c1ad Added test case for floats 2011-03-22 09:42:31 -07:00
Brian Anderson
1689d99965 Add some nesting to the else-if test case 2011-03-22 08:11:38 -07:00
Brian Anderson
0bcf49305c Add test for sending strings over channels 2011-03-22 08:04:51 -07:00
Brian Anderson
3dcb79dac9 Add a regression test for channels of nil, which happens to work in rustc, but not in rustboot 2011-03-22 08:04:47 -07:00