Commit Graph

2376 Commits

Author SHA1 Message Date
Huon Wilson
1cb0a567d1 Convert vec::{pop, shift, unshift, insert, remove, swap_remove} to methods. 2013-06-28 00:20:42 +10:00
Huon Wilson
d2e3e1e52b Convert vec::{head, tail, init, last} (and similar fns) to methods. 2013-06-27 22:37:00 +10:00
Huon Wilson
d0512b1055 Convert vec::[mut_]slice to methods, remove vec::const_slice. 2013-06-27 22:36:09 +10:00
bors
a28f9ba526 auto merge of #7361 : brson/rust/incoming, r=brson 2013-06-27 01:04:33 -07:00
bors
f1e09d6f1f auto merge of #7420 : mozilla/rust/rollup, r=thestinger 2013-06-26 23:07:41 -07:00
Brian Anderson
ddbccecc27 std::rt: Some cleanup 2013-06-26 17:00:42 -07:00
Daniel Micay
9f5f609b1c vec: remove superseded reverse_part function
`reverse(xs.mut_slice(a, b))` replaces `reverse_part(xs, a, b)`
2013-06-26 19:42:34 -04:00
Ben Blum
12e09afd6d Work-around 'static bound requirement in io::with_bytes_reader (note: does not fix #5723, interface still unsafe) 2013-06-26 18:14:43 -04:00
Kevin Ballard
3df37326cf Add methods .move_from() and .copy_from() to vec
Add method .move_from() to MutableVector, which consumes another vector
and moves elements into the receiver.

Add new trait MutableCloneableVector with one method .copy_from(), which
clones elements from another vector into the receiver.
2013-06-26 18:12:29 -04:00
Kevin Ballard
524a92c72f Add method .set_memory in vec::bytes for &[u8]
Add new trait vec::bytes::MutableByteVector which currently defines one
method .set_memory().
2013-06-26 18:11:18 -04:00
gifnksm
8edb8f6d39 iterator: Add IteratorUtil::max_by/min_by method 2013-06-27 06:55:22 +09:00
Eric Reed
42f3f069fa changed NOTE to TODO 2013-06-26 13:48:49 -07:00
Eric Reed
ce97bd4c8b cleaned up uv/net 2013-06-26 10:17:10 -07:00
bors
3433851a37 auto merge of #7345 : blake2-ppc/rust/iterator-flat-map, r=thestinger
flat_map_ produces an iterator that maps each element to an iterator,
and yields the elements of the produced iterators.

This is the monadic bind :: M a -> (a -> M b) -> M b  for iterators.

Named just like the vec method, but with a trailing underline until the
method resolution bug is resolved.

We discussed the name chain_map, but I decided to go with flat_map_ for consistency with vec.

Since it.map(f).flatten()  would be the same as it.flat_map(f), we could choose
to just implement a flatten method instead. Either way the possibilities are the same but flat_map is more convenient.
2013-06-26 09:47:16 -07:00
Eric Reed
87ecfb7435 converted TCP interface to newtype structs 2013-06-26 09:37:48 -07:00
Eric Reed
d0dc6970d8 removed unecessary method 2013-06-26 09:37:16 -07:00
bors
4ec05e02fa auto merge of #7216 : kballard/rust/task_rng, r=brson 2013-06-26 03:08:04 -07:00
bors
09b4525f84 auto merge of #7113 : alexcrichton/rust/banned-warnings, r=cmr
Reopening of #7031, Closes #6963

I imagine though that this will bounce in bors once or twice... Because attributes can't be cfg(stage0)'d off, there's temporarily a lot of new stage0/stage1+ code.
2013-06-26 00:56:04 -07:00
bors
22408d9ad5 auto merge of #7269 : luqmana/rust/drop, r=thestinger
Finally rename finalize to drop.
Closes #4332.
2013-06-25 20:29:06 -07:00
Brian Anderson
5d3ca4b843 Merge remote-tracking branch 'mozilla/master' into incoming
Conflicts:
	src/librustc/middle/astencode.rs
	src/librustc/middle/check_const.rs
2013-06-25 19:32:00 -07:00
Luqman Aden
ca2966c6d0 Change finalize -> drop. 2013-06-25 21:14:39 -04:00
Alex Crichton
c109bed15b Deny common lints by default for lib{std,extra} 2013-06-25 17:39:43 -07:00
Eric Reed
34b1135b59 Converted UdpSocket into a newtype struct and (dis)connecting uses move semantics rather than ~. 2013-06-25 17:05:59 -07:00
Eric Reed
f604686295 converted UvUdpSocket into a newtype struct 2013-06-25 17:04:28 -07:00
Eric Reed
c5b19f0bf9 changed outdated match on IpAddr 2013-06-25 16:04:09 -07:00
Eric Reed
d0c812f2a8 IPv6 struct 2013-06-25 16:03:24 -07:00
Eric Reed
2c5cfe1037 removed obsolete FIXMEs. formatting changes. 2013-06-25 16:02:51 -07:00
Eric Reed
f202713b73 satisfy the formatting check 2013-06-25 14:40:36 -07:00
Daniel Micay
e67c48a591 remove each from vec, HashMap and HashSet 2013-06-25 16:28:02 -04:00
Daniel Micay
64ee9668a2 container: remove internal iterators from Map
the maps are being migrated to external iterators
2013-06-25 16:26:23 -04:00
Eric Reed
1af2016358 removed unncessary unsafe block that was stopping compliation. 2013-06-25 11:59:47 -07:00
Eric Reed
4870dce3eb Merge remote-tracking branch 'upstream/io' into io
Conflicts:
	src/rt/rustrt.def.in
2013-06-25 11:45:44 -07:00
Eric Reed
794923c995 UDP networking with tests 2013-06-25 11:43:40 -07:00
bors
032dcc57e8 auto merge of #7371 : alexcrichton/rust/trying, r=cmr
This is an attempt at a smaller request than #7113, it's just the first two commits
2013-06-25 10:47:01 -07:00
Alex Crichton
42b44b21b1 Rename all files with the 'rc' extension 2013-06-25 08:55:15 -07:00
bors
d161e630d8 auto merge of #7317 : Aatch/rust/no-drop-flag, r=thestinger
This adds a `#[no_drop_flag]` attribute. This attribute tells the compiler to omit the drop flag from the struct, if it has a destructor. When the destructor is run, instead of setting the drop flag, it instead zeroes-out the struct. This means the destructor can run multiple times and therefore it is up to the developer to use it safely.

The primary usage case for this is smart-pointer types like `Rc<T>` as the extra flag caused the struct to be 1 word larger because of alignment.

This closes #7271 and #7138
2013-06-25 07:23:06 -07:00
bors
7aee5da08d auto merge of #7254 : Blei/rust/intrinsic-overhaul, r=cmr
This sets the `get_tydesc()` return type correctly and removes the intrinsic module. See #3730, #3475.

Update: this now also removes the unused shape fields in tydescs.
2013-06-25 04:38:06 -07:00
bors
5a089c252e auto merge of #7370 : Aatch/rust/snapshot, r=huonw
I also cleaned up the warnings.
2013-06-24 23:14:01 -07:00
James Miller
122f25dd5e Add missing import to tests 2013-06-25 18:02:56 +12:00
James Miller
6ad31ffb53 Warning police 2013-06-25 17:13:52 +12:00
James Miller
caa50ce15d Remove stage0 cfgs 2013-06-25 17:08:26 +12:00
James Miller
d9f6dd263c Set #[no_drop_flag] on Rc<T> and AtomicOption. Add Test 2013-06-25 16:11:34 +12:00
Brian Anderson
e65d0cbabe extra: Make test runner compatible with newsched 2013-06-24 17:07:03 -07:00
Brian Anderson
d071f51cdc std::rt: deny(unused_unsafe) 2013-06-24 17:07:03 -07:00
Brian Anderson
b530ca1033 std: Make unlinking and task notification work with newsched 2013-06-24 17:07:03 -07:00
Brian Anderson
5e7c5d6c3d std: Make box annihilator work with newsched 2013-06-24 17:07:03 -07:00
Brian Anderson
a09972db35 std: Move dynamic borrowck code from unstable::lang to rt::borrowck 2013-06-24 17:07:03 -07:00
Brian Anderson
aa9210d25a std: Rewrite vec_reserve_shared_actual in Rust 2013-06-24 17:07:01 -07:00
Brian Anderson
ac9481a438 Merge remote-tracking branch 'reusee/master' into HEAD 2013-06-24 14:09:37 -07:00
Fedor Indutny
bc70edbb25 libc: (u)int => c_(u)int for consts 2013-06-24 21:06:51 +02:00
Fedor Indutny
ddd6f59283 libc: add POSIX-compatible sysconf consts
Because its part of POSIX. Values are taken from FreeBSD, linux
and OSX header files.
2013-06-24 19:04:00 +02:00
Fedor Indutny
079b07df55 libc: support functions from sys/mman.h
Because its part of POSIX. Values are taken from FreeBSD, linux
and OSX header files.
2013-06-24 19:04:00 +02:00
blake2-ppc
6291702cf3 iterator: Add IteratorUtil::flat_map_ method
flat_map_ produces an iterator that maps each element to an iterator,
and yields the elements of the produced iterators.

This is the monadic bind :: M a -> (a -> M b) -> M b  for iterators.

Named just like the vec method, but with a trailing underline until the
method resolution bug is resolved.
2013-06-24 12:50:41 +02:00
Daniel Micay
da1a9a30fd work around ICE from default method
issue #7341
2013-06-24 01:58:10 -04:00
Daniel Micay
3ab5ec4b7c iterator: implement collect with FromIterator
This makes it take advantage of the size hint for pre-allocation.
2013-06-24 01:35:15 -04:00
Daniel Micay
8779be39e1 implement Clone for slices 2013-06-24 01:35:12 -04:00
Daniel Micay
e2e39234cc remove old_iter
the `test/run-pass/class-trait-bounded-param.rs` test was xfailed and
written in an ancient dialect of Rust so I've just removed it

this also removes `to_vec` from DList because it's provided by
`std::iter::to_vec`

an Iterator implementation is added for OptVec but some transitional
internal iterator methods are still left
2013-06-24 01:35:11 -04:00
bors
ac4211ef52 auto merge of #7279 : hanny24/rust/master, r=msullivan
This commit adds filtered method for Option type. It is not exactly necessary (chain method can be used instead), however I believe that this approach using extra filtered method is more convinient.
2013-06-23 17:40:56 -07:00
Philipp Brüschweiler
e2f1049bd5 Remove unused TyDesc parameter from the glue functions
To remove the environment pointer, support for function pointers without
an environment argument is needed (i.e. a fixed version of #6661).
2013-06-23 13:02:00 +02:00
Philipp Brüschweiler
976c0b3dfb Remove rust_call_tydesc_glue
Towards #4812. Also includes some minor cleanups.
2013-06-23 12:49:16 +02:00
Philipp Brüschweiler
8bf0033345 Remove unused shape fields from typedescs 2013-06-23 12:49:16 +02:00
Philipp Brüschweiler
469f394b25 Remove intrinsic module
To achieve this, the following changes were made:
* Move TyDesc, TyVisitor and Opaque to std::unstable::intrinsics
* Convert TyDesc, TyVisitor and Opaque to lang items instead of specially
  handling the intrinsics module
* Removed TypeDesc, FreeGlue and get_type_desc() from sys

Fixes #3475.
2013-06-23 12:49:16 +02:00
Philipp Brüschweiler
f2c5642d13 Fix get_tydesc() return type
This fixes part of #3730, but not all.
Also changes the TyDesc struct to be equivalent with the generated
code, with the hope that the above issue may one day be closed for good,
i.e. that the TyDesc type can completely be specified in the Rust
sources and not be generated.
2013-06-23 12:46:28 +02:00
Daniel Micay
ac2e167e7e hashmap: add FIXME number 2013-06-23 05:13:13 -04:00
blake2-ppc
8baefec013 std::to_str: Use .iter() for HashMap and HashSet 2013-06-23 04:23:12 -04:00
blake2-ppc
13f666a724 std::hashmap: Remove BaseIter impl for HashSet
Remove the BaseIter impl, while keeping the .each method until callers
are converted.
2013-06-23 04:23:01 -04:00
blake2-ppc
f045210857 std::hashmap: Use .iter() instead of .each and similar 2013-06-23 04:23:00 -04:00
blake2-ppc
3af1d20bea std::hashmap: Add test_iterate for HashSet 2013-06-23 04:23:00 -04:00
blake2-ppc
080d498af2 std::hashmap: Implement external iterator for HashMap and HashSet 2013-06-23 04:23:00 -04:00
Daniel Micay
d2e9912aea vec: remove BaseIter implementation
I removed the `static-method-test.rs` test because it was heavily based
on `BaseIter` and there are plenty of other more complex uses of static
methods anyway.
2013-06-23 02:05:20 -04:00
Daniel Micay
c9342663df iterator: add a FromIterator trait
This is able to take advantage of the lower bound from the size hint.
2013-06-22 15:59:59 -04:00
Daniel Micay
468cbd9d01 iterator: add a size_hint default method
also adds an implementation for the vector iterators
2013-06-22 15:59:59 -04:00
reus
9b2d9a9539 replaced some 'std::' with 'extra::' in comments 2013-06-22 17:49:32 +08:00
James Miller
81cf72c264 Finish up Type refactoring 2013-06-22 12:35:35 +12:00
James Miller
befbd3a680 Add the rest of the atomic operations.
This makes the handling of atomic operations more generic, which
does impose a specific naming convention for the intrinsics, but
that seems ok with me, rather than having an individual case for
each name.

It also adds the intrinsics to the the intrinsics file.
2013-06-22 12:26:33 +12:00
Brian Anderson
95eb01957b std: Make console log off/on controls work with newsched 2013-06-21 16:52:07 -07:00
Brian Anderson
1b7c99655f std::rt: Support os::args 2013-06-21 14:42:15 -07:00
Honza Strnad
f3966e4a08 Added filtered method for Option type 2013-06-21 21:27:58 +02:00
Daniel Micay
06bec77faf replace vec::find with the IteratorUtil method 2013-06-21 03:24:03 -04:00
Daniel Micay
883c966d5c vec: replace position with iter().position_ 2013-06-21 03:23:59 -04:00
Daniel Micay
49c74524e2 vec: rm old_iter implementations, except BaseIter
The removed test for issue #2611 is well covered by the `std::iterator`
module itself.

This adds the `count` method to `IteratorUtil` to replace `EqIter`.
2013-06-21 03:20:22 -04:00
Daniel Micay
cbad1da3db vec: remove eachi
replaced by the `enumerate` method from std::iterator
2013-06-21 03:20:22 -04:00
Daniel Micay
62dc4e0d4c vec: remove each_const
An Iterator implementation can be made for &const [T] if it turns out
to be necessary for some use case.
2013-06-21 03:20:22 -04:00
Brian Anderson
7a9a6e4591 std: Port SharedChan to newsched 2013-06-20 18:26:56 -07:00
Kevin Ballard
b8b2d1e5b4 Make task_rng() return @mut R instead of @@mut R 2013-06-20 15:55:43 -07:00
Brian Anderson
357f087786 Merge remote-tracking branch 'brson/io' into io-upstream
Conflicts:
	src/rt/rust_builtin.cpp
	src/rt/rustrt.def.in
2013-06-20 12:17:00 -07:00
Brian Anderson
4d39253a96 std::rt: Whitespace 2013-06-20 12:16:04 -07:00
bors
f348465283 auto merge of #7128 : yichoi/rust/fix_sometc, r=brson
- Fix stat struct for Android (found by SEGV at run-pass/stat.rs)
- Adjust some test cases to rpass for Android 
- Modify some script to rpass for Android
2013-06-20 11:35:34 -07:00
Brian Anderson
bbf5469b75 Merge remote-tracking branch 'brson/io-wip' into io 2013-06-20 11:26:29 -07:00
Eric Reed
55dda46cf6 Merge remote-tracking branch 'upstream/io' into io 2013-06-20 10:51:04 -07:00
James Miller
0702e53576 libstd: cleanup warnings 2013-06-21 02:43:02 +12:00
James Miller
3bc4d1a120 Remove all #[cfg(stage0)]-protected code
New snapshot means this can all go. Also removes places that have
comments that say they are workarounds for stage0 errors.
2013-06-21 02:43:02 +12:00
James Miller
3acdbfd2c8 ignore inherited environment test under valgrind r=snapshot 2013-06-20 22:43:21 +12:00
Brian Anderson
391bb0b4e7 std: Make newsched failures log correctly 2013-06-19 18:37:50 -07:00
Eric Reed
36c0e04e57 derived instances of Eq and TotalEq for IpAddr rather than implement them manually. 2013-06-19 17:39:02 -07:00
Eric Reed
ac49b74e82 socket based UDP io 2013-06-19 17:23:55 -07:00
Brian Anderson
5086c0850e std::rt: Update GC metadata in init 2013-06-19 16:08:07 -07:00
Eric Reed
083c692565 Changed visibility from being on the impl to being on methods per language syntax change. 2013-06-19 15:39:18 -07:00
toddaaro
753b497b4e Modified a match in resume_task_from_queue that was returning an int that was then matched on to instead use an enum. 2013-06-19 15:23:14 -07:00
Eric Reed
d777ba01cb Wrote the Eq instance of IpAddr in a slightly different way. 2013-06-19 15:20:28 -07:00
Brian Anderson
e1555f9b56 std::rt: Document and cleanup the run function 2013-06-19 01:13:56 -07:00
Brian Anderson
5722c953e5 std::rt: Correct the numbers of default cores 2013-06-19 00:49:05 -07:00
Brian Anderson
915aaa7f67 std::rt: Set the process exit code 2013-06-19 00:39:10 -07:00
Brian Anderson
1120f8c1e5 std::rt: Work around a dynamic borrowck bug 2013-06-18 23:20:53 -07:00
Brian Anderson
7f55fc33f0 std: Work around some failing 'run' tests when valgrinding. #7224
Under valgrind on 64->32 cross compiles the dynamic linker is emitting
some error messages on stderr, which interferes with the tests that
are checking stderr.
2013-06-18 19:52:05 -07:00
Brian Anderson
29ad8e15a2 std::rt: Improve the rtabort! macro 2013-06-18 16:27:48 -07:00
Graydon Hoare
d904c72af8 replace #[inline(always)] with #[inline]. r=burningtree. 2013-06-18 14:48:48 -07:00
Brian Anderson
5b2dc52034 std::rt: Turn on multithreaded scheduling 2013-06-18 00:17:14 -07:00
Brian Anderson
b5fbec9c1e std: Rename abort! to rtabort! to match other macros 2013-06-17 23:24:50 -07:00
Brian Anderson
021e81fbd3 std::rt: move abort function to util module 2013-06-17 23:22:41 -07:00
Brian Anderson
9ef4c413a8 std::rt: Check exchange count on exit 2013-06-17 23:18:20 -07:00
Brian Anderson
3281f5b637 std::rt: Add util mod and num_cpus function 2013-06-17 22:17:51 -07:00
bors
d084d9e7df auto merge of #7197 : rkbodenner/rust/doc-for-lib-move, r=brson
Was updating some code of mine to use the new `std`/`extra` library names, and noticed a place where docs for `std::libc` hadn't been updated. Then I updated some top-level docs for the new libraries' names, too.
2013-06-17 15:54:56 -07:00
bors
4c90b987b5 auto merge of #7131 : Blei/rust/windows-dynamic-lib, r=graydon
The code compiles and runs under windows now, but I couldn't look up any
symbol from the current executable (dlopen(NULL)), and calling looked
up external function handles doesn't seem to work correctly under windows.

This the beginning of a fix for #7095.
2013-06-17 14:58:01 -07:00
Eric Reed
35f3fa6383 Merge remote-tracking branch 'upstream/io' into io
Conflicts:
	src/libstd/rt/uvio.rs
2013-06-17 12:45:40 -07:00
Eric Reed
33ae193a3c Started to implemented UdpStream 2013-06-17 12:35:41 -07:00
Eric Reed
e42f28c05c stated to implement UdpStream 2013-06-17 12:34:58 -07:00
Eric Reed
47443753f1 added Eq and TotalEq instances for IpAddr 2013-06-17 12:33:46 -07:00
Eric Reed
7e022c590f added a function to convert C's ipv4 data structure into the Rust ipv4 data structure. 2013-06-17 12:33:10 -07:00
Eric Reed
b51d1885be Added a RtioUdpStream trait 2013-06-17 12:32:21 -07:00
Eric Reed
9687437d45 added wrappers about uv_ip{4,6}_{port,name} 2013-06-17 12:31:30 -07:00
bors
17eec6289b auto merge of #7199 : Kimundi/rust/master, r=bstrie
- Fixed tests
- Added methods
- Renamed casting methods to be shorter
- Added unsafe versions

Closes #7150
2013-06-17 08:37:18 -07:00
bors
6fbd5383f9 auto merge of #7195 : brson/rust/timertest, r=bstrie 2013-06-17 06:52:14 -07:00
Young-il Choi
b82370cec6 std: fix stat struct of android (SEGV error from run-pass/stat.rs on android) 2013-06-17 18:53:33 +09:00
Marvin Löbel
c9e7bb7d4a Improved std::ascii
- Fixed tests
- Added methods
- Renamed casting methods to be shorter

closes #7150
2013-06-17 10:16:13 +02:00
bors
90b999aea1 auto merge of #7198 : huonw/rust/slice-zeros, r=Aatch 2013-06-17 00:16:03 -07:00
Ralph Bodenner
5acc8e5a51 Reproduce text changes from @brson PR 7176 and fix a typo therein 2013-06-17 00:07:52 -07:00
Huon Wilson
f1d971ae18 std: add Zero impls for &[] and &str. 2013-06-17 17:05:51 +10:00
Ralph Bodenner
819d07af7f Update doc references to new names for std, extra, and std::libc 2013-06-16 23:26:08 -07:00
Brian Anderson
93156ab7e1 std::rt: Reduce the delay on a timer test. Slow 2013-06-16 19:24:51 -07:00
Jens Nockert
bc6848d352 Adds conditional byteswapping intrinsics
These intrinsics are synthesized, so maybe they should be in another
file. But since they are just a single line of code each, based on the
bswap intrinsics and aren't really intended for public consumption (they should be exposed as a
single function / trait) I thought they would fit here.
2013-06-17 02:05:36 +02:00
Brian Anderson
319cf6e465 Merge remote-tracking branch 'brson/io'
Conflicts:
	src/libstd/rt/comm.rs
	src/libstd/rt/mod.rs
	src/libstd/rt/sched.rs
	src/libstd/rt/task.rs
	src/libstd/rt/test.rs
	src/libstd/rt/tube.rs
	src/libstd/rt/uv/uvio.rs
	src/libstd/rt/uvio.rs
	src/libstd/task/spawn.rs
2013-06-16 15:09:25 -07:00
bors
fd8aa9afbd auto merge of #7177 : huonw/rust/unfold-fix, r=thestinger 2013-06-16 10:55:02 -07:00
Niko Matsakis
e7b0b71197 Remove moves from *T and implement in another way 2013-06-16 12:47:36 -04:00
Niko Matsakis
eb48c29681 Add copies to type params with Copy bound 2013-06-16 12:47:36 -04:00
bors
ebca26cd54 auto merge of #7163 : brson/rust/reinterpret-cast, r=thestinger 2013-06-16 06:31:00 -07:00
bors
d1a2360b36 auto merge of #7156 : Dretch/rust/float-hash, r=graydon
It can sometimes be useful to have maps/sets of floating point values.

Doing arithmetic with floats and then using them as keys is, of course, not a good idea.
2013-06-16 03:43:03 -07:00
bors
08c1155a22 auto merge of #7142 : alexcrichton/rust/deriving-zero, r=pcwalton
This allows mass-initialization of large structs without having to specify all the fields.

I'm a bit hesitant, but I wanted to get this out there. I don't really like using the `Zero` trait, because it doesn't really make sense for a type like `HashMap` to use `Zero` as the 'blank allocation' trait. In theory there'd be a new trait, but then that's adding cruft to the language which may not necessarily need to be there.

I do think that this can be useful, but I only implemented `Zero` on the basic types where I thought it made sense, so it may not be all that usable yet. (opinions?)
2013-06-16 01:52:09 -07:00
Huon Wilson
53f6a4e9fb std: fix UnfoldrIterator cross-crate. 2013-06-16 18:13:45 +10:00
bors
d1927d2950 auto merge of #7137 : erickt/rust/from-elem-fixme, r=thestinger
This is to make sure we track optimizing `vec::from_elem`.
2013-06-16 00:58:09 -07:00
bors
f74e1935aa auto merge of #7123 : huonw/rust/more-str, r=thestinger
Moves all the remaining functions that could reasonably be methods to be methods, except for some FFI ones (which I believe @erickt is working on, possibly) and `each_split_within`, since I'm not really sure the details of it (I believe @kimundi wrote the current implementation, so maybe he could convert it to an external iterator method on `StrSlice`, e.g. `word_wrap_iter(&self) -> WordWrapIterator<'self>`, where `WordWrapIterator` impls `Iterator<&'self str>`. It probably won't be too hard, since it's already a state machine.)

This also cleans up the comparison impls for the string types, except I'm not sure how the lang items `eq_str` and `eq_str_uniq` need to be handled, so they (`eq_slice` and `eq`) remain stand-alone functions.
2013-06-16 00:04:13 -07:00
bors
8482d29d9b auto merge of #7149 : thestinger/rust/vec, r=graydon 2013-06-15 23:10:12 -07:00
Brian Anderson
3208fc36bf Merge remote-tracking branch 'brson/io-wip' into io
Conflicts:
	src/libstd/rt/sched.rs
	src/libstd/rt/task.rs
	src/libstd/rt/test.rs
	src/libstd/task/mod.rs
	src/libstd/task/spawn.rs
2013-06-15 19:31:46 -07:00
Huon Wilson
bbcff95ac5 remove unused imports 2013-06-16 12:20:12 +10:00
Daniel Micay
845465ee24 old_iter: rm the min/max free functions 2013-06-15 22:16:22 -04:00
Daniel Micay
52a38b8097 fix test 2013-06-15 22:16:22 -04:00
Daniel Micay
e097d5eaba rm CopyableOrderedIter
replaced with OrdIterator
2013-06-15 22:16:21 -04:00
Daniel Micay
6c547e42c8 rm vec::uniq_len 2013-06-15 22:16:21 -04:00
Brian Anderson
505ef7e710 std::rt: Tasks contain a JoinLatch 2013-06-15 19:00:44 -07:00
Huon Wilson
30973ccb90 std: allow any sort of string to be Added with +. 2013-06-16 10:50:28 +10:00
Huon Wilson
ee25cf8d75 std: test-fixes, remove warnings, syntax highlighting for code examples. 2013-06-16 10:50:28 +10:00
Huon Wilson
4686ed1a1d std: continue improving the comparison trait impls for str.
This moves them all into the traits submodule, and delegates Ord
to the TotalOrd instance. It also deletes the stand-alone lt, gt,
ge and le functions.
2013-06-16 10:50:28 +10:00
Huon Wilson
42974d3bc4 std: simplify the string comparison implementations, using iterators. 2013-06-16 10:50:28 +10:00
Huon Wilson
f1886680e0 std: convert str::to_utf16 to a method. 2013-06-16 10:50:28 +10:00
Huon Wilson
4b18fff2be std: convert str::{map,levdistance,subslice_offset} to methods.
The first two become map_chars and lev_distance. Also, remove a few
allocations in rustdoc.
2013-06-16 10:50:28 +10:00
Brian Anderson
b08c446798 Merge remote-tracking branch 'toddaaro/io' into io 2013-06-15 17:00:36 -07:00
Brian Anderson
0f9c191d8f std: Remove doc references to reinterpret_cast 2013-06-15 15:22:22 -07:00
Daniel Micay
79cd2dbe72 iterator: work around method resolve bug 2013-06-15 18:02:05 -04:00
Daniel Micay
2df66a84cd iterator: add a position adaptor 2013-06-15 17:56:54 -04:00
Daniel Micay
eb5ac84c8e iterator: add a find adaptor 2013-06-15 17:53:12 -04:00
gareth
d22f417c74 Add IterBytes impls for float/f32/f64. This allows creating
HashMaps with floats as keys.
2013-06-15 17:58:38 +01:00
bors
82f2e4dc9f auto merge of #7147 : huonw/rust/vec-connect, r=Aatch
This is caused by StrVector having a generic implementation for &[S]
and so #5898 means that method resolution of ~[~[1]].concat() sees that
both StrVector and VectorVector have methods that (superficially) match.

They are now connect_vec and concat_vec, which means that they can actually be
called.
2013-06-15 06:54:59 -07:00
bors
6df66c194d auto merge of #7109 : bblum/rust/rwlocks, r=brson
r? @brson

links to issues: #7065 the race that's fixed; #7066 the perf improvement I added. There are also some minor cleanup commits here.

To measure the performance improvement from replacing the exclusive with an atomic uint, I edited the ```msgsend-ring-rw-arcs``` bench test to do a ```write_downgrade``` instead of just a ```write```, so that it stressed the code paths that accessed ```read_count```. (At first I was still using ```write``` and saw no performance difference whatsoever, whoooops.)

The bench test measures how long it takes to send 1,000,000 messages by using rwarcs to emulate pipes. I also measured the performance difference imposed by the fix to the ```access_lock``` race (which involves taking an extra semaphore in the ```cond.wait()``` path). The net result is that fixing the race imposes a 4% to 5% slowdown, but doing the atomic uint optimization gives a 6% to 8% speedup.

Note that this speedup will be most visible in read- or downgrade-heavy workloads. If an RWARC's only users are writers, the optimization doesn't matter. All the same, I think this more than justifies the extra complexity I mentioned in #7066.

The raw numbers are:
```
with xadd read count
        before write_cond fix
                4.18 to 4.26 us/message
        with write_cond fix
                4.35 to 4.39 us/message
                
with exclusive read count
        before write_cond fix
                4.41 to 4.47 us/message
        with write_cond fix
                4.65 to 4.76 us/message
```
2013-06-15 04:07:03 -07:00
Philipp Brueschweiler
c7013ba1fc std::dynamic_lib: start fixing windows implementation
The code compiles and runs under windows now, but I couldn't look up any
symbol from the current executable (dlopen(NULL)), and calling looked
up external function handles doesn't seem to work correctly under windows.
2013-06-15 10:10:49 +02:00
bors
7d1065e913 auto merge of #7122 : thestinger/rust/std, r=luqmana 2013-06-14 23:37:08 -07:00
bors
1ba6fa4777 auto merge of #7110 : thestinger/rust/iterator, r=brson 2013-06-14 21:37:27 -07:00
Huon Wilson
18542568a8 std: rename .connect/.concat in VectorVector to avoid conflicting with StrVector.
This is caused by StrVector having a generic implementation for &[S]
and so #5898 means that method resolution of ~[~[1]].concat() sees that
both StrVector and VectorVector have methods that (superficially) match.

They are now connect_vec and concat_vec, which means that they can actually be
called.
2013-06-15 14:15:56 +10:00
Daniel Micay
824a6277af rm CopyableNonstrictIter
copies can just be done explicitly: `xs.transform(|x|x.clone())`
2013-06-14 23:15:42 -04:00
Daniel Micay
d68be89e69 rm MutableIter
replaced with mutable implementations of Iterator
2013-06-14 23:15:42 -04:00
Daniel Micay
8111701604 rm ExtendedMutableIter
replaced with `xs.mut_iter().enumerate()`
2013-06-14 23:15:42 -04:00
Daniel Micay
585f5f7f79 add IteratorUtil to the prelude 2013-06-14 23:15:42 -04:00
bors
104e6120b1 auto merge of #7116 : thestinger/rust/whitespace, r=luqmana 2013-06-14 19:25:05 -07:00
Alex Crichton
893c70d7bc Add Zero impls for lots of common types 2013-06-14 19:12:37 -07:00
Erick Tryzelaar
ac83f4b732 std: add a fixme to note performance issues in vec::from_elem. 2013-06-14 16:58:55 -07:00
toddaaro
d1ec8b5fb8 redesigned the pinning to pin deal with things on dequeue, not on enqueue 2013-06-14 12:17:56 -07:00
Eric Reed
a7f92c92ed Added a UdpWatcher and UdpSendRequest with associated callbacks 2013-06-14 12:04:11 -07:00
Eric Reed
03fe59aefa added bindings to extract udp handle from udp send requests 2013-06-14 11:54:56 -07:00
Erick Tryzelaar
f7e1daa8e3 std: get std::path tests to work again 2013-06-14 07:13:32 -07:00
Brian Anderson
90fbe38f00 std::rt: Tasks must have an unwinder. Simpler 2013-06-13 23:18:49 -07:00
Brian Anderson
fd148cd3e2 std::rt: Change the Task constructors to reflect a tree 2013-06-13 23:18:49 -07:00
Brian Anderson
abc3a8aa1e std::rt: Add JoinLatch
This is supposed to be an efficient way to link the lifetimes
of tasks into a tree. JoinLatches form a tree and when `release`
is called they wait on children then signal the parent.

This structure creates zombie tasks which currently keep the entire
task allocated. Zombie tasks are supposed to be tombstoned but that
code does not work correctly.
2013-06-13 23:18:45 -07:00
Brian Anderson
7755018074 Revert "std: convert {vec,str}::to_owned to methods."
This fixes the strange random crashes in compile-fail tests.

This reverts commit 96cd61ad03.

Conflicts:
	src/librustc/driver/driver.rs
	src/libstd/str.rs
	src/libsyntax/ext/quote.rs
2013-06-13 19:06:47 -07:00
Daniel Micay
2b13606d9f update the libstd docstring for the rename 2013-06-13 21:41:11 -04:00
Daniel Micay
ec27644870 automated whitespace fixes 2013-06-13 18:03:08 -04:00
Eric Reed
5393e43b53 Corrected libuv UDP bindings. 2013-06-13 12:51:32 -07:00
bors
5bff471dde auto merge of #7105 : sstewartgallus/rust/removed_unused_imports, r=sanxiyn
I was able to remove unused imports, and fix the following warnings

src/libstd/hashmap.rs:23:15: 23:23 warning: unused import [-W unused-imports (default)]
src/libstd/task/spawn.rs:95:15: 95:23 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:42:0: 42:9 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:45:0: 45:9 warning: unused import [-W unused-imports (default)]
src/librustc/middle/trans/meth.rs:26:0: 26:26 warning: unused import [-W unused-imports (default)]
src/librustc/back/link.rs:210:20: 210:25 warning: unused import [-W unused-imports (default)]

I was unable to fix the following unused import warnings. The code
here was weird.

src/libextra/std.rc:40:11: 40:14 warning: unused import [-W unused-imports (default)]
src/libextra/std.rc:40:16: 40:24 warning: unused import [-W unused-imports (default)]
2013-06-13 12:08:05 -07:00
Steven Stewart-Gallus
d9d50a5bd4 Remove unused imports
I was able to remove unused imports, and fix the following warnings

src/libstd/hashmap.rs:23:15: 23:23 warning: unused import [-W unused-imports (default)]
src/libstd/task/spawn.rs:95:15: 95:23 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:42:0: 42:9 warning: unused import [-W unused-imports (default)]
src/libstd/rt/uv/mod.rs:45:0: 45:9 warning: unused import [-W unused-imports (default)]
src/librustc/middle/trans/meth.rs:26:0: 26:26 warning: unused import [-W unused-imports (default)]
src/librustc/back/link.rs:210:20: 210:25 warning: unused import [-W unused-imports (default)]

I was unable to fix the following unused import warnings. The code
here was weird.

src/libextra/std.rc:40:11: 40:14 warning: unused import [-W unused-imports (default)]
src/libextra/std.rc:40:16: 40:24 warning: unused import [-W unused-imports (default)]
2013-06-13 10:46:17 -07:00
bors
a198aad8f3 auto merge of #7100 : thestinger/rust/hashmap, r=pnkfelix
Not much point in leaving these around. They just get in the way when you actually want to log something else.
2013-06-13 03:25:11 -07:00
Daniel Micay
ed7892ac00 hashmap: remove leftover debug!() logging 2013-06-13 03:25:28 -04:00
bors
e6503995ab auto merge of #7096 : huonw/rust/invalid-null-str, r=thestinger
A slice of a 'static str is still 'static, but doesn't necessarily
have the null terminator.
2013-06-12 23:10:15 -07:00
Huon Wilson
abadece3ba std: remove the invalid NullTerminatedStr instance for &'static str.
A slice of a 'static str is still 'static, but doesn't necessarily
have the null terminator.
2013-06-13 14:12:08 +10:00
bors
6c45160f19 auto merge of #7027 : sstewartgallus/rust/dynamic_lib, r=graydon
I would appreciate if someone could help out with the Windows code on this pull request. I tried to test it using WINE but I couldn't figure out a way to set that up.
2013-06-12 19:07:30 -07:00
Ben Blum
0ca2056e46 Document unstable::atomics fetch_* return values 2013-06-12 20:53:40 -04:00
Ben Blum
6b22c090a5 make util::NonCopyable a unit struct instead of a struct with a unit 2013-06-12 20:53:40 -04:00
Steven Stewart-Gallus
786ea3ffe6 Prototyped a dynamic library facility interface 2013-06-12 17:32:13 -07:00
Huon Wilson
641910dc13 std: make all strings Equiv-alent to each other, generalise Path.push_many to take any type of string. 2013-06-13 10:19:34 +10:00
Eric Reed
39a575fb43 Added libuv UDP function bindings. 2013-06-12 16:01:50 -07:00
toddaaro
4224fc7aad added functionality to tell schedulers to refuse to run tasks that are not pinned to them 2013-06-12 14:55:32 -07:00
Eric Reed
eb11274919 Removing redundant libuv bindings 2013-06-12 14:15:44 -07:00
bors
78cddc83a4 auto merge of #7073 : influenza/rust/iterator-doc-fixes, r=catamorphism
This commit fixes two typos and an incorrect description.
2013-06-12 12:13:53 -07:00
Brian Anderson
e7213aa21e std::rt: Remove old files 2013-06-12 12:00:46 -07:00
toddaaro
8428081958 A basic implementation of pinning tasks to schedulers. No IO interactions have been planned for, and no forwarding of tasks off special schedulers is supported. 2013-06-12 11:32:22 -07:00
bors
4a52ff0786 auto merge of #7072 : thestinger/rust/ptr, r=catamorphism
I don't think this will even show up in the documentation right now.... but it should still be correct :).
2013-06-11 22:31:39 -07:00
Huon Wilson
9f0c85acc9 std: fix windows 2013-06-12 13:42:41 +10:00
Huon Wilson
13460de61c std: fix method renaming. 2013-06-12 13:09:02 +10:00
Huon Wilson
26d7b460a3 std: generalise .trim_chars to use CharEq. 2013-06-12 12:21:05 +10:00
Huon Wilson
073e82fff2 std: create Str trait for DRY. Use it on StrVector.
The Str trait collects the various strings types and provides a method
for coercing to a slice, so that functions and impls can be written for
generic types containing strings (e.g. &[~str], &[&str], ...) without
having to write one for each string type (assuming that the impl only
needs a slice).
2013-06-12 12:21:04 +10:00
Huon Wilson
3a1e13c7a0 std: convert str::escape_* to methods. 2013-06-12 12:21:04 +10:00
Huon Wilson
9e60e2e297 std: convert str::replace to a method. 2013-06-12 12:21:04 +10:00
Huon Wilson
12750c8893 std: methodise str::capacity 2013-06-12 12:21:04 +10:00
Huon Wilson
3ac00a9489 std: remove substr & str::count_*, methodise char_len, implement slice_chars.
The confusing mixture of byte index and character count meant that every
use of .substr was incorrect; replaced by slice_chars which only uses
character indices. The old behaviour of `.substr(start, n)` can be emulated
via `.slice_from(start).slice_chars(0, n)`.
2013-06-12 12:21:04 +10:00
Huon Wilson
9fff8c6eba std: add a test for HashMap::find_equiv. 2013-06-12 12:21:04 +10:00
Huon Wilson
efc71a8bdb std: unify the str -> [u8] functions as 3 methods: .as_bytes() and .as_bytes_with_null[_consume]().
The first acts on &str and is not nul-terminated, the last two act on strings
that are always null terminated (&'static str, ~str and @str).
2013-06-12 12:21:04 +10:00
Huon Wilson
ba4a4778cc std: convert str::{*shift,pop}* to methods. 2013-06-12 12:21:04 +10:00
Huon Wilson
8786bca7e2 std: convert str::repeat to a method. 2013-06-12 12:21:03 +10:00
Huon Wilson
3c23a0a836 std: replace str::append with a method 2013-06-12 12:21:03 +10:00
Huon Wilson
96cd61ad03 std: convert {vec,str}::to_owned to methods. 2013-06-12 12:21:03 +10:00
bors
e06579bc09 auto merge of #7056 : alexcrichton/rust/issue-4727, r=catamorphism
Closes #4727
2013-06-11 17:22:46 -07:00
Ron Dahlgren
37489a67e5 Iterator documentation fixes
Fixes two typos and one incorrect description.
2013-06-11 16:34:03 -07:00
Daniel Micay
fbae011ad1 fix the docstring for copy_nonoverlapping_memory 2013-06-11 19:06:01 -04:00
Daniel Micay
107e371bf0 fix the ptr::set_memory docstring 2013-06-11 17:48:44 -04:00
Alex Crichton
305f5110a7 Add a finally impl for extern "Rust" fn() 2013-06-11 12:40:40 -07:00
Daniel Micay
bbe3d4a9dc fix windows build 2013-06-11 15:00:58 -04:00
Daniel Micay
004816f4c6 option: remove redundant old_iter impls 2013-06-11 14:06:12 -04:00
Daniel Micay
4f2f545ac2 add Iterator implementations for Option 2013-06-11 14:05:27 -04:00
bors
d1d855993d auto merge of #7047 : bblum/rust/bug_triage, r=graydon
r? anybody
2013-06-11 09:52:40 -07:00
Huon Wilson
7e6a5940cb std: convert pow, hypot, atan2, log to take arguments by reference. 2013-06-11 11:36:03 +10:00
Brian Anderson
84d2695921 std::rt: Work around a dynamic borrowck bug 2013-06-10 17:46:49 -07:00
toddaaro
d64d26cd39 debugged a compiler ICE when merging local::borrow changes into the main io branch and modified the incoming new file lang.rs to be api-compatible 2013-06-10 15:29:02 -07:00
Ben Blum
8081aea3b8 Tag a bunch of destructors that need mutable self with FIXME for #4330. Close #4943. 2013-06-10 18:18:04 -04:00
Ben Blum
967c7d828a Replace str::raw::buf_as_slice with c_str_to_static_slice. Close #3843. 2013-06-10 17:34:28 -04:00
Huon Wilson
e8782eeb63 fix tests, remove some warnings 2013-06-11 02:34:14 +10:00
Huon Wilson
2fa83c0503 std: replace str::is_{alphanumeric,whitespace} with the methods. 2013-06-11 01:07:52 +10:00
Huon Wilson
838191c40b std: replace str::{starts,ends}_with with the method. 2013-06-11 01:03:24 +10:00
Huon Wilson
248b6e38b5 std: replace str::substr with the method. 2013-06-11 00:52:47 +10:00
Huon Wilson
ebefe425b9 std: remove str::to_chars 2013-06-11 00:49:19 +10:00
Huon Wilson
8c59d920a1 std: basic documentation for the new str methods 2013-06-11 00:08:57 +10:00
Huon Wilson
ccd0ac59e9 std: remove str::{connect,concat}*. 2013-06-10 23:57:03 +10:00
Huon Wilson
5a711ea7c3 clean-up unused import warnings 2013-06-10 23:15:01 +10:00
Huon Wilson
ead4468249 std: fix tests 2013-06-10 23:02:55 +10:00
Huon Wilson
ec5a028ada std: convert str::char_at* to methods. 2013-06-10 23:02:55 +10:00
Huon Wilson
f632f46614 std: convert str::trim* to methods. 2013-06-10 23:02:55 +10:00
Huon Wilson
1553874149 std: convert str::reserve* to methods, and methodise str::push_*. 2013-06-10 23:02:55 +10:00
Huon Wilson
a64e886e3c std: remove str::contains in favour of the method 2013-06-10 23:02:55 +10:00
Huon Wilson
017450a611 std: replace str::find_str* with a method 2013-06-10 23:02:54 +10:00
Huon Wilson
7281fb948a std: replace str::{any,all}_between with the iterator equivalent. 2013-06-10 23:02:54 +10:00
Huon Wilson
0cfc08d81e std: convert character-based str::find_* to methods. Add .slice_{to,from} methods. 2013-06-10 23:02:54 +10:00
Huon Wilson
76fc9be5a1 std: convert each_split_str to an iterator 2013-06-10 23:02:54 +10:00
Huon Wilson
ee41ad4168 std: fix compile & test 2013-06-10 23:02:54 +10:00
Huon Wilson
c32fb53cf9 std: remove str::{len, slice, is_empty} in favour of methods. 2013-06-10 23:02:54 +10:00