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
8befdd08a3
stdlib: Fix type in docs for result::chan
2011-10-29 20:16:44 -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
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
c1092fb6d8
stdlib: Add result module
...
This contains a result tag with ok(T) and error(U) variants. I expect
to use it for error handling on functions that can recover from errors,
like in the io module.
2011-10-29 01:25:06 -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
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
54ddb553c2
stdlib: Replace an unsafe cast with ptr::null
2011-10-28 14:25:40 -07:00
Brian Anderson
f96ad30dfc
stdlib: Make reinterpret_cast and leak unsafe
2011-10-28 14:19:17 -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
2e8a8390d5
stdlib: Rename the 'ls_' param in list functions to 'ls'
2011-10-28 13:34:17 -07:00
Brian Anderson
1da99cdf68
stdlib: Make list::from_vec more efficient
2011-10-28 13:32:11 -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
7a0aee74bf
Move to short type parameter keywords
...
Issue #1076
2011-10-28 15:25:33 +02:00
Brian Anderson
d96c419b14
Add std::vec::foldr
2011-10-27 21:34:16 -07:00
Brian Anderson
7a7940daca
Add reverse iterators to std::vec
2011-10-27 21:09:02 -07:00
Brian Anderson
f1f0e6c06c
Remove std::vec::eachi. Same function as iter2.
2011-10-27 20:50:10 -07:00
Brian Anderson
1a89e589a4
Implement vec::foldl without recursion
2011-10-27 20:47:06 -07:00
Brian Anderson
b5ed1c46c0
Add std::vec::iter
2011-10-27 20:30:06 -07:00
Brian Anderson
9c097d19e4
Remove std::int::eq_alias
...
This is the exact same function as int::eq
2011-10-27 18:23:06 -07:00
Brian Anderson
b16d9019a8
Make option::is_some option::is_none pure
2011-10-27 18:15:58 -07:00
Brian Anderson
91997e79aa
Make vec::reversed take [mutable? T]
2011-10-27 17:49:13 -07:00
Brian Anderson
74a1e054eb
Make std:vec::grow_fn take an init_op type
2011-10-27 17:06:49 -07:00
Brian Anderson
506ae934f8
Reorder std::vec so the documentation renders better
...
Put all types first, then predicates, then functions
2011-10-27 17:03:38 -07:00
Brian Anderson
2b85817af8
Convert various functions in std to take lambda blocks
2011-10-27 16:27:47 -07:00
Brian Anderson
cf2624106c
Document std::bitv
2011-10-27 15:35:56 -07:00
Brian Anderson
e0715380dc
Add more std docs
2011-10-27 14:54:18 -07:00
Matt Brubeck
5d6fe1a533
Remove uint::max/min in favor if math::max/min
2011-10-27 13:37:53 -07:00
Matt Brubeck
50d99ec32c
Add documentation to std::uint
2011-10-27 13:37:53 -07:00
Matt Brubeck
a9f9227a1c
Add std documentation for float and u8 functions
2011-10-27 13:37:53 -07:00
Matt Brubeck
9e4c2b6bc6
Mark uint add/sub/mul/div/rem functions as pure
2011-10-27 13:37:53 -07:00
Matt Brubeck
8dba51b87c
Add function aliases for float operators
2011-10-27 13:37:53 -07:00
Brian Anderson
26d839216b
Add more std docs
2011-10-27 13:25:20 -07:00
Brian Anderson
00404ebe62
Cleanup in std::task
2011-10-27 11:29:04 -07:00
Brian Anderson
20e4f793e2
More std docs
2011-10-27 11:17:23 -07:00
Brian Anderson
17c651b3b0
Remove task::join_id
...
This is the old, racy way of joining to a task. It is no longer used.
2011-10-26 20:43:47 -07:00
Brian Anderson
4d669036f3
Add more std documentation
2011-10-26 18:32:34 -07:00
Brian Anderson
197c8543fe
Add more std documentation
2011-10-26 11:47:42 -07:00
Brian Anderson
7ae757583a
Begin documenting std and add doc generation using naturaldocs
...
Naturaldocs isn't really that great but it seems easier to get
something working than with doxygen, for which we would need to
convert rust code to something C++ish. We probably want to just
write a rustdoc utility at some point.
2011-10-25 18:01:52 -07:00
Marijn Haverbeke
013107a25c
Properly take mutable object fields into account during alias analysis
...
Closes #1055
2011-10-25 17:57:26 +02:00
Marijn Haverbeke
cfdf193c46
Update our code to new type parameter kind syntax
...
Closes #1067
2011-10-25 15:56:55 +02:00
Niko Matsakis
a5cbf4b13b
remove (unused) fn rust_list_files from win32_fs; that is
...
defined in fs.rs
2011-10-24 16:06:18 -07:00
Niko Matsakis
e308f3346b
remove unused task ptr arg
2011-10-24 16:06:18 -07:00
Niko Matsakis
f8de679c1e
move remaining task natives to cdecl ABI (run on rust stack)
2011-10-24 16:06:18 -07:00
Niko Matsakis
e838edc0b3
isolate those funcs in task that can run on the c stack
2011-10-24 16:06:17 -07:00
Niko Matsakis
02d7a1e781
move sys fns into c-stack-cdecl and get_type_desc() into rusti
...
there is one test failure, stdtest/sys.rs, which inexplicably
(thus far) fails to compile because it invokes
sys::rustrt::last_os_error() instead of invoking
sys::last_os_error(). If stdtest/sys.rs is updated to invoke
the wrapper, it passes. Still tracing the source of this error.
2011-10-24 16:06:17 -07:00
Niko Matsakis
0598635bdc
migrate leak
2011-10-24 16:06:17 -07:00
Niko Matsakis
8eb336a705
migrate rust_run_program
2011-10-24 16:06:17 -07:00
Niko Matsakis
5ddc15e42e
migrate debugging funcs
2011-10-24 16:06:17 -07:00
Niko Matsakis
c04f42e2c7
migrate sched_threads call
2011-10-24 16:06:17 -07:00
Niko Matsakis
6910552698
convert str methods to c-stack-cdecl
2011-10-24 16:06:17 -07:00
Niko Matsakis
12ab0d66f5
make time module use c-stack-cdecl
2011-10-24 16:06:17 -07:00
Niko Matsakis
96629d5c21
move rand functions into c-stack-cdecl mode
2011-10-24 16:06:17 -07:00
Niko Matsakis
35e01e0137
remove unnecessary && from various file routines
2011-10-24 16:06:17 -07:00
Niko Matsakis
af99b4b0dc
move more native "rust" to native "c-stack-cdecl"
2011-10-24 16:06:16 -07:00
Niko Matsakis
910f7c6dd3
move io.rs natives from "rust" to "c-stack-stdlib"
2011-10-24 16:06:16 -07:00
Niko Matsakis
b13e7e0f3d
move fs routines to c-stack-stdlib
2011-10-24 16:06:16 -07:00
Niko Matsakis
4880065429
rip out unused task pointers
2011-10-24 16:06:16 -07:00
Niko Matsakis
d9b23cb022
move comm functions out of rust abi
2011-10-24 16:06:16 -07:00
Niko Matsakis
44697a4293
purge log_err
2011-10-24 16:06:16 -07:00
Niko Matsakis
e590869c8f
update vec libs to use c-stack-cdecl calling convention
2011-10-24 16:06:16 -07:00
Marijn Haverbeke
6c4c33e009
Clean up character pattern in float.rs
...
This is actually a test to see if I fixed the bot.
2011-10-21 21:06:54 +02:00
Marijn Haverbeke
6bcb4a426c
Remove last uses of iterators from stdlib
...
Issue #1056
2011-10-21 12:31:48 +02:00
Marijn Haverbeke
4ebbbe597e
Move hash table iteration over to block-taking functions
...
Issue #1056
2011-10-21 12:21:27 +02:00
Brian Anderson
ebc61e39d7
Remove temporary fn# syntax
2011-10-20 20:34:04 -07:00
Brian Anderson
29ad3bdb10
Make fn denote a bare function. Convert fn to fn@ as needed
2011-10-20 18:23:48 -07:00
Brian Anderson
686d6a485f
Drop the 2 from the spawn*2 functions
...
Issue #1022
2011-10-20 18:23:47 -07:00
Brian Anderson
e0bba33caa
Rename std::task::spawn_inner to unsafe_spawn_inner
...
Delete the rest of the old, unused spawn functions.
Issue #1022
2011-10-20 18:23:47 -07:00
Brian Anderson
446aea11d0
Stop exporting unsafe spawn functions
...
Issue #1022
2011-10-20 18:23:47 -07:00
Brian Anderson
3b54dcfa79
Convert the test runners to typesafe spawn
...
Issue #1022
2011-10-20 18:23:47 -07:00
Brian Anderson
1abebf042a
Convert std::aio to new spawn functions
...
Issue #1022
2011-10-20 18:23:47 -07:00
Brian Anderson
4341e50e3a
Add safe versions of spawn using bare functions
...
Currently they just wrap the unsafe versions. Will need to be rewritten
eventually.
Issue #1022
2011-10-20 18:23:47 -07:00
Marijn Haverbeke
457683c7fe
Do not pass taskpointers to "rust" native functions
...
Issue #466
2011-10-20 14:22:17 +02:00
Marijn Haverbeke
71a4a66135
Add a math module to the standard lib
...
I need some rudimentary stdlib stuff for the tutorial.
Closes #1042
2011-10-18 13:54:35 +02:00
Marijn Haverbeke
3cabe7429f
Add a print and println to std::io
2011-10-18 13:06:47 +02:00
Brian Anderson
b61578e1cd
Don't unify from mutable? to immutable
...
Immutable is supposed to be a subtype of mutable-huh.
2011-10-17 16:36:49 -07:00
David Rajchenbach-Teller
454333368c
[Lib] int.rs, uint.rs: added max_value, min_value
2011-10-17 11:22:57 -07:00
David Rajchenbach-Teller
064f9dd93e
[Lib] uint.rs: +min_value
2011-10-17 11:22:57 -07:00
David Rajchenbach-Teller
a85e035038
[Lib] rand.rs: type rng now defines next_float
2011-10-17 11:22:57 -07:00
David Rajchenbach-Teller
eba88ef3ea
[Lib] u32.rs: created
2011-10-17 11:22:57 -07:00
David Rajchenbach-Teller
27ca86a853
[Lib] u8.rs, u64.rs: +min_value, max_value
2011-10-17 11:22:57 -07:00
Brian Anderson
6e67c4b253
Cleanse usage of some unsafe functions on win32
2011-10-12 16:42:13 -07:00
Niko Matsakis
e8a0e592da
reimplement some of the unsafe stuff which got lost
...
- blocks inherit unsafety
- remove the --check-unsafe flag
- add unsafe annotations where needed to get things to compile
2011-10-12 16:33:07 -07:00
Niko Matsakis
046ca827dd
Add unsafe blocks, unsafe functions, and two rudimentary tests
...
related to them
2011-10-12 14:26:47 -07:00
Niko Matsakis
29584cc5ac
Extend the unchecked block stuff to allow unsafe blocks as well.
2011-10-12 14:26:47 -07:00
David Rajchenbach-Teller
8c9dd54ded
[Renaming] str_to_float is now float::from_str, float_to_str is now float::to_str
2011-10-12 10:56:05 +02:00
David Rajchenbach-Teller
7faed3d87c
[Fix] float.rs: str_to_float reimplemented
2011-10-12 10:56:05 +02:00
David Rajchenbach-Teller
3219c40e18
[Optim] int.rs: reimplemented pow with fast exponentiation
2011-10-12 10:56:05 +02:00
David Rajchenbach-Teller
2ec85135e2
[Move] Moved str_to_float, float_to_str from compiler to lib
2011-10-11 16:41:34 +02:00
Marijn Haverbeke
33167f7dec
Adjust function signatures to allow for vecs being immediate
...
Some code was relying on vectors being implicitly by-reference (as
non-immediate value). This adds the necessary &&-sigils.
Closes #1021
2011-10-10 16:01:51 +02:00
Marijn Haverbeke
b4bae8fea5
Make vectors and strings immediates again
...
There's no good reason to force them to be spilled anymore. Some
pieces of trans become more elegant this way, and less stack allocs
and load/stores are needed.
Issue #1021
2011-10-10 15:59:16 +02:00
Marijn Haverbeke
fe916fb9f0
Give up on providing a by-value version of map, convert fold over to
...
passing pointers by ref
Issue #1008
2011-10-07 09:56:12 +02:00
Marijn Haverbeke
f9fbd86f52
Parse and typecheck by-value and by-ref arg specs
...
Add sprinkle && throughout the compiler to make it typecheck again.
Issue #1008
2011-10-07 09:09:50 +02:00
Brian Anderson
04e89af6db
Add std::str::contains
2011-10-06 16:08:44 -07:00
Patrick Walton
cf3e7f2f0b
stdlib: Add a void type
2011-10-05 16:33:17 -07:00
Brian Anderson
82ef8519c3
Fix some path handling in std::fs on win32
2011-10-05 16:21:55 -07:00
Brian Anderson
a8ce543dc9
Add std::os::get_exe_path
...
Need this to correctly determine sysroot in rustc
2011-10-04 21:35:06 -07:00
Brian Anderson
a0a4d34e14
Add std::ctypes
2011-10-04 21:35:06 -07:00
Brian Anderson
6f5a0c7500
Add std::fs::normalize
2011-10-04 21:22:03 -07:00
Brian Anderson
51ae30287b
Add std::fs::split
2011-10-04 20:18:04 -07:00
Patrick Walton
0e5ea4d64f
Revert "stdlib: Migrate rust_file_is_dir() over to the C stack, and add a void type" due to build bustage on Windows
...
This reverts commit 9698ef89a0
.
2011-10-04 18:24:30 -07:00
Patrick Walton
9698ef89a0
stdlib: Migrate rust_file_is_dir() over to the C stack, and add a void type
2011-10-04 18:20:22 -07:00
Patrick Walton
af60cf407c
rt: Switch the AIO stuff to the C stack
2011-10-04 12:08:06 -07:00
Brian Anderson
0148daa058
Reorganize structure of build directory
...
Each stage is organized more according to Unix standards and to
accommodate multiple target architectures.
stageN/
bin - rustc lives here
lib - libraries that rustc needs
lib/rustc/$(target_triple/ - target libraries
2011-09-29 22:58:33 -07:00
Patrick Walton
5b6dbcb030
stdlib: Un-export str::buf; add a comment
2011-09-29 18:36:27 -07:00
Patrick Walton
dd7ff8dee4
stdlib: Export str::buf
2011-09-29 17:58:51 -07:00
Patrick Walton
6dece91ed3
stdlib: Add vec::eachi to the standard library
2011-09-29 17:34:49 -07:00
Brian Anderson
381205b747
Revert "Revert "Implement pattern ranges for all numeric types.""
...
This reverts commit a034f87146
.
Conflicts:
src/comp/middle/check_alt.rs
src/comp/middle/trans_alt.rs
src/comp/syntax/ast.rs
src/comp/syntax/ast_util.rs
src/comp/syntax/fold.rs
src/comp/syntax/print/pprust.rs
Conflicts:
src/comp/middle/trans_alt.rs
2011-09-28 12:46:29 -07:00
Brian Anderson
b8bb663df7
Don't ever raise unique kinds of pinned kinds to shared (again)
...
So *resource, ~resource, [resource] are all pinned. This is counter to the
design of the kind system, but this way is a much clearer path to type safety.
Once we've established a good baseline with lots of tests, then we can try to
make raising pinned kinds work.
2011-09-27 16:03:10 -07:00
Brian Anderson
6b42ad5ea0
Enforce copy restrictions on let initializers
2011-09-26 22:00:15 -07:00
Patrick Walton
47e5ab093a
stdlib: Fix typos in comments in lib/test.rs
2011-09-26 16:59:15 -07:00
Jesse Ruderman
48c2c9b3a7
Mark vec::len as pure
2011-09-24 15:10:03 -07:00
Brian Anderson
856acbf66d
Vectors containing pinned kinds become pinned
...
Otherwise they could be copied
2011-09-24 12:36:51 -07:00
Jesse Ruderman
3a7a2943dd
Add vec::filter
2011-09-23 19:10:48 -07:00
Marijn Haverbeke
a034f87146
Revert "Implement pattern ranges for all numeric types."
...
This reverts commit ce0f054f9d
.
2011-09-21 18:42:09 +02:00
Josh Matthews
ce0f054f9d
Implement pattern ranges for all numeric types.
2011-09-21 09:36:12 +02:00
Patrick Walton
d9c664e3fa
Revert "Revert "Make option::get return the option contents by reference" due to memory corruption"
...
This reverts commit d1c27ba9e0
.
2011-09-16 12:20:06 -07:00
Tim Chevalier
994beca00d
Add unreachable() fn, also nitpicking
2011-09-15 19:51:27 -07:00
Graydon Hoare
c94e612ade
Begin sketching an ICU binding. Doesn't work yet.
2011-09-15 15:49:17 -07:00
Patrick Walton
d1c27ba9e0
Revert "Make option::get return the option contents by reference" due to memory corruption
...
This reverts commit fc0bf12516
.
2011-09-15 12:52:09 -07:00
Marijn Haverbeke
fc0bf12516
Make option::get return the option contents by reference
...
I can't believe this actually works!
2011-09-15 17:49:29 +02:00
Marijn Haverbeke
7298b8f4ba
Insert omitted semicolons for statements
2011-09-15 09:49:00 +02:00
Graydon Hoare
a4815b6742
Factor imports mindlessly.
2011-09-12 16:13:28 -07:00
Brian Anderson
393deeb06f
Merge branch 'unwind'
...
Conflicts:
src/comp/middle/trans.rs
src/comp/middle/trans_build.rs
src/lib/run_program.rs
src/test/compiletest/runtest.rs
2011-09-12 09:36:51 -07:00
Marijn Haverbeke
ca1df2b111
Pretty-print for new arg-mode syntax
2011-09-12 12:49:00 +02:00
Marijn Haverbeke
fc6b7c8b38
Reformat for new mode syntax, step 1
...
Long lines were fixed in a very crude way, as I'll be following up
with another reformat in a bit.
2011-09-12 12:04:14 +02:00
Brian Anderson
22001d1dce
Remove hack_allow_leaks
...
Happy to close the loop on this one.
Issue #236
2011-09-11 17:31:40 -07:00
Brian Anderson
a1131748c2
Add a waitpid wrapper to std::run that interprets the exit status on unix
...
This makes the result of running a program a little more uniform between unix
and windows
2011-09-11 17:31:34 -07:00
Brian Anderson
25ae3d655c
Rewrite spawn yet again
...
The motivation here is that the bottom of each stack needs to contain a C++
try/catch block so that we can unwind. This is already the case for main, but
not spawned tasks.
Issue #236
2011-09-07 10:32:58 -07:00
Brian Anderson
01b254b411
Rename istr-stuff to str in the runtime. Issue #855
2011-09-02 22:11:46 -07:00
Brian Anderson
5c49e4f4e9
Reformat. Issue #855
2011-09-02 22:11:42 -07:00
Brian Anderson
1e8200dadd
Rename std::vec::unsafe::ivec_repr to vec_repr. Issue #855
2011-09-02 15:13:41 -07:00
Brian Anderson
72c14d5a41
Eliminate const_refcount. Issue #855
2011-09-02 15:13:41 -07:00
Brian Anderson
99ee0fca67
Remove estrs and evecs from runtime. Issue #855
2011-09-02 15:13:41 -07:00
Brian Anderson
1d3eb4911a
Remove #ifmt. Issue #855
2011-09-01 18:54:06 -07:00
Brian Anderson
418d09e547
Convert all uses of #ifmt to #fmt. Issue #855
2011-09-01 18:54:03 -07:00
Brian Anderson
6972f07510
Make #fmt and #ifmt synonymous. Issue #855
2011-09-01 17:56:25 -07:00
Brian Anderson
ab6bb035e5
Rename std::istr to std::str. Issue #855
2011-09-01 17:27:58 -07:00
Tim Chevalier
1f4f8d317c
Declare a bunch of int functions as pure
2011-09-01 16:32:05 -07:00
Brian Anderson
e824775d53
Remove std::str. Issue #855
2011-09-01 16:09:15 -07:00
Brian Anderson
1b15c9e155
Remove estr conversion functions. Issue #855
2011-09-01 15:55:39 -07:00
Brian Anderson
f07a328c16
Convert rust_list_files to istrs. Issue #855
2011-09-01 15:51:47 -07:00
Brian Anderson
82634cd530
Convert rust_getcwd to istrs. Issue #855
2011-09-01 15:51:47 -07:00