Commit Graph

2112 Commits

Author SHA1 Message Date
Niko Matsakis
9086c6f5a2 merge all auto_serialize tests into one 2012-03-13 21:30:07 -04:00
Niko Matsakis
b30cb8e43a implement deserialization, rename mk_mem_buffer() to mem_buffer() 2012-03-13 21:30:07 -04:00
Niko Matsakis
d91742294f first (functional) version of the auto_serialize syntax ext 2012-03-13 21:30:07 -04:00
Brian Anderson
aeb445b2ea rustc: Don't make the while loop body's basic block a child of the condition
As a child of the condition, when the body encounters a ret or break it
incorrectly re-runs the cleanups of the condition.
2012-03-13 17:27:17 -07:00
Brian Anderson
b968c8e6cd Name types after their modules instead of 't' 2012-03-13 15:14:17 -07:00
Brian Anderson
cd72b1f848 Overhaul constructor naming in libs 2012-03-13 11:07:22 -07:00
Kevin Atkinson
15985277b9 Fix Issue #1926 by sorting the gather list. 2012-03-13 07:40:41 -04:00
Graydon Hoare
6f5853f5a1 Libc/os/run/rand/io reorganization. Close #1373. Close #1638.
- Move io, run and rand to core.
 - Remove incorrect ctypes module (use libc).
 - Remove os-specific modules for os and fs.
 - Split fs between core::path and core::os.
2012-03-12 20:08:29 -07:00
Tim Chevalier
664d71f1f0 Improve a typechecker error message (wrong type for main())
As per #1903, state what type is expected for main().

Closes #1903
2012-03-11 20:55:19 -07:00
Tim Chevalier
813c41362b A few tests for infinite loops 2012-03-11 20:17:27 -07:00
Tim Chevalier
d3035a1b20 Fix test so it terminates, and un-xfail it
Still need more tests for loop{}
2012-03-10 21:19:02 -08:00
Tim Chevalier
9838a7ec54 Tweak some test cases and add a few new ones 2012-03-10 20:38:03 -08:00
Tim Chevalier
98260a2a22 Handle infinite-loop poststate correctly in typestate
If control passes an infinite loop (that doesn't have non-local
exits), then everything is true.
2012-03-10 20:15:27 -08:00
Brian Anderson
6d4fb35912 core Remove vec::enum_chars/uint. Closes #1955 2012-03-10 17:07:23 -08:00
Brian Anderson
a0f0a704b0 core: Clean up comments and exports 2012-03-10 00:35:02 -08:00
Tim Chevalier
321fd80219 Add an infinite loop construct
Add a loop {} construct for infinite loops, and use it in test
cases. See #1906 for details.
2012-03-09 16:40:58 -08:00
Patrick Walton
92ed73d0bd rustc: Add pretty printing support for the address-of operator. Un-XFAIL-pretty simple-regions.rs. 2012-03-08 18:10:07 -08:00
Patrick Walton
c40bfec45d test: Add a simple region test, xfail'd in the pretty printer 2012-03-08 17:45:36 -08:00
Tim Chevalier
0c5fdc8745 Rename last to last_opt, last_unsafe to last
As per discussion on IRC. I am about to file an RFC for further
discussion about the more general issue of whether to enforce
invariants through types, typestate, or dynamic checks, but for now,
removing the misleading name "last_unsafe".
2012-03-08 15:25:56 -08:00
Tim Chevalier
ebc1d3e704 Rename last_total to last_unsafe
See Issue 1943 for any discussion (reopen it if necessary).

Closes #1943
2012-03-08 13:07:31 -08:00
Niko Matsakis
2bfed908e3 Fix #1941: inlining of items that themselves contain nested items
The fix is to drop nested items from the encoded AST.  Nested items may
themselves be inlined, but that is an independent question.
2012-03-07 18:06:29 -08:00
Patrick Walton
c9375fed8d stdlib: Stop incurring vtable dispatch costs when hashmaps are used
This required changing almost all users of hashmaps to import the hashmap interface first.

The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 17:35:13 -08:00
Patrick Walton
c245d9e980 Revert "stdlib: Stop incurring vtable dispatch costs when hashmaps are used"
This reverts commit f0250a23d3.
2012-03-07 16:56:45 -08:00
Patrick Walton
f0250a23d3 stdlib: Stop incurring vtable dispatch costs when hashmaps are used
This required changing almost all users of hashmaps to import the hashmap interface first.

The `size` member in the hashmap structure was renamed to `count` to work around a name conflict.
2012-03-07 16:51:31 -08:00
Tim Chevalier
90ac69904f Improve a type error message (avoid the word 'non-dereferenceable') 2012-03-07 14:14:34 -08:00
Brian Anderson
8a4c8bab84 test: Add test for #979 2012-03-05 18:41:55 -08:00
Brian Anderson
0ee96de4ee rustc: Lower case error messages 2012-03-05 17:05:20 -08:00
Niko Matsakis
8820d4485b print type arguments when pretty-printing all nominal types 2012-03-05 16:47:52 -08:00
Brian Anderson
633881a562 test: xfail-fast run-pass/classes-simple.rs 2012-03-04 14:13:18 -08:00
Tim Chevalier
e2fa6f03f5 Translate simple classes
Programs using classes with fields only (no methods) compile and run,
    as long as nothing refers to a class in a different crate (todo).

    Also changed the AST representation of classes to have a separate
    record for constructor info (instead of inlining the fields in the
    item_class node), and fixed up spans and pretty-printing for
    classes.
2012-03-04 12:43:17 -08:00
Erick Tryzelaar
f630ebdb6a comp/std: rename io::string_reader to io::str_reader. 2012-03-02 19:15:35 -08:00
Brian Anderson
3ed6f6520f core: Remove _mut functions from vec
Instead, use vec::to_mut/from_mut to transform vectors in place as
needed.
2012-03-02 15:49:49 -08:00
Brian Anderson
a04127d291 test: xfail-fast the cci tests 2012-03-02 13:46:42 -08:00
Brian Anderson
78bfdb11c8 Revert "rust: xfail-fast run-pass/cci_no_inline_exe"
This reverts commit 95099cddcf.
2012-03-02 13:46:02 -08:00
Brian Anderson
09f191f3a7 Revert "test: xfail-fast run-pass/cci_iter.exe"
This reverts commit c0a5e21b29.
2012-03-02 13:45:18 -08:00
Brian Anderson
95099cddcf rust: xfail-fast run-pass/cci_no_inline_exe 2012-03-02 13:44:40 -08:00
Brian Anderson
c0a5e21b29 test: xfail-fast run-pass/cci_iter.exe 2012-03-02 13:36:11 -08:00
Brian Anderson
fd12459d94 test: xfail-fast run-pass/cci_impl_exe 2012-03-02 13:23:55 -08:00
Niko Matsakis
def72bda47 retool inline encoding to handle methods, fix tests 2012-03-02 06:47:25 -08:00
Niko Matsakis
12c68bcd6d make sure we do not bind unique closures (or blocks, for that matter) 2012-03-02 06:47:25 -08:00
Tim Chevalier
48c763c098 Use the correct prestate for calls
The prestate for calls was getting set incorrectly to the poststate for the operator
in the call. This worked before since most of the time, operator expressions are
pure. Issue 1895 shows how this breaks when the operator is a closure that has a
move-in capture clause.

(I had a several-day, multi-file patch for this that didn't work... and then it
turned out to be a one-line fix. The joys of programming.)

Closes #1895
2012-03-01 09:16:26 -08:00
Marijn Haverbeke
072b015515 Add test case for #1894 2012-03-01 10:11:28 +01:00
Niko Matsakis
4132cbd22a un-xfail test, remove old comment 2012-02-29 12:49:15 -08:00
Marijn Haverbeke
0da1aca498 Recognize last uses for copied closed-over variables
And clean up and fix some bad things in last_use.rs.

Closes #1894
2012-02-29 18:06:26 +01:00
Niko Matsakis
1fd9abaa47 rename aux to auxiliary, since aux is apparently reserved on windows 2012-02-28 06:45:33 -08:00
Niko Matsakis
5c1338a18e add ability to run multi-crate tests, run tests with --inline 2012-02-28 06:31:29 -08:00
Tim Chevalier
c28c258f91 Disallow type parameters in the main() function
Closes #1900
2012-02-25 11:06:01 -08:00
Niko Matsakis
274c9708f0 Test for #1374 2012-02-24 21:14:31 -08:00
Graydon Hoare
b44be95e45 Support basic, unsophisticated, somewhat wrong export-globs. 2012-02-23 18:39:14 -08:00
Graydon Hoare
5f4dcb0fa4 Fix comment, add test that export glob works as import glob in scope. 2012-02-23 18:39:13 -08:00
Marijn Haverbeke
780f8277f4 Finish cleanup of core::str
Closes #1849
2012-02-23 17:00:19 +01:00
Kevin Cantu
7782f5d692 (core::str) remove len_bytes alias 2012-02-23 17:00:19 +01:00
Kevin Cantu
98447f5236 (core::str) mostly rename len -> len_chars 2012-02-23 17:00:19 +01:00
Brian Anderson
27ab663845 rustc: Don't ignore attributes inside empty mods. Closes #1655 2012-02-22 21:47:23 -08:00
Brian Anderson
ffa77dd610 test: Add a test for #1696 2012-02-22 21:17:19 -08:00
Brian Anderson
ae23ee28e2 test: Add a test for #1697 2012-02-22 21:14:27 -08:00
Brian Anderson
99a48660d1 rustc: Allow any integral types on rhs of shift ops 2012-02-22 17:26:08 -08:00
Tim Chevalier
4acfcd8c2f Improve error message for use of a non-pure-fn in a pred
Closes #1883
2012-02-22 10:59:52 -08:00
Marijn Haverbeke
1e5266260a Take move captures in account in mutability checker
Closes #1461
2012-02-22 13:35:17 +01:00
Marijn Haverbeke
ffd50b9cdf Make the various from_str functions return options
So that they can be used with user input without causing task
failures.

Closes #1335
2012-02-22 13:18:15 +01:00
Marijn Haverbeke
ad03761a97 Remove preconditions from libraries
Closes #1805
2012-02-22 11:47:47 +01:00
Brian Anderson
77a01054fa rustc: Generate crates with #ast 2012-02-21 15:34:26 -08:00
Brian Anderson
6527fc3925 core: Fix to_str_exact for floats with no decimal component 2012-02-21 14:25:31 -08:00
Brian Anderson
4220dcf1e9 core: New task API 2012-02-20 18:58:04 -08:00
Tim Chevalier
fbc95ba018 Re-XFAIL test that I accidentally 2012-02-20 17:33:35 -08:00
Tim Chevalier
cd9579e079 fix whitespace again 2012-02-20 17:21:33 -08:00
Tim Chevalier
2299d204e4 Further work on resolving and typechecking classes
Class tests aren't working yet, but they fail a little later :-)

Also, make the parser correctly set a constructor's result type to
its enclosing class type.
2012-02-20 17:16:52 -08:00
Graydon Hoare
ef6f628589 Refactor view_path to parse (but not yet process) export globs, unify code paths. 2012-02-17 23:05:20 -08:00
Graydon Hoare
6f70896854 Add new test for export globs, xfailed. 2012-02-17 23:02:27 -08:00
Marijn Haverbeke
e62ddf4898 More rigorous reuse of cleanup sequences
In both landing pads and break/cont/ret unwinding.

Closes #300
2012-02-16 16:37:33 +01:00
Brian Anderson
93b66ee587 test: Assert that the result is correct in run-pass/crust-stress 2012-02-15 12:45:04 -08:00
Brian Anderson
0438e6e924 bench: Add a test for task concurrency 2012-02-15 11:52:43 -08:00
Marijn Haverbeke
1248c250d8 A test that I forgot to git-add 2012-02-15 17:21:03 +01:00
Marijn Haverbeke
67cc89f38d Rewrite exhaustiveness checker
Issue #352
Closes #1720

The old checker would happily accept things like 'alt x { @some(a) { a } }'.
It now properly descends into patterns, checks exhaustiveness of booleans,
and complains when number/string patterns aren't exhaustive.
2012-02-15 15:47:42 +01:00
Marijn Haverbeke
16e5760564 Fix bug in safe-reference checker
At some point, a refactor broke the code that handled local declarations
to no longer descend into the initializer expressions.

Closes #1846
2012-02-15 11:53:32 +01:00
Marijn Haverbeke
6627890f6b Support 'alt check' syntax
It is only a way to flag an alt as intentionally non-exhaustive right now.

Issue #1679
2012-02-15 11:53:32 +01:00
Brian Anderson
9f95ccb426 test: Add a crust function stress test 2012-02-15 01:16:53 -08:00
Kevin Atkinson
d6d7134c37 When parsing a source string, fail when the entire string is not parsed.
(For now only fail when parse_from_source_str is used to avoid
possible compatibility problems; parse_expr_from_source_str still
does not check.)
2012-02-14 19:37:33 -08:00
Kevin Atkinson
a803a14b56 Bug fix to accept $ in 0th pos, (ie #ast{$(x) + ...}).
Note: part from Niko Matsakis commit: rewrite assert to accept a $ in
0th pos.
2012-02-14 19:37:33 -08:00
Kevin Atkinson
3eef8d1419 Correctly handle the character position at the EOF.
Fixes issue #1785.
2012-02-14 19:37:33 -08:00
Kevin Atkinson
0e44133e7c Do a better job of reporting source location for files (i.e. filemap)
that are really a substr of another file.
2012-02-14 19:37:33 -08:00
Brian Anderson
d5e7f0d113 rt: Don't kill tasks while they are in a callback from C 2012-02-14 11:24:09 -08:00
Brian Anderson
3f4872f032 test: Test yielding in crust functions 2012-02-14 11:24:09 -08:00
Brian Anderson
a393fb3221 rt: Maintain stack ptrs correctly when returning from stack switches 2012-02-14 11:24:09 -08:00
Brian Anderson
214cdd0dee rustc: Translate crust functions 2012-02-14 11:24:09 -08:00
Brian Anderson
c4c89dd684 rustc: Translate the value of crust functions 2012-02-14 11:24:09 -08:00
Brian Anderson
0a503228f6 rustc: Typecheck crust functions as *u8 2012-02-14 11:24:09 -08:00
Brian Anderson
305cbf9b8e rustc: Parse crust functions 2012-02-14 11:24:09 -08:00
Marijn Haverbeke
90324a1978 XFAIL bind-methods test until I figure out what is going wrong
It is not Valgrind-clean.
2012-02-14 13:54:41 +01:00
Marijn Haverbeke
57c7645cb8 Allow static method calls to be bound
This allows you to take the value of, for example, `[1].len`, or bind
it with `bind x.map(_)` syntax.

I'm holding off on implementing this for dynamic methods (those on
bounded type parameters or iface types) until it's clearer what we
will do with monomorphization.

Issue #435
2012-02-14 13:43:36 +01:00
Marijn Haverbeke
f2e880b750 Add [X].len() to core, use it in trans modules 2012-02-14 13:43:36 +01:00
Brian Anderson
f3dba33043 test: Add test for #1821 2012-02-13 15:58:14 -08:00
Marijn Haverbeke
94d4dcdbf0 Fix bug in handling of block functions in last-use analysis
It would fail to start out with a fresh scope when going over
a loop or block function for the second time, and thus not
recognize last uses of locals defined inside the block.

Closes #1818
2012-02-13 17:55:40 +01:00
Niko Matsakis
520c3f5f79 correct error message and add to test 2012-02-13 07:33:16 -08:00
Niko Matsakis
4eb52f69a9 do not fail if iface/impl method have different number of parameters 2012-02-13 06:50:58 -08:00
Niko Matsakis
a7641e99e8 remove leading ::, new tests 2012-02-13 06:50:58 -08:00
Kevin Cantu
2b4f5136a5 (core::str) rename byte_len -> len_bytes and rename char_len -> len 2012-02-12 15:30:20 -08:00
Kevin Cantu
944f5a6598 (core::str) move push_byte, push_bytes, pop_byte, and shift_byte into str::unsafe 2012-02-12 15:30:20 -08:00
Brian Anderson
005a3efb8b test: Fix cros-crate-glob-collision 2012-02-11 18:20:02 -08:00
Niko Matsakis
3f15a28b16 correct fully qualified type names to include the crate; add tests (take 2)
This reverts commit fc023d91c7.
2012-02-11 14:09:52 -08:00
Niko Matsakis
13d743093b rewrite to use ctypes types 2012-02-11 10:14:41 -08:00
Niko Matsakis
b106ef8116 make bind syntax unnecessary: just use _ for one of the arguments 2012-02-11 10:14:41 -08:00
Niko Matsakis
fc023d91c7 Revert prior commit until I have time to track down the valgrind error
This reverts commit 2ec3a0b608.
2012-02-11 09:49:02 -08:00
Niko Matsakis
2ec3a0b608 correct fully qualified type names to include the crate; add tests
fixes #1745
2012-02-10 21:53:17 -08:00
Niko Matsakis
d972226567 remove executable that was accidentally included 2012-02-10 20:48:29 -08:00
Niko Matsakis
fdddf8f9e1 put serializer into the build and encode full item paths 2012-02-10 20:48:28 -08:00
Brian Anderson
17110fb28b test: Add tests for #1802 2012-02-10 15:43:35 -08:00
Marijn Haverbeke
7f1ea3ef6a Don't allow binding patterns to bind keywords
Closes #1586
2012-02-10 15:54:47 +01:00
Marijn Haverbeke
74d4e2a32e Add compile-fail tests for interfaces/impls
Closes #1475
2012-02-10 13:31:33 +01:00
Tim Chevalier
503dec1d62 Further WIP on classes
Changes to resolve and typeck. Still nothning working yet.
2012-02-09 14:36:43 -08:00
Marijn Haverbeke
50fb4c30ed Increase precedence of as operator
Closes #1717
2012-02-09 11:58:08 +01:00
Brian Anderson
35ba9715fa core: Add task::spawn_sched
This function creates a new scheduler with a specified number of threads and
immediately executes a task on it. The scheduler is configured to terminate
when the task dies. This is the minimum API necessary to enable blocking C
calls.
2012-02-08 15:42:51 -08:00
Brian Anderson
2f4e7c157e rt: Export a scheduler API 2012-02-08 15:42:51 -08:00
Brian Anderson
7c8d128e1f bench: Add shootout-spectralnorm 2012-02-08 01:06:16 -08:00
Kevin Cantu
a3f5626ad1 String split renaming:
* Renamed str::split -> str::split_byte
* Renamed str::splitn -> str::splitn_byte
* Renamed str::split_func -> str::split
* Renamed str::split_char -> str::split_char
* Renamed str::split_chars_iter -> str::split_char_iter
* Added u8::is_ascii
* Fixed the behavior of str::split_str, so that it matches split_chars
  and split (i.e. ["", "XXX", "YYY", ""] == split_str(".XXX.YYY.", "."))
* Fixed str::split_byte and str::splitn_byte so that they handle
  splitting UTF-8 strings on a given UTF-8/ASCII byte and also handle ""
  as the others do
2012-02-07 16:25:35 -08:00
Marijn Haverbeke
6ed8d03784 Make sure iface_methods are set before they are accessed
Closes #1761
2012-02-06 09:56:42 +01:00
Marijn Haverbeke
91da710d86 Add monad iface test 2012-02-06 09:56:41 +01:00
Brian Anderson
da61e1ff15 test: Add test for issue #1460 2012-02-05 20:42:05 -08:00
Brian Anderson
1b3339df63 test: Issue #953, not #959 2012-02-05 18:29:07 -08:00
Brian Anderson
292f3e0958 test: Add an xfailed test for issue #959 2012-02-05 18:27:15 -08:00
Brian Anderson
cbeeb13dfd test: Add an xfailed test for issue #929 2012-02-05 18:24:17 -08:00
Brian Anderson
80cd6aa96e test: Update and un-xfail compile-fail/tag-that-dare-not... 2012-02-05 18:06:54 -08:00
Brian Anderson
0b43bf9782 test: Add test for #901. Closes #901 2012-02-05 17:54:52 -08:00
Brian Anderson
34aa956e68 test: Resolve some FIXMEs 2012-02-05 17:05:24 -08:00
Kevin Atkinson
1d855ebc51 Remove support for $(...) form of quasi-quotes, use #ast{...} instead. 2012-02-05 15:38:27 -08:00
Niko Matsakis
9f0239ce9c add a test where mode inference ought to fail 2012-02-05 13:59:09 -08:00
Niko Matsakis
dd51031390 new test case 2012-02-05 10:37:07 -08:00
Niko Matsakis
daf0d63a59 new test showing off the improved inference 2012-02-05 09:56:18 -08:00
Brian Anderson
30a671dc0c bench: Tweak threadring benchmark so it pretty-prints 2012-02-04 20:34:51 -08:00
Brian Anderson
b4e221bf90 bench: Add threadring shootout benchmark 2012-02-04 20:01:55 -08:00
Brian Anderson
5d4b372902 Revert "bench: Add threadring shootout benchmark"
This reverts commit cdb246f832.
2012-02-04 19:50:45 -08:00
Brian Anderson
cdb246f832 bench: Add threadring shootout benchmark 2012-02-04 18:00:59 -08:00
Tim Chevalier
f3343b3571 Beginnings of front-end support for classes
Added class support to the parser, prettyprinter, fold, and visit.
(See Issue 1726.)

This is WIP -- the test case is xfailed, and attempting to compile
it will error out in resolve.
2012-02-03 22:47:35 -08:00
Ted Horst
9b46e875cc add third arg for output path, default to no output 2012-02-03 20:49:14 -08:00
Ted Horst
63ae16f752 fix formatting 2012-02-03 20:49:14 -08:00
Ted Horst
e7738ca38b add mandelbrot image generator from shootout 2012-02-03 20:49:13 -08:00
Graydon Hoare
8fc624bc08 Fix various drift issues in the qq branch. 2012-02-03 20:54:18 -07:00
Kevin Atkinson
dbb13883f7 Additional testcase. 2012-02-03 20:54:18 -07:00
Kevin Atkinson
42e25b2bb9 Type anti-quotes now work, add test case. 2012-02-03 20:54:17 -07:00
Kevin Atkinson
5f6a1159bb Fix q-q so that non-expression q-q actually work when there is embed anti-q. 2012-02-03 20:54:00 -07:00
Kevin Atkinson
a2dde9a692 Allow anti-quotes to also be ast::ty rather than just ast::expr. 2012-02-03 20:41:49 -07:00
Kevin Atkinson
f7fab77102 Add testcase. 2012-02-03 20:41:49 -07:00
Kevin Atkinson
5ef53382ae Add support for parsing quasi-quotes, doesn't do anything useful yet. 2012-02-03 20:23:49 -07:00
Marijn Haverbeke
c976b7c623 Fix tests for str::le patch 2012-02-03 14:32:23 +01:00
Marijn Haverbeke
c1b075d042 Remove experimental GC code
It's been sitting unused long enough to have bitrotted completely.
2012-02-03 11:34:12 +01:00
Brian Anderson
57cad61353 rt: Remove task pinning. Does nothing 2012-02-02 18:10:24 -08:00
Brian Anderson
18de0f2aeb rt: Rename task_sleep intrinsic to task_yield. Remove usec param 2012-02-02 18:10:24 -08:00
Marijn Haverbeke
6a7de641da Add test case for issue #1733 2012-02-02 10:30:07 +01:00
Kevin Cantu
8f367ebfeb Rename (again) str::unsafe::slice -> str::unsafe::slice_bytes and
str::unsafe::safe_slice -> str::unsafe::slice_bytes_safe_range
2012-02-01 21:56:53 -08:00
Kevin Cantu
c71667d9d2 Propagating unsafe::slice 4 2012-02-01 21:56:53 -08:00
Marijn Haverbeke
856a544d0c Remove native types from stdlib 2012-02-01 12:23:13 +01:00
Tim Chevalier
e5d095d67e Change option::t to option
Now that core exports "option" as a synonym for option::t, search-and-
replace option::t with option.

The only place that still refers to option::t are the modules in libcore
that use option, because fixing this requires a new snapshot
(forthcoming).
2012-01-31 17:05:20 -08:00
Kevin Cantu
c7454f5595 Rename str::to_chars -> str::chars 2012-01-31 14:29:11 -08:00
Tim Chevalier
45c1dfe5b3 Don't compute pre- and postconditions for item_consts
Since item_consts can't refer to or modify local variables, they
don't participate in typestate and thus get empty pre and
postconditions by default.

Closes #1660
2012-01-31 11:52:46 -08:00
Tim Chevalier
fba35e1a3c Require alts to be exhaustive
middle::check_alt does the work. Lots of changes to add default cases
into alts that were previously inexhaustive.
2012-01-31 10:08:24 -08:00
Brian Anderson
0e498da47e rustc: Allow attributes on methods. Closes #1709 2012-01-30 11:43:45 -08:00
Paul Woolcock
a02493b969 Fix last failing test
All tests now pass, without the ternary operator.
2012-01-30 18:21:12 +01:00
Paul Woolcock
e1251f7b00 Change all ternary ops to if/then/else
All the files below had at least one instance of the ternary operator
present in the source.  All have been changed to the equivalent
if/then/else expression.
2012-01-30 18:21:01 +01:00
Paul Woolcock
e1f15a71e3 Alter/remove tests that include/concern ternary
3 tests, pretty/block-disambig.rs, run-pass/operator-overloading.rs,
and run-pass/weird-exprs.rs, all included the ternary operator.  These
were changed to use the if-then-else construct instead.

2 tests, run-pass/block-arg-in-ternary.rs and run-pass/ternary.rs, were
only there because of the ternary operator, and were removed.
2012-01-30 18:20:05 +01:00
Marijn Haverbeke
964bd485c6 Revert self types 2012-01-30 11:37:52 +01:00
Brian Anderson
fa13fd9d64 rt: Remove set_min_stack 2012-01-29 21:27:37 -08:00
Brian Anderson
cad4918b2a core: Remove sys::set_min_stack
This was a temporary hack with global effect. Eventually there will
be a real solution for controlling stack sizes.
2012-01-29 21:27:09 -08:00
Brian Anderson
53dbde6cc2 rustc: Make 'attempted access of field' error non-fatal 2012-01-27 16:58:27 -08:00
Brian Anderson
3321880f13 Merge remote-tracking branch 'killerswan/fixing_strings_2'
Conflicts:
	src/comp/driver/driver.rs
	src/comp/middle/trans/base.rs
	src/comp/syntax/parse/lexer.rs
2012-01-27 16:44:40 -08:00
Marijn Haverbeke
e48bf6f3f4 Make occurs check in ty::fixup_vars more reliable
It wouldn't detect cycles that went through several type vars before.

Closes #1464
2012-01-27 18:58:52 +01:00
Marijn Haverbeke
dc55c06aa3 Properly check enum types for recursion
Closes #742
2012-01-27 16:03:43 +01:00
Marijn Haverbeke
b80f0a3c9f Use the method name 'unary-' for overloading negation
It's less likely to clash with something than 'neg'.

Issue #1520
2012-01-27 10:06:53 +01:00
Brian Anderson
28fbb19664 rustc: Switch the --no-core switch to a #[no_core] attribute 2012-01-26 16:43:33 -08:00
Brian Anderson
5610205363 rustc: Move core injection to its own module 2012-01-26 16:23:48 -08:00
Marijn Haverbeke
6bead0e4cc Use operator names for operator methods
The methods used to implement operators now simply use
the name of the operator itself, except for unary -, which is called
min to not clash with binary -. Index is called [].

Closes #1520
2012-01-26 15:52:28 +01:00
Marijn Haverbeke
888262b337 Allow operator overloading of the indexing operator
The method `op_index` (which takes a single argument) is used for
this.

Issue #1520
2012-01-26 15:23:11 +01:00
Marijn Haverbeke
87b064b249 First stab at operator overloading
When no built-in interpretation is found for one of the operators
mentioned below, the typechecker will try to turn it into a method
call with the name written next to it. For binary operators, the
method will be called on the LHS with the RHS as only parameter.

Binary:

    +   op_add
    -   op_sub
    *   op_mul
    /   op_div
    %   op_rem
    &   op_and
    |   op_or
    ^   op_xor
    <<  op_shift_left
    >>  op_shift_right
    >>> op_ashift_right

Unary:

    -   op_neg
    !   op_not

Overloading of the indexing ([]) operator isn't finished yet.

Issue #1520
2012-01-26 14:25:06 +01:00
Brian Anderson
2999479a2d rustc: Allow attributes on enum variants. Closes #1663 2012-01-25 16:24:06 -08:00
Brian Anderson
4168101b03 test: Un-xfail run-pass/tag-auto-disr-val-shape 2012-01-25 12:44:13 -08:00
Brian Anderson
19a9a475a6 test: Add regression test for #1659 2012-01-25 12:40:08 -08:00
Brian Anderson
ba7299ba65 test: Un-xfail run-pass/tag-disr-val-shape
Fixed by 96f1eda6d0
2012-01-25 12:34:37 -08:00
Marijn Haverbeke
2d4d8e8bdb Implement implicit self type parameters for ifaces
Closes #1661
2012-01-25 20:47:11 +01:00
Kevin Cantu
c7b23f9a86 Replacing str::unsafe_from_bytes with str::from_bytes (part 1) 2012-01-25 00:53:17 -08:00
Niko Matsakis
5e13d19cc0 s/block()/fn()/g 2012-01-23 19:06:33 -08:00
Brian Anderson
7d5d1a311e test: Add no-reformat directive to compile-fail/issue-1362 2012-01-23 17:37:15 -08:00
Kevin Atkinson
664d9cc86f Add regression test for issue #1362.
Although its not really needed.  Without that fix, reported spans will
likely be bogus if the error is within the first couple of lines
(probable around 5) of that file.  Thus, many of the compile-fail
tests will fail due to incorrect location.
2012-01-23 17:37:15 -08:00
Kevin Atkinson
5e60facf78 Add regresion tests for issue #1448 and #1387. 2012-01-23 17:37:15 -08:00
Niko Matsakis
5660b8bfb5 add msgsend.rs to benchmarks 2012-01-23 16:04:14 -08:00
Tim Chevalier
6db688e893 Check that the names mentioned in tag exports are actually types (or variants)
Check that in export foo{}, foo is an enum type, and that in export
foo{bar, quux}, foo is an enum type and bar and quux are variants belonging
to foo.
2012-01-23 15:48:08 -08:00
Tim Chevalier
9dc59e1506 Export all enum variants by default; new syntax for selectively exporting variants
See issue 1426 for details. Now, the semantics of "export t;" where t is a tag are
to export all of t's variants as well. "export t{};" exports t but not its
variants, while "export t{a, b, c};" exports only variants a, b, c of t.

To do:
- documentation
- there's currently no checking that a, b, c are actually variants of t in the
 above example
- there's also no checking that t is an enum type, in the second two examples above
- change the modules listed in issue 1426 that should have the old export
semantics to use the t{} syntax

I deleted the test export-no-tag-variants since we're doing the opposite now,
and other tests cover the same behavior.
2012-01-23 15:48:08 -08:00
Brian Anderson
a88c0847c2 core: Reexport all the imports in f32/64 2012-01-22 16:42:00 -08:00
Niko Matsakis
ec8273587c update to new tag syntax 2012-01-21 19:31:52 -08:00
Niko Matsakis
85a3298229 unify size_of, align_of into one call (metrics)
create some new (xfail'd) tests looking at tag variant alignment
2012-01-21 19:31:52 -08:00
Niko Matsakis
cd1056df78 migrate size_of() and related funcs from trans into shape 2012-01-21 19:31:51 -08:00
Graham Fawcett
7763b40c71 issue #1352: change param order on vec::init_elt, putting block in final position.
To match the init_fn() and init_fn_mut() changes.
2012-01-21 13:33:16 -08:00
Graham Fawcett
35d12be2ce fix #1352: change param order on vec::init_fn (and vec::init_fn_mut), putting block in final position. 2012-01-21 13:31:12 -08:00
Brian Anderson
8c92ea49d3 core: Shuffle around a #fmt test 2012-01-21 13:20:14 -08:00
Tim Chevalier
ba5cc236f7 WIP on issue 1426 (exporting all tags)
Support Lenny222's proposed syntax for exporting a tag without
its variants, or selected tags from a variant, in the AST and parser.
No support further down the line yet. Tests are xfailed.
2012-01-20 19:48:33 -08:00
Tim Chevalier
e36df0f6c8 Handle fail after return correctly in typestate
Previously, typestate would conclude that this function was
correctly diverging:

fn f() -> ! { ret; fail; }

even though it always returns to the caller. It wasn't handling the
i_diverge and i_return bits correctly in the fail case. Fixed it.

Closes #897
2012-01-20 17:26:31 -08:00
Tim Chevalier
d242edb57b Handle predicates that recurse in a check() expression
typestate was using the enclosing function ID for the "this function
returns" constraint, which meant confusion and panic in the case
where a predicate p includes "check p()". Fixed it to use a fresh
ID.

Closes #933
2012-01-19 22:53:22 -08:00
Graydon Hoare
7b1a8f0a91 Additional ; to , changes, disable "tag" and ";" in parser. Close #1430. Close #1428. 2012-01-19 19:29:21 -08:00
Patrick Walton
59ebe6af18 rustc: Make the pretty printer output commas after enum variants. Update all tests accordingly. 2012-01-19 18:41:06 -08:00
Tim Chevalier
c7592803d9 Compute typestates for FRU exprs correctly, plus a bit of cleanup
The code in Issue 948 was causing typestate to diverge because
it was using the prestate for the whole expression -- not the post-
state for the fields list -- as the prestate for the record base
expression. Fixed.

Closes #948
2012-01-19 17:24:27 -08:00
Patrick Walton
b58f2b7bfb Merge pull request #1571 from kevina/fixup-1
Remove incorrect comments from a few test cases.
2012-01-19 17:21:29 -08:00
Kevin Atkinson
d388daa996 Remove incorrect comments from a few test cases. 2012-01-19 17:31:36 -07:00