Commit graph

1820 commits

Author SHA1 Message Date
Marijn Haverbeke
d2be5b6c7a Remove tests for objs, adjust tests that use objs 2012-01-13 11:52:13 +01:00
Brian Anderson
0616cba62b libcore: Add sys::set_exit_status
Sets the process exit code
2012-01-12 22:24:27 -08:00
Tim Chevalier
565ea068ca Add type parameters when checking wildcard patterns
For some reason, wildcard patterns were never getting type parameter
substitutions attached. This would cause an assertion failure when
checking a wildcard pattern that matches against a tag with
polymorphic type (not sure why this didn't come up before). Fixed it.
(The diff and test case may be easier to understand than this note
:P)

Closes #1503.
2012-01-12 16:51:07 -08:00
Niko Matsakis
8818f42b19 make parser disambiguate fn~ at top level correctly 2012-01-12 13:47:38 -08:00
Niko Matsakis
263f4c58a0 add tydescs into shape, rewrite walk_fn_contents() 2012-01-12 13:47:38 -08:00
Niko Matsakis
e55aa6e5ef free uniq data we encounter on the sweep, walk thru them otherwise 2012-01-12 13:47:38 -08:00
Marijn Haverbeke
56fe4c2681 Implement passing cast-to-vtable values as bounded params
Closes #1492
2012-01-12 16:57:58 +01:00
Kevin Atkinson
44352df57c Cleanups to previous commits for issue #1393. 2012-01-12 09:55:48 +01:00
Brian Anderson
35b27aa172 test: Add a test that empty records don't parse
Closes #1200
2012-01-11 19:45:18 -08:00
Brian Anderson
6e1f9ad1f1 rustc: Don't allow empty link_name when nolink attribute is present
Closes #1326
2012-01-11 19:45:18 -08:00
Brian Anderson
70367d757c test: xfail-win32 run-pass/too-much-recursion 2012-01-11 15:10:36 -08:00
Brian Anderson
94c389a25b rt: Add RUST_MAX_STACK env var with 8MB default
Closes #1489
2012-01-11 13:57:11 -08:00
Marijn Haverbeke
34d7f05292 Major clean-up of std::io
Use ifaces instead of objs, stop wrapping everything in two (or three)
layers of no-value-added indirection, and remove some of the more
pointless/outdated idioms from the code.
2012-01-11 21:00:11 +01:00
Marijn Haverbeke
15744210e7 Implement std::map as an iface/impl instead of an obj 2012-01-11 20:33:44 +01:00
Niko Matsakis
c68345e57e add a log_str() function and allow '%?' in fmt strings to use it 2012-01-11 10:32:54 -08:00
Niko Matsakis
f3b867fd04 add section on spawn_connected to tutorial and pull test into file 2012-01-11 09:49:21 -08:00
Niko Matsakis
441a42c5d2 update shape code to handle iface instances 2012-01-10 19:05:28 -08:00
Kevin Atkinson
1dc3debdaf Add support for casting enum-like tags to scalar values. 2012-01-10 15:59:57 -08:00
Kevin Atkinson
08abf8d37f Support explicit discriminant numbers on tag variants.
Addresses issue #1393.

For now disallow disr. values unless all variants use nullary
contractors (i.e. "enum-like").

Disr. values are now encoded in the crate metadata, but only when it
will differ from the inferred value based on the order.
2012-01-10 15:59:57 -08:00
Patrick Walton
d0fe6723fc test: Fix test/pretty/tag-blank-lines.rs for the tag -> enum switch 2012-01-10 16:02:49 -08:00
Niko Matsakis
8b911587df rename sendfn to fn~, lambda to fn@ 2012-01-10 13:31:06 -08:00
Niko Matsakis
110c3ccdca add rust_task_is_unwinding predicate and do not kill if already unwinding 2012-01-09 19:53:32 -08:00
Austin Seipp
a94b1ccacb Change all uses of 'when' in alt-patterns to 'if'
Issue #1396
2012-01-09 19:27:05 -08:00
Graydon Hoare
8387896dda Remove proto_sugar and 'lambda' as keyword, commit to fn@. 2012-01-09 16:12:48 -08:00
Brian Anderson
fbad0204e4 Merge pull request #1470 from grahame/grahame
add new read_chars method, fix bug in read_char
2012-01-09 10:35:48 -08:00
Marijn Haverbeke
6b20e8c88b Fix error message case in two cfail test
I had made the error consistent with other errors, but forgot to
also change the tests.
2012-01-09 17:51:39 +01:00
Niko Matsakis
51364b5708 Fix #1474: check that block args resolved to bare fns do not make use of upvars 2012-01-09 06:50:40 -08:00
Marijn Haverbeke
f30c5ea686 Remove leftover comm.rs in std
(The actual comm module lives in core.)
2012-01-09 14:53:13 +01:00
Grahame Bowland
ba694775f5 add tests for io::readchars and io::readchar
Additionally reformat so that 'make check' passes.
2012-01-09 20:49:17 +08:00
Niko Matsakis
9775b480fd add spawn_connected 2012-01-08 15:32:13 -08:00
Niko Matsakis
7a336f1e7c modify last use to take into account cap clause, add new test 2012-01-08 14:57:03 -08:00
Niko Matsakis
106385cb91 make spawned fn copy mode so that bare fns can be used 2012-01-08 14:57:03 -08:00
Niko Matsakis
d4410a9f9b rewrite to use old C++-based mechanism 2012-01-06 22:40:32 -08:00
Niko Matsakis
a1ef79c9d2 update to use new spawn syntax 2012-01-06 22:40:32 -08:00
Niko Matsakis
6237368cc2 plug leak: free shared type descrs recursively, as we ought to 2012-01-06 22:40:32 -08:00
Niko Matsakis
8506241f3a fix how we walk functions to match new closure fmt 2012-01-06 22:40:31 -08:00
Niko Matsakis
4f52e5a5ec make size_of and align_of take an optional value 2012-01-06 22:40:31 -08:00
Niko Matsakis
9f84f88276 port over the tests to use the new API 2012-01-06 22:40:31 -08:00
Niko Matsakis
25e81e34ea rewrite task tests 2012-01-06 22:40:31 -08:00
Niko Matsakis
e88905cd28 remove trailing whitespace 2012-01-06 22:07:29 -08:00
Niko Matsakis
373dbe7741 test exposing memory management failure for #1078 2012-01-06 21:15:27 -08:00
Brian Anderson
74c825e385 std: Add fs::homedir
Returns the home directory of the user as appropriate for the platform.

Issue #1359
2012-01-06 16:33:17 -08:00
Tim Chevalier
7c7559edaf Disallow variable names that shadow tags in scope
Now, if you have a tag named "foo", a variable declaration like
"let foo..." is illegal. This change makes it possible to eliminate
the '.' after a nullary tag pattern in an alt (but I'll be doing
that in a future commit) -- as now it's always obvious whether a
name refers to a tag or a new declared variable.

resolve implements this change -- all the other changes are just to
get rid of existing code that declares variables that shadow tag
names.
2012-01-06 14:44:43 -08:00
Graydon Hoare
4f3171ea81 Merge pull request #1450 from erickt/master
adding some misc functions and some functions just for [u8]
2012-01-06 13:04:49 -08:00
Marijn Haverbeke
41a2d8495e Fix pretty-printing of ty params in iface methods 2012-01-06 17:40:05 +01:00
Marijn Haverbeke
7c1f683c6d Fix bug in method type parameter passing
It would occasionally pass the wrong type parameter, when calling
a generic method from a generic impl on a bounded param type.
2012-01-06 17:40:05 +01:00
Erick Tryzelaar
6cfc196d42 libstd: rename c_vec::size to len. 2012-01-06 08:12:18 -08:00
Brian Anderson
51e6df689c rustc: Allow the test runner to run unexported tests 2012-01-05 18:16:56 -08:00
Brian Anderson
c2c497ff53 rustc: Configure out #[test] functions when not testing 2012-01-05 17:31:57 -08:00
Niko Matsakis
75f84b2563 make test typecheck 2012-01-05 10:44:38 -08:00
Niko Matsakis
e1a0d0f03d fix pretty printer to correctly insert parens for disamb 2012-01-05 10:44:38 -08:00
Niko Matsakis
810927824c update test on disambig to reflect that some cases are no longer legal 2012-01-05 10:44:38 -08:00
Niko Matsakis
afe792496a correct test to reference right value 2012-01-05 10:44:38 -08:00
Niko Matsakis
f832edc369 require a non-semi expr acting as a stmt to have unit return type 2012-01-05 10:44:38 -08:00
Niko Matsakis
37ba5f3b32 make parser handle parenthesized block-sugar exprs properly 2012-01-05 10:44:38 -08:00
Stefan Plantikow
c8467977c4 Merge branch 'master' into kmath
Conflicts:
	src/libcore/float.rs
2012-01-05 17:20:13 +01:00
Stefan Plantikow
1f10ee365c Moved generic float::min, max to core::math and cleaned up some imports 2012-01-05 17:11:34 +01:00
Stefan Plantikow
494ad4e601 Merge branch 'master' into kmath 2012-01-05 16:25:51 +01:00
Marijn Haverbeke
60ae1590af Switch to new param kind bound syntax
And remove support for the old syntax
2012-01-05 15:50:02 +01:00
Stefan Plantikow
6284190ef9 Merge branch 'master' into kmath
Conflicts:
	src/libcore/cmath.rs
2012-01-05 02:07:12 +01:00
Niko Matsakis
70c808d173 extend tester so that error msgs can be attached to lines 2012-01-04 15:25:17 -08:00
Marijn Haverbeke
71c1c15805 xfail-pretty iface-generic.rs until i have time to debug 2012-01-04 19:58:02 +01:00
Marijn Haverbeke
b02a77d6b4 Add test for generic iface methods
Issue #1227
2012-01-04 17:30:36 +01:00
Lenny222
d1ffe5034b "str": rename "str_from_cstr" to "from_cstr" (analogous to the other "from_*") 2012-01-04 09:33:07 +01:00
Lenny222
dd284eb396 "char": use shorter names "to_lower"/"to_upper", analogous to the same names in "str" 2012-01-04 09:33:04 +01:00
Tim Chevalier
439e28b751 Add missing ty_constr cases to trans::type_of_inner and ty::fold_ty.
Closes #970
2012-01-03 15:50:05 -08:00
Niko Matsakis
72a3667eb3 Allow tail expressions even in no_value blocks. Type checker
will guarantee they have unit type.
2012-01-03 13:13:52 -08:00
Niko Matsakis
43a9d50a74 new tests 2012-01-03 13:13:52 -08:00
Brian Anderson
513a263e81 Merge pull request #1392 from Lenny222/list
list: add "is_not_empty" requirement to "head" and "tail" (analogous to "vec")
2012-01-03 12:18:53 -08:00
Marijn Haverbeke
4e88d5ae92 Make resolution of dictionaries on bounded params work
Issue #1227
2012-01-03 16:37:41 +01:00
Marijn Haverbeke
5ea3c96938 Wire in resolution of param bounds for method calls
Issue #1227
2012-01-03 16:18:40 +01:00
Marijn Haverbeke
b162f33396 Fix expected error messages for better printing of ty_ptr 2012-01-02 15:59:04 +01:00
Marijn Haverbeke
15be2fc73a Add 'copy' bounds to functions that were faultily accepted without
Issue #1390
2012-01-02 15:31:58 +01:00
Marijn Haverbeke
bd6646e698 Make last-use pass properly handle closed-over variables
Closes #1399
2012-01-02 10:20:58 +01:00
User Jyyou
a59c4b1b47 freebsd support 2012-01-01 20:18:55 -08:00
Lenny222
f8d7a1c258 "str": extract to_upper/lower_case() into "char" 2012-01-01 13:15:30 -08:00
Stefan Plantikow
57ac67a5aa core: killed all math wrappers 2011-12-31 03:45:17 +01:00
Stefan Plantikow
49d36c7f85 Trying to remove wrappers from float 2011-12-31 03:45:17 +01:00
Niko Matsakis
8319b5a252 add cap clause to pretty printer, with a test 2011-12-30 16:25:55 -08:00
Lenny222
ab2a643f27 add test for list:is_empty() 2011-12-30 10:54:31 +01:00
Niko Matsakis
aa5382bb13 split proto from fn_decl, as not all fn_decls know the proto.
this will address the (crashing) new test added.
2011-12-29 20:29:28 -08:00
Graydon Hoare
36c55b20a8 Add support in lexer for utf8 identifiers. No NFKC logic in char yet. 2011-12-29 14:45:18 -08:00
Lenny222
d07c6e8a0e list: use predicate to enforce non-empty requirement 2011-12-29 21:24:03 +01:00
Graydon Hoare
2ed1005bd7 On second thought, re-land pull request #1385 with backquotes; easier to grep, can change in the future. 2011-12-28 13:41:31 -08:00
Lenny222
0b9751b141 Use singlequotes in the typechecker too, to distinguish code and English 2011-12-25 20:27:09 +01:00
Graydon Hoare
b3eb9a0031 Merge pull request #1382 from Lenny222/char
"char": add is_lowercase(), is_uppercase()
2011-12-24 11:55:39 -08:00
Graydon Hoare
900bc1298d Merge pull request #1377 from Lenny222/icu
std::unicode::icu: add "is*" functions + unit test
2011-12-24 11:54:07 -08:00
Lenny222
eb0cdc02e3 char: add is_lowercase(), is_uppercase() 2011-12-24 10:41:11 +01:00
Graydon Hoare
f0dfbe7b1b Register new snapshots, purge log_err and log_full in favour of log(...). 2011-12-22 17:53:53 -08:00
Graydon Hoare
389329ef1e Merge all 3 log syntaxes, tidy up residual misuses. 2011-12-22 16:14:00 -08:00
Graydon Hoare
8b580954fe Register snapshots and switch logging over to use of log_full or #error / #debug. 2011-12-22 14:42:52 -08:00
Lenny222
d812d06bc8 std::unicode: add functions, unit test 2011-12-22 22:58:38 +01:00
Marijn Haverbeke
e2e077c831 Remove trivial cast checker
I consider the added complexity not justified at this point, and it
interacts badly with the patches for issue #828. Feel free to discuss.
2011-12-22 15:04:00 +01:00
Lenny222
7beb21c6e3 tests: add corner case (empty list) 2011-12-22 08:59:22 +01:00
Lenny222
6f5a0a3b3b json: add "null" 2011-12-22 08:46:49 +01:00
Niko Matsakis
66856a39b3 add tests I forgot to add 2011-12-21 08:41:41 -08:00
Niko Matsakis
627217fa55 valid cap clause for kind-ness too 2011-12-21 06:14:36 -08:00
Brian Anderson
dedfef4c4c Revert "wip"
This reverts commit aeadc6269e.
2011-12-20 20:57:04 -08:00
Brian Anderson
aeadc6269e wip 2011-12-20 20:15:09 -08:00
Graydon Hoare
a24c19e867 Add companion-module core.rs that exports log levels and option/some/none everywhere. 2011-12-20 12:41:44 -08:00
Stefan Plantikow
b957916e06 removed math leftovers from std 2011-12-20 18:07:36 +01:00
Haitao Li
28b825d846 test: Remove 'error:' from error pattern
May include ansi escape code for color rendering on certain terminal.
2011-12-20 15:38:40 +08:00
Niko Matsakis
55a2fd18ec implement capture clauses (move, in particular) and integrate
them into type state and so forth
2011-12-19 14:07:46 -08:00
Niko Matsakis
b2b2a430df resolve capture clauses 2011-12-19 14:07:46 -08:00
Niko Matsakis
b0f1a5f051 when collecting free vars, track the span where it is used too 2011-12-19 14:07:46 -08:00
Niko Matsakis
98cbbbb642 impl the proper partial order between fn types 2011-12-19 14:07:46 -08:00
Erick Tryzelaar
02d84d89e0 libcore: add splitn to split a string N times. 2011-12-19 10:22:07 -08:00
Erick Tryzelaar
8e54e74be4 libcore: add vec push.
This is a simple wrapper around grow for the common
case of pushing a value on the end of a vector.
2011-12-19 10:22:07 -08:00
Erick Tryzelaar
6b1c60d312 libcore: Add vec any2 and all2 functions. 2011-12-19 10:22:07 -08:00
Erick Tryzelaar
a66f0688fd getopts: add test for strings with spaces. 2011-12-19 07:27:16 -08:00
Marijn Haverbeke
60acae4df7 Add type argument field to expr_path
This way, you can explicitly provide type parameters when calling a
generic method.

Issue #1227
2011-12-19 10:43:23 +01:00
Marijn Haverbeke
7185ea35c3 Use quotes around tokens in parser error messages to make them more readable
Closes #1328
2011-12-19 09:59:51 +01:00
Stefan Plantikow
fa27724a4b std: getopts now uses result::t (fixes #1289) 2011-12-18 18:55:39 -08:00
Brian Anderson
12cde6ebee libcore: Remove task::set_min_stack
This existed to make up for the lack of stack growth, and wasn't generally
safe.
2011-12-18 14:10:41 -08:00
Brian Anderson
22ac628e8c test: Enable all morestack tests 2011-12-18 13:37:33 -08:00
Marijn Haverbeke
f4acaf6934 Only look for a matching method when normal field access fails
We should probalby warn when defining a method foo on {foo: int} etc.

This should reduce the amount of useless typevars that are allocated.

Issue #1227
2011-12-18 19:41:44 +01:00
Brian Anderson
471b4d6e58 rt: Use a DWARF CFI scheme that works on mac in __morestack 2011-12-17 14:10:44 -08:00
Graham Fawcett
f14bc54b06 allow #[link_args] with #[nolink]. For now, fail if two modules link same lib, and second has link_args.
I think it should undefined to have multiple modules that link in the same
library, but provide different link arguments. Unfortunately we don't track
link_args by module -- they are just appended as discovered into the crate
store -- but for now, it should be an error to provide link_args on a module
that's already been included (with or without link_args).
2011-12-16 15:29:59 -08:00
Graham Fawcett
7ddd353ef6 implement #[nolink]; deprecate #[link_name = ""]; note in stdlib to remove empty link_name.
Can't remove them from stdlib until the snapshotted compiler supports #[nolink].
2011-12-16 15:29:59 -08:00
Elly Jones
89e880d613 std: file_is_dir -> path_is_dir, add path_exists 2011-12-16 17:37:21 -05:00
Niko Matsakis
34283c6a78 add test that requires capturing generic descriptors 2011-12-16 08:06:45 -08:00
Niko Matsakis
4465c1ad02 first test of sendable fns (passes) 2011-12-16 08:06:45 -08:00
Niko Matsakis
ac6aba016e rename iter2 to iteri to match typical convention 2011-12-16 07:17:29 -08:00
Niko Matsakis
2833ca478c reorder args to the various vec, option fns so blk comes last 2011-12-16 07:17:23 -08:00
Marijn Haverbeke
cff6bdd036 Change syntax for impl
Move the name of the bundle to the front, allow type parameters (not
handled yet), and add a 'for' keyword:

    impl utils for int {
        fn str() -> str { int::str(self) }
        fn times(f: block()) { ... }
    }
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
4f826d81f6 Make 1.f parse as a field access on the integer 1
A dot is only considered part of a number when not followed by a letter

Closes #1306
2011-12-16 11:46:57 +01:00
Marijn Haverbeke
7efef98901 Make uses of self in impls compile
Get rid of expr_self_call, introduces def_self. `self` is now,
syntactically, simply a variable. A method implicitly brings a `self`
binding into scope.

Issue #1227
2011-12-16 11:46:57 +01:00
Patrick Walton
fd1dd76977 stdlib: Add a str::split_str() to split on a delimiter string of any length 2011-12-15 17:39:53 -08:00
Stefan Plantikow
af8e471908 Fixed type resolution error in math tests 2011-12-14 14:54:16 -08:00
Stefan Plantikow
50db7ce906 Moved std::math to std::core
- merges math and float into core::float
- Splits core::ctypes into core::ctypes and core::mtypes
- cmath is not exported
- stdtest::math passes
2011-12-14 14:54:16 -08:00
Stefan Plantikow
6d0901cb4d std: export math_f* as math::f* submods and use tailcalls in std::math 2011-12-14 14:54:16 -08:00
Graydon Hoare
fa9ad984fb Copy first batch of material from libstd to libcore. 2011-12-13 16:34:50 -08:00
Brian Anderson
7a8e73662d rt: Make unwinding through __morestack work on mac
Had to bump the min stack size in some of the tests from 256 bytes
to 1024 bytes. Not sure why yet.
2011-12-11 18:49:04 -08:00
Marijn Haverbeke
44ffd8e3aa Allow type annotations for blocks
I.e. {|foo: int| -> int foo + 2}

Issue #1275
2011-12-09 09:42:22 +01:00
Marijn Haverbeke
9a269a3aa8 Allow binding of nested patterns
See src/test/run-pass/nested-patterns.rs for some examples. The syntax is

    boundvar@subpattern

Which will match the subpattern as usual, but also bind boundvar to the
whole matched value.

Closes #838
2011-12-08 12:03:48 +01:00
Marijn Haverbeke
17e99ec57f Fix test that used an oversized int literal 2011-12-07 22:10:56 +01:00
Marijn Haverbeke
7548a0d77a Restore accidentally overwritten test 2011-12-07 22:02:38 +01:00
Marijn Haverbeke
3d0610b072 Check for literals that are out of range for their type 2011-12-07 21:53:05 +01:00
Marijn Haverbeke
e3eca9174b Change literal representation to not truncate
Also shuffles around the organization of numeric literals and types,
separating by int/uint/float instead of machine-vs-non-machine types.
This simplifies some code.

Closes #974
Closes #1252
2011-12-07 21:08:28 +01:00
Marijn Haverbeke
03a6e54212 Disallow binding by-mut-ref and by-move arguments
Fix bug in bound by-copy arguments.

Closes #1261
2011-12-07 15:28:57 +01:00
Brian Anderson
9a738fd61d rt: Various tweaks to make __morestack unwinding work on linux
When unwinding through __morestack the stack limit in the TLS is invalidated
and must be reset. Instead of actually landing at __morestack we're
just going to make all our Rust landing pads call upcall_reset_stack_limit,
which will find the stack segment that corresponds to the current stack
pointer and put the limit in the TLS.

Also massively expand the stack segment red zone to make more room for the
dynamic linker. Will fix in the future.
2011-12-06 16:32:41 -08:00
Brian Anderson
8d8148f1f7 test: More tests for unwinding + morestack 2011-12-05 19:21:46 -08:00
Brian Anderson
58844aee42 rt: Make stack unwinding work more correctly with stack growth 2011-12-05 17:42:58 -08:00
Brian Anderson
a731f165df test: Test hitting the dynamic linker in the red zone 2011-12-05 17:20:59 -08:00
Brian Anderson
98cd96ce96 test: Add more tests for stack growth 2011-12-05 14:44:15 -08:00
Haitao Li
47ea57fead rustc: Add suffix ".rc" to LLVM module identifier
LLVM code generator emits the ".file filename" directive for ELF
backends. Value of the "filename" is set as the LLVM module identifier.
Due to a LLVM MC bug[1], LLVM crashes if the module identifer is same as
other symbols such as a function name in the module.

This patch adds a ".rc" suffix (means crates) to LLVM module identifier
to workaround the bug.

Fixes issue #1251.

1. http://llvm.org/bugs/show_bug.cgi?id=11479
2011-12-05 17:21:20 +08:00
Stefan Plantikow
a69eab16ec typeck: Fix for #932 2011-12-05 01:23:10 +01:00
Haitao Li
96b0881a68 rustc: Fix memory leak in do-while loop
Issue #1257
2011-12-05 00:38:38 +08:00
Stefan Plantikow
68a82e4468 const_check: trans: added support for trivial casts
Part of #1215
2011-12-02 11:58:35 -08:00
Stefan Plantikow
4ba3158e4f parse: typeck: enabling trivial casts of tail-call return values
introduces ctypes::m_* machine type aliases for int, uint, float
depending on cfg(target_arch) that are used in tests
2011-12-02 11:38:24 -08:00