Commit Graph

464 Commits

Author SHA1 Message Date
Brian Anderson
3ee4a15e5e core: Don't copy elements in filter_map 2012-03-17 18:17:27 -07:00
Brian Anderson
c139b348fe core: Fix signature of call_with_retptr. Closes #1987 2012-03-17 14:57:13 -07:00
Brian Anderson
154a3fdf44 rustc: Unify impl self types in the opposite order so variance is correct 2012-03-16 17:06:15 -07:00
Brian Anderson
3445454e79 core: Resolve and remove some FIXMEs 2012-03-16 16:46:32 -07:00
Brian Anderson
9e9f4a6240 core: Remove str::init_elt
This was added based on my FIXME, but I no longer believe it has a place in
core::str, partly because it doesn't follow current naming conventions, and
partly because it can be immitated with a one liner using str::from_chars and
vec::from_elem. I have replaced the existing uses with said one-liner.
2012-03-16 15:31:53 -07:00
Brian Anderson
47d468f08c core: Store reexporting result and either. Closes #1997 2012-03-16 15:14:37 -07:00
Brian Anderson
f80008f04b core: Add lots of string docs 2012-03-16 14:29:09 -07:00
Brian Anderson
3db8ae0bdc core: Remove extra backslashes from docs 2012-03-16 12:20:38 -07:00
Brian Anderson
a7132eeb1e core: Doc cleanup 2012-03-16 12:12:25 -07:00
Brian Anderson
0d88bf7e43 core: Escape some characters in comments 2012-03-16 11:58:39 -07:00
Erick Tryzelaar
2ddd084631 std: Add a function to iterate over a subset of a vec 2012-03-16 17:05:29 +01:00
Tim Chevalier
c86135e80b Comments only: associate core::libc FIXMEs with issue numbers 2012-03-15 23:12:07 -07:00
Tim Chevalier
2ef7d135a9 Comments only: associate core::iter FIXMEs with issue numbers 2012-03-15 23:12:07 -07:00
Tim Chevalier
f5da4881dc Comments only: issue numbers for FIXMEs 2012-03-15 23:12:06 -07:00
Tim Chevalier
c1c84e92dd Put the OS error in the error string in io::mk_file_writer() 2012-03-15 23:12:06 -07:00
Brian Anderson
389f53c6ff core: Docs 2012-03-15 18:58:30 -07:00
Tim Chevalier
07d0981bbb Comments only: associate FIXMEs with issue numbers in int library 2012-03-15 18:50:26 -07:00
Tim Chevalier
43b457c5d6 Comments only: associate FIXMEs in float libs with issue numbers 2012-03-15 18:46:17 -07:00
Tim Chevalier
20ec72830a Address FIXMEs in extfmt / add issue numbers 2012-03-15 17:50:22 -07:00
Tim Chevalier
ce3f369047 Change ctypes::intptr_t to int 2012-03-15 17:50:22 -07:00
Brian Anderson
bcf44f8cc1 core: Optimize str::unsafe::slice_bytes. Closes #1995 2012-03-15 17:10:39 -07:00
Brian Anderson
041c9a0863 core: Optimize str::bytes
This compiles down to a memmove. Takes about 1/4 of the time of the old
version.
2012-03-15 15:43:01 -07:00
Tim Chevalier
771177a814 Don't pass Unicode to char::is_upper 2012-03-15 15:40:43 -07:00
Tim Chevalier
26b54cc17e Add asserts to char::is_upper and char::is_lower
Add an assert that the argument char is ASCII, as well as adding
issue numbers to FIXMEs
2012-03-15 15:40:43 -07:00
Tim Chevalier
e697456d52 Associate FIXMEs with issue numbers (comments only) 2012-03-15 15:40:43 -07:00
Brian Anderson
844fbd83da core: Make some functions pure 2012-03-15 13:57:26 -07:00
Brian Anderson
561511e628 core: Channels are just port ids 2012-03-15 11:10:53 -07:00
Brian Anderson
1366d65660 rt: Remove remaining uses of rust_kernel::get_task_by_id 2012-03-15 11:10:52 -07:00
Brian Anderson
2a293ed8b8 Convert *u8 native string users to *c_char 2012-03-14 18:20:14 -07:00
Brian Anderson
e5dea87f43 core: Add str::from_c_str, from_c_str_len, as_c_str 2012-03-14 18:19:08 -07:00
Brian Anderson
3a2df84d89 core: Rename str::from_cstr et. al to from_buf 2012-03-14 18:19:08 -07:00
Brian Anderson
9e480708a2 core:: Eliminate str::sbuf. Replace with *u8 2012-03-14 18:19:08 -07:00
Niko Matsakis
ffa187db25 adjust auto_serialize to generate fns named serialize_T()
We used to generate a module T with a serialize() and deserialize() fn,
but this was suboptimal for a number of reasons:

- it required moving serialization into core so that uint etc worked
- it was harder to override the serialization behavior locally
  (this is now trivial)
2012-03-14 11:49:28 -04:00
Niko Matsakis
7c70d35a10 rewrite unify in a modal style, extend result module 2012-03-13 21:53:14 -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
Niko Matsakis
bdd0c9387b get new decorator extensions working 2012-03-13 21:30:06 -04:00
Brian Anderson
b968c8e6cd Name types after their modules instead of 't' 2012-03-13 15:14:17 -07:00
Brian Anderson
02e9400a82 core: Fix os::self_exe_path on FreeBSD 2012-03-13 13:51:03 -07:00
Brian Anderson
cd72b1f848 Overhaul constructor naming in libs 2012-03-13 11:07:22 -07: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
35400e13ad Use loop instead of while(true) in libraries and compiler itself
And remove spurious fails/unreachable() calls.
2012-03-10 20:34:17 -08:00
Brian Anderson
87d72303ad core: Remove empty bessel mod 2012-03-10 18:04:51 -08:00
Brian Anderson
e8f7bb0db1 core: Cleanup bool module
Instead of defining a type for bool, just use the bool type directly in order
to be more consistent with other modules. Cleanup the comments a bit.
2012-03-10 18:01:01 -08:00
Brian Anderson
91e5a1c8b3 core: Remove the nearly empty math module
This mod only had two functions, all of whose users have been changed
to use the uint module.
2012-03-10 17:43:19 -08:00
Brian Anderson
035197609a core: Formatting 2012-03-10 17:29:58 -08:00
Brian Anderson
6d4fb35912 core Remove vec::enum_chars/uint. Closes #1955 2012-03-10 17:07:23 -08:00
Brian Anderson
e4bb2d707f core: Rename vec::tail_n to vec::tailn to match other fns 2012-03-10 00:44:13 -08:00
Brian Anderson
a0f0a704b0 core: Clean up comments and exports 2012-03-10 00:35:02 -08:00
Brian Anderson
b22556a6f8 core: Convert to rustdoc 2012-03-09 22:56:53 -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
Graydon Hoare
7f55e7d087 Add a couple more missing pieces to libc and os. 2012-03-09 16:38:23 -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
d048a00cf3 Change util::unreachable to core::unreachable
Closes #1931
2012-03-08 14:30:01 -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
713006c7b6 add mutability annotations to libcore 2012-03-07 07:47:50 -08:00
Brian Anderson
ae5ea85c36 core: Resolve a FIXME in box::ptr_eq 2012-03-06 19:15:39 -08:00
Graydon Hoare
04e7bd6758 More UTF-16 wrapping on win32. Close #1927. 2012-03-06 18:49:08 -08:00
Graydon Hoare
e9571850da UTF-16-ify the win32 env routines. 2012-03-06 16:03:39 -08:00
Graydon Hoare
0e3dd5a3ee Export os, libc and path from libcore. 2012-03-06 16:03:39 -08:00
Brian Anderson
e9b5f4204a core: Remove some explicit move capture clauses 2012-03-06 13:05:03 -08:00
Brian Anderson
d1c6e34e1c core: Inline a bunch of unsafe functions 2012-03-06 11:20:43 -08:00
Brian Anderson
ee991cae81 rt: Add a hack to fix a port detach bug 2012-03-05 20:02:25 -08:00
Brian Anderson
958c321083 rt: Fix the atomic get_ref_count method to avoid races 2012-03-05 19:39:56 -08:00
Brian Anderson
1347d04bb0 rt: Properly block tasks while waiting for port detach 2012-03-05 19:39:56 -08:00
Brian Anderson
77295c56c5 rt: Simplify the recv interface 2012-03-05 19:39:56 -08:00
Niko Matsakis
3269a4043c rewrite vec to be more unsafe, more inlined 2012-03-05 16:47:52 -08:00
Graydon Hoare
5bf185b499 Port fsync, waitpid and remove_file to core::{os,libc}. 2012-03-05 14:00:44 -08:00
Brian Anderson
2d7750bc30 core: Fix os::load_self types on FreeBSD 2012-03-02 22:43:56 -08:00
Graydon Hoare
5812bebf87 Sadly, vec::init_elt_mut vanished since last (rushed) rebase. 2012-03-02 18:53:06 -08:00
Graydon Hoare
dafd649806 First cut at consolidated core::os module built on core::libc. 2012-03-02 18:46:13 -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
Graydon Hoare
47e7a05a28 Add some utf16 routines for OS API interop. 2012-03-02 15:47:40 -08:00
Niko Matsakis
def72bda47 retool inline encoding to handle methods, fix tests 2012-03-02 06:47:25 -08:00
Brian Anderson
99f231f347 core: Change a number of arguments in vec to const vecs 2012-02-29 18:13:29 -08:00
Niko Matsakis
7d0958f70f add the ability to snag the frame so we can verify that we are inlining 2012-02-29 11:54:47 -08:00
Patrick Walton
362f23641a libcore: Remove vec::to_ptr in favor of vec::unsafe::to_ptr. Closes #1829. 2012-02-28 20:43:39 -08:00
Erick Tryzelaar
8cc23aab6d expose float::pow_with_uint. 2012-02-28 18:00:50 -08:00
Erick Tryzelaar
6865df2611 core/std: whitespace fixes. 2012-02-28 18:00:50 -08:00
Niko Matsakis
e65c39c100 add #[inline] to vec::iter 2012-02-28 06:31:29 -08:00
Graydon Hoare
324ecb58a7 Add libc module to libcore and utility file to help generate it. 2012-02-27 18:34:42 -08:00
Niko Matsakis
f3ca50c9ca Encode/decode AST into metadata, re-instantiate inlined items 2012-02-24 20:46:27 -08:00
Marijn Haverbeke
780f8277f4 Finish cleanup of core::str
Closes #1849
2012-02-23 17:00:19 +01:00
Marijn Haverbeke
1d2b4b97ed Optimize str::replace 2012-02-23 17:00:19 +01:00
Marijn Haverbeke
d802c1fbd2 Various cleanups and optimizations in core::str 2012-02-23 17:00:19 +01:00
Marijn Haverbeke
35e9192762 Make str::pop_char and str::unsafe::pop_byte efficient
O(1) rather than O(string len)
2012-02-23 17:00:19 +01:00
Kevin Cantu
c2984b46b4 (core::str) comments 2012-02-23 17:00:19 +01:00
Kevin Cantu
961b6446b6 (core::str) rename ++ 2012-02-23 17:00:19 +01:00
Kevin Cantu
c3318f29fe (core::str) rename substr_len_bytes to substr_len, and delete unused byte_index[_from] 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
1b957c0942 (core::str) replace uses of unsafe::slice_bytes; replace find[_from]_bytes with find[_from] 2012-02-23 17:00:19 +01:00
Kevin Cantu
cec053487c (core::str) stop using index_chars 2012-02-23 17:00:19 +01:00
Kevin Cantu
6ea3d7935e (core::str) replace byte_index[_from] with index[_from] 2012-02-23 17:00:19 +01:00
Kevin Cantu
280633a728 (core::str) do some replacements 2012-02-23 17:00:19 +01:00
Kevin Cantu
2756a61e34 (core::str) add index, index_from, rindex which return byte positions of chars; rename find to find_chars; add fixmes to delete byte_index, byte_index_from 2012-02-23 17:00:19 +01:00
Kevin Cantu
e1d04e0062 (core::str) add a safe byte slice and maybe_slice ++ 2012-02-23 17:00:19 +01:00
Kevin Cantu
7c78b7dfed (core::str) add a safe byte slice and maybe_slice 2012-02-23 17:00:19 +01:00
Kevin Cantu
454b53a7c2 (core::char) rename slice -> slice_chars 2012-02-23 17:00:19 +01:00
Kevin Cantu
1cd5a0945a (core::str) rename rindex -> rindex_chars 2012-02-23 17:00:19 +01:00
Kevin Cantu
969fdf419c (core::str) rename index -> index_chars 2012-02-23 17:00:19 +01:00
Kevin Cantu
8ea96169ff (core::str) make len an alias for len_bytes ++ 2012-02-23 17:00:19 +01:00
Kevin Cantu
669ff690fd (core::str) make len an alias for len_bytes 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
Marijn Haverbeke
a3b655f8e3 Fix uint/u64 confusion
Causes a failure on 32-bit platforms
2012-02-22 13:44:55 +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
72373438d2 Add core::to_str module
Provides a central iface for the various stringification
functions.
2012-02-22 13:06:38 +01:00
Marijn Haverbeke
ad03761a97 Remove preconditions from libraries
Closes #1805
2012-02-22 11:47:47 +01:00
Brian Anderson
a896eb326e core: Fix unused variable warning 2012-02-21 14:25:51 -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
910a32c7c7 core: Add option::unwrap
This function uses some unsafe code to move the value out of an option.
2012-02-21 13:55:50 -08:00
Brian Anderson
9691ce18a2 core: Resolve a FIXME in str module 2012-02-21 01:03:13 -08:00
Brian Anderson
4601810747 core: Remove a useless test from option mod 2012-02-20 22:43:33 -08:00
Brian Anderson
4220dcf1e9 core: New task API 2012-02-20 18:58:04 -08:00
Brian Anderson
6b280c61ce core: Export future mod 2012-02-18 23:03:26 -08:00
Brian Anderson
23d36be1e9 core: Define futures in terms of local functions, of which port::recv is one possibility 2012-02-18 15:23:56 -08:00
Brian Anderson
4370188055 Merge pull request #1860 from erickt/master
add str::find_from_bytes and str::index_from_bytes
2012-02-18 13:17:12 -08:00
Brian Anderson
3411d19369 core: Make vec::push faster
This way makes it equivalent to the compiler's vec push, and is a lot
faster than calling vec::grow.
2012-02-17 18:15:52 -08:00
Marijn Haverbeke
ff42964546 Clean up some of trans using block combinators
`with_scope` and `with_cond` can be used to wrap a piece of code in a
scope block, or conditionalize it on a value, without doing all the
context-creation and jumping by hand.

Also renames @block_ctxt to block to reduce noise.
2012-02-17 23:03:12 +01:00
Graydon Hoare
2796ab6de9 Add a win32-ignore attribute to a should-fail test. 2012-02-17 11:28:18 -08:00
Erick Tryzelaar
23703c0661 core: add str::find_from. 2012-02-16 19:16:08 -08:00
Erick Tryzelaar
042a5222d1 core: rewrite str::byte_index to use vec functions 2012-02-16 18:35:45 -08:00
Erick Tryzelaar
d1c9b160ad core: slim down str.rs by importing some and none. 2012-02-16 17:30:56 -08:00
Brian Anderson
601f7144d8 core: Add comm::select2
Receives on two ports simultaneously
2012-02-16 12:53:18 -08: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
9ff5ba085d Fix bad line printing for parse errors
The code that extracted lines from partially-parsed files
was broken.

Closes #1848
2012-02-15 11:53:32 +01:00
Brian Anderson
ff6b71f78b core: Add core::future
Futures will be required for upcoming changes to the task API
2012-02-14 16:45:17 -08:00
Brian Anderson
b157f0b263 core: Add comm::peek for looking into the message queue 2012-02-14 14:07:06 -08:00
Brian Anderson
acabd821d2 Merge pull request #1831 from killerswan/str_fixes
(core::str) changes to find / find_bytes
2012-02-14 11:22:31 -08:00
Marijn Haverbeke
f2e880b750 Add [X].len() to core, use it in trans modules 2012-02-14 13:43:36 +01:00
Graydon Hoare
9caca02dac Merge pull request #1827 from uasi/from-cstr
Avoid extra memory allocations in core::str::from_cstr{,_len}
2012-02-13 11:29:58 -08:00
Kevin Cantu
69834646d2 (core::str) more test cases 2012-02-13 03:07:29 -08:00
Kevin Cantu
2600db4778 (core::str) added FIXME comment 2012-02-13 02:17:19 -08:00
Kevin Cantu
07ef368c60 (core::str) rename find_chars -> find 2012-02-13 01:57:05 -08:00
Kevin Cantu
c81867474a (core::str) add find_bytes and export it... 2012-02-13 01:56:58 -08:00
Kevin Cantu
748b63f63f (core::str) add find_chars and b2c_pos functions 2012-02-13 01:56:10 -08:00
Kevin Cantu
0e61fe2eea (core::str) use slice_bytes in starts_with for a little bit less string traversal 2012-02-13 01:56:10 -08:00
Brian Anderson
8309d50ff4 core: Add iter::filter_map 2012-02-12 22:30:58 -08:00
Brian Anderson
e360ddbd65 core: Add iterable implementation for strings 2012-02-12 22:17:10 -08:00
Brian Anderson
092c244d3a core: Rename iter::reverse to iter::reversed for consistency with vec mod 2012-02-12 22:11:42 -08:00
Brian Anderson
ad2f566ff2 core: Add abs functions for signed integer types 2012-02-12 22:04:06 -08:00
Brian Anderson
acc57a44fd core: Add compl functions for the rest of the integer types 2012-02-12 21:58:06 -08:00
Tomoki Aonuma
4d788be80d from_cstr and from_cstr_len are not unsafe, I think 2012-02-13 12:44:14 +09:00
Tomoki Aonuma
8d29e87056 core::str::from_cstr uses from_cstr_len 2012-02-13 12:44:14 +09:00
Tomoki Aonuma
e5cc9193f8 Avoid extra memory allocations in core::str::from_cstr_len 2012-02-13 12:44:14 +09:00
Brian Anderson
fde719f635 core: Implement foldl/r without copying the accumulator 2012-02-12 19:24:24 -08:00
Brian Anderson
d679c0eb34 core: Add iter::foldr 2012-02-12 19:24:24 -08:00
Brian Anderson
3edad3555e core: Add iter::count 2012-02-12 19:24:24 -08:00
Brian Anderson
85175d639f core: Add iter::reverse 2012-02-12 19:24:24 -08:00
Brian Anderson
c21db3bbc2 core: Add iter::min/max 2012-02-12 19:24:24 -08:00
Kevin Cantu
f5e1108fc3 (core::str) comments and cleanup 2012-02-12 15:30:21 -08:00