Commit Graph

458 Commits

Author SHA1 Message Date
Brian Anderson
0d5d2e5e14 core: Don't use upcall_vec_grow from str::push_char 2012-03-29 00:20:05 -07:00
Grahame Bowland
7a87258155 Rewrite str::push_char in rust.
Avoid crossing to C to reallocate underlying array when possible,
if we must we now only cross once per char (not once per byte.)
2012-03-29 00:20:05 -07:00
Brian Anderson
b7b66b6cb3 core: Don't call into the runtime to reserve if we have capacity 2012-03-29 00:20:05 -07:00
Brian Anderson
c0a99790cb core: Add str::capacity 2012-03-29 00:20:05 -07:00
Brian Anderson
ad21976fbc core: Add vec::capacity 2012-03-29 00:20:05 -07:00
Brian Anderson
5e42c5cf19 core: Add str::reserve_at_least 2012-03-29 00:20:05 -07:00
Brian Anderson
b3d7823381 core: Add and use vec::reserve_at_least
This reserves in powers of two
2012-03-29 00:20:05 -07:00
Brian Anderson
8e743b2981 core: Improve docs for str::reserve 2012-03-29 00:20:05 -07:00
Brian Anderson
1446534271 core: Clarify docs on vec::reserve 2012-03-29 00:20:05 -07:00
Brian Anderson
8cf44bed57 core: Add int8_t, etc. types to libc::types::common::c99 2012-03-28 16:32:02 -07:00
Graydon Hoare
b37d7e26fe Update crate URLs to point to interesting things. 2012-03-28 13:52:47 -07:00
Brian Anderson
f4ee5582c7 core: Rename iter::to_list to to_vec. Closes #2056 2012-03-27 14:50:33 -07:00
Marijn Haverbeke
b5a4fa9456 Move some code over to iterator-for to see how it performs. 2012-03-27 15:46:33 +02:00
Marijn Haverbeke
eec6383771 Add vec::each, vec::eachi, and list::each
For use with the new for construct.

Issue #1619
2012-03-27 12:53:19 +02:00
Graydon Hoare
6e6798c4e1 Bulk-edit mutable -> mut. 2012-03-26 18:35:18 -07:00
Niko Matsakis
21111660ca Improve type inference to compute LUB/GLB 2012-03-26 10:34:58 -07:00
Niko Matsakis
bf9d714d46 Avoid unifying vars when possible; handle bot (more) correctly 2012-03-24 21:38:43 -07:00
Niko Matsakis
042c532a08 Implement new inference algorithm. 2012-03-23 21:47:28 -07:00
Tim Chevalier
1ffaedac2b Remove unneeded code 2012-03-23 16:25:10 -07:00
Tim Chevalier
17cd9b4308 Remove ctypes -- it's no longer used. 2012-03-23 16:25:10 -07:00
Tim Chevalier
cb0eeed539 Remove a FIXME and workaround that appear to be obsolete 2012-03-23 16:25:10 -07:00
Tim Chevalier
372673b58c Remove char::to_lower, char::to_upper, use libc versions instead
As per Graydon's comments on #1985: remove char::to_lower and
char::to_upper. The str versions of these functions now call
libc::tolower and libc::toupper (using wrappers that cast between
char and c_char). Not sure how much better that is, but it at least
makes it clearer that these functions are Unicode-unsafe.
2012-03-23 16:25:10 -07:00
Marijn Haverbeke
1b81c5112a Remove last vestiges of old-style intrinsics
Closes #2048
2012-03-23 16:08:01 +01:00
Marijn Haverbeke
0545e4a920 Support [rust_stack] annotation on native functions (crudely) 2012-03-23 10:49:47 +01:00
Marijn Haverbeke
894b7469d6 Replace most uses of intrinsics in core with builtins
Issue #1981
2012-03-23 10:49:47 +01:00
Brian Anderson
f3fe85dad7 Bump version numbers to 0.2 2012-03-22 15:25:02 -07:00
Niko Matsakis
dc07280b08 make --enforce-mut-vars always on, add mut annotations to remaining files 2012-03-22 09:58:19 -07:00
Marijn Haverbeke
bc3f5e7160 rustc: Replace intrinsic vec_len with unsafe Rust code
Preparation for #1981
2012-03-21 15:56:48 +01:00
Niko Matsakis
cfcbec3cc3 Implement an initial version of placement new. 2012-03-20 20:39:40 -07:00
Brian Anderson
b181ea415e core: Rename unsafe::leak to unsafe::forget. Closes #2031 2012-03-20 15:20:37 -07:00
Graydon Hoare
0973bccfe2 Fail when there's an error starting a process. Close #1778. 2012-03-20 12:38:57 -07:00
Graydon Hoare
716dc29ffc Minor io fixlet to account for racing against last_os_error. 2012-03-20 11:59:23 -07:00
Marijn Haverbeke
7a34ac5890 Revert order of arguments to option::maybe and from_maybe
Closes #2019
2012-03-20 14:55:07 +01:00
Brian Anderson
20417ebf31 core: Move unsafe conversions to str::unsafe 2012-03-19 15:47:52 -07:00
Brian Anderson
1a40aa0935 core: Make converting from a C string unsafe 2012-03-19 15:47:52 -07:00
Brian Anderson
bbfa08d947 rustc: Stop generating the flag_none #fmt flag. Issue #1993 2012-03-19 14:28:42 -07:00
Brian Anderson
a0c6ad0c51 core: Remove a FIXME. Closes #1992
This is too vague to ever fix
2012-03-19 14:17:59 -07:00
Brian Anderson
009bbadd92 core: Remove a FIXME. Closes #2002
It works for negative integers
2012-03-19 14:14:49 -07:00
Brian Anderson
0201a03203 core: Rename vec::*_from to _between to match str mod 2012-03-18 17:40:52 -07:00
Brian Anderson
13bcc73625 core: Rename vec::position_elt to position_elem 2012-03-18 17:40:49 -07:00
Brian Anderson
e4af1ca065 core: Add vec::unshift 2012-03-18 16:16:47 -07:00
Brian Anderson
397f33fd35 core: Don't require a copyable T for vec::push 2012-03-18 16:08:37 -07:00
Brian Anderson
b1eb4579c6 core: Improve the docs and signature of vec::iter2 2012-03-18 15:41:03 -07:00
Brian Anderson
d6ded6788d core: vec::filter_map doesn't require a copyable T 2012-03-18 15:26:05 -07:00
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