Commit Graph

1594 Commits

Author SHA1 Message Date
Haitao Li
a936f78d98 rustc: Allow trailing comma in record fields 2011-11-22 13:41:17 -08:00
Marijn Haverbeke
1b8b0b8584 Properly check for copies when constructing a record using with
Closes #989
2011-11-22 13:27:40 +01:00
Marijn Haverbeke
5d6a74f020 Only warn about unreachable range patterns when appropriate
Also simplifies the literal-munging, and moves it into ast_util

Closes #1170
2011-11-22 11:49:29 +01:00
Stefan Plantikow
1c9f97b669 stdlib: added (2,3,4)-valued logic ADTs
This is useful for writing caches and perhaps in typestate predicates.
It also adds a companion module for bool with from_str, to_str, ... fns.
2011-11-21 11:15:19 -08:00
Marijn Haverbeke
7a7f0604f4 Ignore test_log_functions test for now
It fails under valgrind
2011-11-21 13:49:28 +01:00
Stefan Plantikow
68839c3dda Added logarithm functions for floats to std::math
Thanks to marijn for helping with #[link_name]
2011-11-21 12:59:59 +01:00
Marijn Haverbeke
b4217b383b Add a pass that checks that blocks are only used in safe ways
Closes #1188
2011-11-21 11:01:15 +01:00
Stefan Plantikow
ff04cb1eb0 Added a little sudoku solver to test/bench for everone's puzzle solving needs 2011-11-20 01:53:12 +01:00
Niko Matsakis
b6af844f3a re-enable tests for #1058 and #1059 2011-11-18 16:32:19 -08:00
Niko Matsakis
12a67af81d add test for issue #1174 2011-11-18 16:32:19 -08:00
Brian Anderson
44aebb978c Add tests for unsafe::reinterpret_cast 2011-11-18 10:32:27 -08:00
Brian Anderson
a9f7cbe240 stdlib: Add tests for sys::size_of and sys::align_of 2011-11-18 10:32:27 -08:00
Marijn Haverbeke
a7573af59d Add some tests for new kind system
Issue #1177
2011-11-18 16:15:46 +01:00
Marijn Haverbeke
f6491bb426 Update stdlib, compiler, and tests to new kind system
This involved adding 'copy' to more generics than I hoped, but an
experiment with making it implicit showed that that way lies madness --
unless enforced, you will not remember to mark functions that don't
copy as not requiring copyable kind.

Issue #1177
2011-11-18 12:49:01 +01:00
Marijn Haverbeke
4e03112141 Add a pass-by-copy parameter passing convention
This is intended to solve the problem of how to pass arguments to
constructor functions -- you want to move in rvalues, but not have to
explicitly copy stuff that is not an rvalue. The by-copy passing
convention will ensure the callee gets its own copy of the value. For
rvalues, it'll just pass off the value. For lvalues, it'll make a
copy.

Issue #1177
2011-11-18 12:49:00 +01:00
Marijn Haverbeke
9cf48d3753 Preparation for kind system overhaul
This goes before a snapshot, so that subsequenct patches can make the
transition without breaking the build. Disables kind checking pass, makes
parser accept both new and old-style kind annotation.

Issue #1177
2011-11-18 10:52:28 +01:00
Niko Matsakis
adc79e2f44 remove compile-command from local variable blocks 2011-11-17 11:46:13 -08:00
Haitao Li
388eed383f rustc: Add a flag '--warn-unused-imports'
Followup of issue #889
2011-11-17 09:28:30 +01:00
Brian Anderson
342dc21d2c Disconnect ports before draining them. Issue #1155 2011-11-16 17:22:14 -08:00
Niko Matsakis
25bc37cef9 refactor all unix types 2011-11-16 15:24:08 -08:00
Brian Anderson
b655fb9ea7 Replace 'mutable?' with 'const' 2011-11-16 14:41:32 -08:00
Brian Anderson
045a437556 rustc: Accept 'const' as synonym for 'mutable?' 2011-11-16 13:52:08 -08:00
Brian Anderson
f157d0b32c Fix S_IRUSR/S_IWUSR constants on mac. Closes #726 2011-11-16 12:18:15 -08:00
Brian Anderson
a362d85329 Add a test that native mods don't need to declare an ABI 2011-11-16 11:36:46 -08:00
Haitao Li
88f29aab27 Use attributes for native module ABI and link name
This patch changes how to specify ABI and link name of a native module.

Before:
  native "cdecl" mod llvm = "rustllvm" {...}

After:
  #[abi = "cdecl"]
  #[link_name = "rustllvm"]
  native mod llvm {...}

The old optional syntax for ABI and link name is no longer supported.

Fixes issue #547
2011-11-16 11:35:13 -08:00
Haitao Li
3b683f5205 rustc: Use link_name attribute for native function
Fixes issue #906
2011-11-16 23:45:07 +08:00
Stefan Plantikow
d335d1a169 Replaced constant functions with actual constants in std and updated tests
Fixes issue #1165
2011-11-15 18:02:45 -08:00
Brian Anderson
f47f92235a Make run-pass/bitwise 64-bit compatible 2011-11-15 17:01:06 -08:00
Brian Anderson
dd5512ccb0 Support conditional compilation based on architecture
target_os = "x86" or target_os = "x86_64"
2011-11-15 16:33:09 -08:00
Brian Anderson
47d875e002 Make run-pass/native-fn-linkname's main take no args
check-fast doesn't like it.
2011-11-15 10:09:33 -08:00
Haitao Li
eae478cd74 Use native fn's link name attribute if given
Fixes issue #905
2011-11-15 22:31:33 +08:00
Marijn Haverbeke
9ff6f816ba Fix handling of loops and conditionals in alias.rs
It now threads information about invalidated aliases through the AST
properly. This makes it more permissive for conditionals (invalidating
an alias in one branch doesn't prevent you from using it in another),
and less permissive for loops (it now properly notices when a loop
invalidates an alias that it might still use in another iteration).

Closes #1144
2011-11-15 13:29:57 +01:00
Brian Anderson
81d9717864 xfail-fast run-pass/native-dupe.rs
This test calls the task pin function which has side effects and causes
other tests to lock.
2011-11-14 19:26:43 -08:00
Brian Anderson
5b9f76eb7c stdlib: Run cleanups on data that fails to send 2011-11-14 14:07:52 -08:00
Brian Anderson
c74fd1dc77 Un-xfail-win32 two tests that should actually work 2011-11-14 13:13:44 -08:00
Haitao Li
b8dd148444 rustllvm: Add a GetOrInsertFunction wrapper
Fixes issue #1161

Test-case-by: Brian Anderson <banderson@mozilla.com>
Signed-off-by: Haitao Li <lihaitao@gmail.com>
2011-11-15 00:33:29 +08:00
Brian Anderson
138d9ca5d5 Drop enqueued elements when a port is destructed. Closes #1155 2011-11-13 15:43:58 -08:00
Brian Anderson
3cc2641fc3 Make various binops not typecheck for unsafe pointers. Closes #1173 2011-11-13 13:55:12 -08:00
Brian Anderson
768306badd Add test for #783. Closes #783 2011-11-11 17:14:30 -08:00
Brian Anderson
9b9fc33663 Rehabilitate run-fail/linked-failure4.rs 2011-11-11 16:52:07 -08:00
Brian Anderson
b2dd5f5cff Rehabilitate run-pass/task-killjoin.rs 2011-11-11 16:52:07 -08:00
Brian Anderson
d645f87c6d Rehabilitate run-pass/task-comm.rs 2011-11-11 16:11:34 -08:00
Brian Anderson
3d9023fa4d rt: Take the task lock when dropping port refcounts
Sucks, but otherwise there are races when one task drops the refcount to zero
followed by another bumping it again
2011-11-11 16:11:31 -08:00
Brian Anderson
07771ec25b Fix run-fail/spawnfail
Catch the case where a parent is killed immediately before it terminates
normally.
2011-11-11 14:20:00 -08:00
Brian Anderson
fcdb313bd5 Give task-perf-word-count default behavior. Closes #1172 2011-11-11 12:35:43 -08:00
Elly Jones
24b6645156 str: add escape()
Signed-off-by: Elly Jones <elly@leptoquark.net>
2011-11-10 19:53:28 -08:00
Haitao Li
7ee8b852fd Cleanup unused imports in tests 2011-11-10 19:19:40 -08:00
Haitao Li
9bc2f1800d rustc: Add support of warning on unused imports
Fixes issue #889
2011-11-10 19:19:10 -08:00
Brian Anderson
6c108aade9 stdlib: Remove sio and aio. Bitrotted. 2011-11-10 17:59:26 -08:00
Josh Matthews
43cb74b830 Add float support to #fmt. Fix #1014. 2011-11-10 11:40:34 -08:00
Brian Anderson
d26a96d2bb Add "cdecl" as synonym for "c-stack-cdecl" 2011-11-09 16:47:44 -08:00
Brian Anderson
e96342820d Add "stdcall" as synonym for "c-stack-stdcall" 2011-11-09 16:47:44 -08:00
Brian Anderson
4a4d31cf0e Make native "c-stack-stdcall" ABI work
The symbol name is based on the number of arguments, so we have to declare
it correctly.

For some reason GetLastError doesn't work now.
2011-11-09 15:29:53 -08:00
Joshua Wise
ae2ce09267 Add test with implemented bits of issue #570. 2011-11-09 14:33:06 -08:00
Brian Anderson
061d2c2f77 Make task_sleep an intrinsic. 2011-11-08 15:58:08 -08:00
Brian Anderson
68f82de817 rt: Remove task_yield builtin
This is just a special case of task_sleep
2011-11-08 14:28:41 -08:00
Brian Anderson
0f1af17a60 Remove all uses of native cdecl except for those that yield 2011-11-08 11:29:10 -08:00
Elly Jones
656a2af989 json: betterify for brson
Signed-off-by: Elly Jones <ellyjones@google.com>
2011-11-07 15:44:43 -08:00
Brian Anderson
fcd39b1191 Remove native "llvm" ABI 2011-11-07 15:29:05 -08:00
Brian Anderson
9375204461 Add test for if without else cannot return result 2011-11-07 12:20:22 -08:00
Brian Anderson
413d97f8bd Add tests for blocks that must not have results 2011-11-07 12:19:50 -08:00
David Rajchenbach-Teller
7bfe4dba80 [Test] rope.rs: testing concat 2011-11-06 18:10:23 +01:00
David Rajchenbach-Teller
f9a0d03c7a Fixup: forgotten stdtest/rope.rs 2011-11-05 13:04:34 -07:00
David Rajchenbach-Teller
a5dcf66ad3 stdlib: Added a small rope library 2011-11-05 13:04:34 -07:00
David Rajchenbach-Teller
07ffe68ad9 uint.rs: added functions div_ceil, div_floor, div_round 2011-11-05 13:04:34 -07:00
Marijn Haverbeke
5945667b99 Update some more tests for 1a68a9882 2011-11-03 11:14:48 +01:00
Marijn Haverbeke
1a68a98824 Disallow writing to function arguments again
Remove implicit copying hack.

Closes #1118
2011-11-03 10:57:54 +01:00
Matt Brubeck
5970e9c117 Add vec::permute to the standard library (#1013) 2011-11-02 15:35:10 -07:00
Marijn Haverbeke
d8d35e7c40 Rename car/cdr to head/tail in std::list
Closes #1086
2011-11-02 14:23:49 +01:00
Marijn Haverbeke
0a20eed2db Make ptr::addr_of return an immutable vec, add mut_addr_of 2011-11-02 12:20:12 +01:00
Brian Anderson
35affdfa61 Ignore another test involving failure on windows 2011-11-01 17:35:32 -07:00
Brian Anderson
eb8995e2fa Ignore should_fail tests on windows 2011-11-01 17:22:32 -07:00
Matt Brubeck
76077a9fb7 Add should_fail annotation for unit tests
This allows test cases to assert that a function is expected to fail.
Tests annotated with "should_fail" will succeed only if the function
fails.
2011-11-01 16:55:39 -07:00
Brian Anderson
61b604580b Fix alignment of interior pointers of dynamic-size types. Closes #1112
GEP_tup_like finds interior pointers by creating a tuple of all the types
preceding the element it wants a pointer to, then asks for the size of that
tuple. This results in incorrect pointers when the alignment of that tuple
is not the alignment of the interior type you're getting a pointer to.
2011-11-01 12:13:00 -07:00
Brian Anderson
8207506bbc Fix the filenames used in some IO tests
These tests are relying on not being able to open certain files, but did not
work correctly when run as root.
2011-10-31 12:50:45 -07:00
Matt Brubeck
80c926c5e2 Add a char::to_digit function 2011-10-31 16:15:36 +01:00
Matt Brubeck
4739942e74 Correct handling of non-numeric chars in parse_buf
Without this fix, int::parse_buf and uint::parse_buf return incorrect results
for any strings that contain non-numeric characters.  Fixes #1102.
2011-10-31 16:15:32 +01:00
Marijn Haverbeke
6f37accb29 Rename std::str::chars to iter_chars 2011-10-31 15:41:52 +01:00
Marijn Haverbeke
b0d60a7108 Add a way to iterate over a str's chars to std::str 2011-10-31 14:52:08 +01:00
Matt Brubeck
7080ac15fb Fix int::parse_buf for negative numbers (#1102) 2011-10-30 13:40:59 -07:00
Matt Brubeck
8c51d4b002 Make float::from_str ignore whitespace (#1089)
Discard leading and trailing whitespace, for consistency with C/JS/Java/etc.
Also, don't allow floating point numbers that start or end with 'e'.
2011-10-30 13:40:59 -07:00
Brian Anderson
ce1be4d9a9 Cleanup the existing platform-specific ignored tests 2011-10-29 18:30:36 -07:00
Brian Anderson
f7ebe23ae1 Add the ability to ignore tests by compiler config
[test]
[ignore(cfg(target_os = "win32"))]
2011-10-29 18:30:32 -07:00
Brian Anderson
2e0593d999 stdlib: Add vec::concat to concatenate a vector of vectors
Compare to str::concat
2011-10-29 18:14:08 -07:00
Brian Anderson
e0f44730e8 rustc: Support 'companion mod's for crates and directory mods
Under this scheme when parsing foo.rc the parser will also look for
foo.rs to fill in the crate-level module, and when evaluating a
directory module directive it will look for a .rs file with the
same name as the directory.
2011-10-29 01:40:20 -07:00
Brian Anderson
2cebef095e stdlib: Make io failures recoverable by returning a result 2011-10-29 01:25:11 -07:00
Brian Anderson
2b62a80202 stdlib: Add result::chain for composing results 2011-10-29 01:25:11 -07:00
Brian Anderson
802deac323 stdlib: Add fs::splitext
Splits a path into the filename + extension
2011-10-28 23:34:01 -07:00
Brian Anderson
a2377ccf91 stdlib: Add vec::init. Returns all but the last element.
Per haskell, to go with head/tail, and last.
2011-10-28 22:42:38 -07:00
Matt Brubeck
9c5c108d5b Add more isNaN tests 2011-10-28 14:44:39 -07:00
Matt Brubeck
45d7777991 Change behavior of float::nonpositive/nonnegative
Rather than being defined as !positive and !negative, these should act the
same as negative and positive (respectively).  The only effect of this change
should be that all four functions will now return false for NaN.
2011-10-28 14:44:39 -07:00
Matt Brubeck
000b2fe9a6 Use IEEE 754 semantics for NaN (Issue #1084) 2011-10-28 14:44:39 -07:00
Matt Brubeck
7e064deacf +0.0 should be positive and -0.0 should be negative. 2011-10-28 14:44:39 -07:00
Brian Anderson
ad66d72e6c stdlib: Make merge_sort take [mutable? T] 2011-10-28 13:56:01 -07:00
Brian Anderson
39b729e36f stdlib: Fix the list::foldl implementation 2011-10-28 13:45:32 -07:00
Brian Anderson
49e8ffa34f stdlib: Rename list::length to list::len to match vec::len 2011-10-28 13:37:19 -07:00
Brian Anderson
d53a253dca stdlib: make list::from_vec take [mutable? T] 2011-10-28 13:24:39 -07:00
Marijn Haverbeke
7dacccde94 Make shared kind the default only for generic functions
You almost never want a function with pinned type params. For
types, objects, resources, and tags, pinned types are actually often
more sane. For most of these, shared rarely makes sense. Only tricky
case is objs -- you'll have to think about the kinds you want there.

Issue #1076
2011-10-28 17:00:14 +02:00
Marijn Haverbeke
3397fa4701 Move to short kind kinds words in test suite
Issue #1076
2011-10-28 14:57:49 +02:00
Brian Anderson
4bb5a2c43a Remove whitespace 2011-10-27 21:35:08 -07:00