Luqman Aden
e2bb32bea1
libstd: Handle IPv4-Mapped/Compatible IPv6 addresses.
2013-07-25 05:57:52 -04:00
Luqman Aden
ac40d5323d
libstd: Fix errors when rtdebug! is not a noop.
2013-07-25 05:57:52 -04:00
Luqman Aden
61e741cf71
libstd: Implement {peer, socket}_name for new rt tcp & udp.
2013-07-25 05:57:52 -04:00
Gábor Horváth
7cc8f4bae0
Added some more atomic operations.
2013-07-25 10:46:31 +02:00
Alex Crichton
7fd23e4fe2
Convert uses of transmute which don't need it
2013-07-24 23:12:28 -07:00
bors
467d381d3a
auto merge of #7931 : blake2-ppc/rust/chain-mut-ref, r=pcwalton
...
First, clean up the uses of "None" and "Some" to always use consistent title case matching the variant names.
Add .chain_mut_ref() which is a missing method. A use case example for this method is extraction of an optional value from an Option\<Container\> value.
2013-07-24 19:25:38 -07:00
Daniel Micay
4517e39125
rm default method lint
...
default methods are enabled by default, so there's not much point in
keeping around a lint to report them as being experimental
2013-07-24 18:44:16 -04:00
bors
330378d1a1
auto merge of #7996 : erickt/rust/cleanup-strs, r=erickt
...
This is a cleanup pull request that does:
* removes `os::as_c_charp`
* moves `str::as_buf` and `str::as_c_str` into `StrSlice`
* converts some functions from `StrSlice::as_buf` to `StrSlice::as_c_str`
* renames `StrSlice::as_buf` to `StrSlice::as_imm_buf` (and adds `StrSlice::as_mut_buf` to match `vec.rs`.
* renames `UniqueStr::as_bytes_with_null_consume` to `UniqueStr::to_bytes`
* and other misc cleanups and minor optimizations
2013-07-24 13:25:36 -07:00
Birunthan Mohanathas
f73bb2bfe6
Implement std::num::Zero for bool
...
Closes #8024 .
2013-07-24 22:54:32 +03:00
Erick Tryzelaar
9a950802ed
std: str.as_bytes_with_null_consume() => str.to_bytes_with_null()
2013-07-24 12:33:49 -07:00
bors
f132401a0b
auto merge of #7982 : thestinger/rust/iterator, r=thestinger
...
f0f4dcc r=huonw
25e9c4c r=graydon
a87c2d1 r=brson
16f369d r=cmr
9f05cc8 r=bstrie
e858055 r=huonw
5d80938 r=thestinger
05d03e7 r=cmr
8f86fa3
r=thestinger
2013-07-24 08:52:36 -07:00
Daniel Micay
4a2d22bdb1
fix compilation on macos/windows
2013-07-24 09:45:21 -04:00
Stepan Koltsov
c50d3e3fca
ToStr for HashMap does not need value to implement Eq or Hash
2013-07-24 09:45:21 -04:00
Brian Anderson
6c88e46d4d
std:rt: args module is not used by win/mac. #7951
2013-07-24 09:45:20 -04:00
Birunthan Mohanathas
d047cf1ec6
Change 'print(fmt!(...))' to printf!/printfln! in src/lib*
2013-07-24 09:45:20 -04:00
Daniel Micay
626bb5a866
add a RandomAccessIterator trait
2013-07-24 09:45:20 -04:00
bors
51028532d7
auto merge of #7993 : Xazax-hun/rust/master, r=bblum
...
Added missing memory orderings for atomic types. https://github.com/mozilla/rust/issues/7422
2013-07-24 06:37:36 -07:00
bors
7f96eb58d2
auto merge of #7980 : graydon/rust/misc-benchmarks, r=catamorphism
...
Some machinery for enabling #[bench] benchmarks in std and some examples showing how to write them.
2013-07-23 22:46:39 -07:00
Michael Sullivan
a0f8540c95
Fix some impls such that all supertraits are actually implemented.
2013-07-23 17:06:32 -07:00
Michael Sullivan
4b9759e20f
Add a to_owned_vec method to IteratorUtil.
2013-07-23 17:06:32 -07:00
Erick Tryzelaar
9c3679a9a2
std: make str::append move self
...
This eliminates a copy and fixes a FIXME.
2013-07-23 16:57:00 -07:00
Erick Tryzelaar
bbedbc0450
std: inline str::with_capacity and vec::with_capacity
2013-07-23 16:57:00 -07:00
Erick Tryzelaar
cced3c9013
std: simplify str::as_imm_buf and vec::as_{imm,mut}_buf
2013-07-23 16:57:00 -07:00
Erick Tryzelaar
037a5b1af4
str: move as_mut_buf into OwnedStr, and make it self
2013-07-23 16:56:58 -07:00
Erick Tryzelaar
2dd3c44a56
std: remove a malloc from os::fill_charp_buf
2013-07-23 16:56:23 -07:00
Erick Tryzelaar
31b77aecfc
std: remove str::to_owned and str::raw::slice_bytes_owned
2013-07-23 16:56:23 -07:00
Erick Tryzelaar
cc9666f68f
std: rename str.as_buf to as_imm_buf, add str.as_mut_buf
2013-07-23 16:56:22 -07:00
Erick Tryzelaar
3b818edeba
std and extra: use as_c_str instead of as_buf in a couple places
...
These uses are assuming the strings are null terminated, so it
should be using `as_c_str` instead of `as_buf`
2013-07-23 16:56:22 -07:00
Erick Tryzelaar
cf75330807
std: add test for str::as_c_str
2013-07-23 16:56:22 -07:00
Erick Tryzelaar
7af56bb921
std: move StrUtil::as_c_str into StrSlice
2013-07-23 16:56:22 -07:00
Erick Tryzelaar
9fdec67a67
std: move str::as_buf into StrSlice
2013-07-23 16:56:22 -07:00
Erick Tryzelaar
cfd89c4075
std: remove os::as_c_charp
2013-07-23 16:56:22 -07:00
Erick Tryzelaar
9ad815e063
std: rename str.as_bytes_with_null_consume to str.to_bytes_with_null
2013-07-23 16:56:17 -07:00
Graydon Hoare
978e5d94bc
std: wrap "long" utf8 lines.
2013-07-23 16:02:14 -07:00
Gábor Horváth
1ce14116cc
Added missing memory orderings for atomic types.
2013-07-23 12:34:40 +02:00
bors
0a5d1a1b81
auto merge of #7875 : sstewartgallus/rust/fubar, r=alexcrichton
2013-07-22 23:13:41 -07:00
bors
ff34064aa3
auto merge of #7916 : olsonjeffery/rust/newrt_timer, r=brson
...
My first bit of newsched IO work. Pretty simple and limited in scope.
the RtioTimer trait only has a `sleep(msecs: u64)` method, for now. Taking requests on what else ought to be here.
oh yeah: this resolves #6435
2013-07-22 17:28:35 -07:00
Graydon Hoare
d9c0634536
std: various additional language benchmarks in util.
2013-07-22 16:56:11 -07:00
Graydon Hoare
ca5ed4cc49
std: add benchmark for allocating-and-dropping a struct with a dtor.
2013-07-22 16:56:11 -07:00
Graydon Hoare
9f7e364d3a
std: add #[bench] benchmarks for num::strconv
2013-07-22 16:56:11 -07:00
Graydon Hoare
d9776236c8
std: add #[bench] benchmarks for rand.
2013-07-22 16:56:10 -07:00
Graydon Hoare
3d5fb470fb
std: add #[bench] benchmarks for global and local heaps.
2013-07-22 16:56:10 -07:00
Graydon Hoare
e5cbede103
std: add preliminary str benchmark.
2013-07-22 16:56:10 -07:00
Graydon Hoare
786318f61b
std: add #[cfg(test)] reference to extra so we can benchmark libstd.
2013-07-22 16:56:10 -07:00
bors
73921f91a3
auto merge of #7883 : brson/rust/rm-std-net, r=graydon
...
This removes all the code from libextra that depends on libuv. After that it removes three runtime features that existed to support the global uv loop: weak tasks, runtime-global variables, and at_exit handlers.
The networking code doesn't have many users besides servo, so shouldn't have much fallout. The timer code though is useful and will probably break out-of-tree code until the new scheduler lands, but I expect that to be soon.
It also incidentally moves `os::change_dir_locked` to `std::unstable`. This is a function used by test cases to avoid cwd races and in my opinion shouldn't be public (#7870 ).
Closes #7251 and #7870
2013-07-22 15:40:36 -07:00
Jeff Olson
3169bb70d8
std: fix for blocked task resume
2013-07-22 15:28:32 -07:00
Brian Anderson
407bffb33e
std: Remove at_exit API. Unused
2013-07-22 14:17:09 -07:00
Brian Anderson
23b7ee2bda
std: Remove unstable::global. Unused
2013-07-22 14:16:52 -07:00
Brian Anderson
6174f9a4d9
std: Move change_dir_locked to unstable. #7870
2013-07-22 14:16:52 -07:00
Brian Anderson
4beda4e582
std::rt: Stop using unstable::global in change_dir_locked
2013-07-22 14:16:52 -07:00
Brian Anderson
f8c4d99df6
std: Remove weak_task API. Unused
2013-07-22 14:16:52 -07:00
bors
9ed82fbb43
auto merge of #7943 : Dretch/rust/vec-slice-from-to, r=huonw
2013-07-22 13:49:34 -07:00
Jeff Olson
73ab6c60f3
std: make check appeasement
2013-07-22 13:19:05 -07:00
Jeff Olson
155470fc9c
std: minor timer cleanup based on feedback
2013-07-22 13:19:04 -07:00
Jeff Olson
5da29e3278
std: add rt::io::Timer
2013-07-22 13:19:04 -07:00
Jeff Olson
921d99108c
std: add RtioTimer and UvTimer impl atop rt::uv
2013-07-22 13:19:04 -07:00
bors
2f7d86f9a8
auto merge of #7942 : Dretch/rust/os-listdir-path-no-squiggle, r=brson
2013-07-22 12:01:41 -07:00
Daniel Micay
ed67cdb73c
new snapshot
2013-07-22 01:09:48 -04:00
Steven Stewart-Gallus
a8870dfbb5
Minor cleanup of hashmap
2013-07-21 20:10:55 -07:00
Daniel Micay
fc05819181
Merge pull request #7936 from thestinger/cleanup
...
rm obsolete no-op lints
2013-07-21 20:04:15 -07:00
bors
fe3f75ff8e
auto merge of #7932 : blake2-ppc/rust/str-clear, r=huonw
...
~str and @str need separate implementations for use in generic
functions, where it will not automatically use the impl on &str.
fixes issue #7900
2013-07-21 15:28:38 -07:00
Gareth Smith
a6263694ff
Remove what appears to be redundant indirection from
...
os::list_dir_path.
2013-07-21 18:33:29 +01:00
Gareth Smith
30f13e661a
Add slice_from and slice_to methods for vec, like the
...
methods of the same names that already exist for strs.
2013-07-21 14:39:01 +01:00
bors
8476419fef
auto merge of #7896 : pcwalton/rust/pub-extern, r=pcwalton
...
r? @nikomatsakis
2013-07-20 18:40:39 -07:00
Patrick Walton
06594ed96b
librustc: Remove pub extern
and priv extern
from the language.
...
Place `pub` or `priv` on individual items instead.
2013-07-20 17:39:38 -07:00
Daniel Micay
13b474dcbb
rm obsolete no-op lints
2013-07-20 20:17:08 -04:00
bors
75b4b1b027
auto merge of #7882 : blake2-ppc/rust/iterator-clone, r=thestinger
...
Implement method .cycle() that repeats an iterator endlessly
Implement Clone for simple iterators (without closures), including VecIterator.
> The theory is simple, the immutable iterators simply hold state
> variables (indicies or pointers) into frozen containers. We can freely
> clone these iterators, just like we can clone borrowed pointers.
2013-07-20 16:58:30 -07:00
bors
bb8ca1f52c
auto merge of #7910 : brson/rust/rm-fixme, r=graydon
2013-07-20 15:16:33 -07:00
bors
c5c0252511
auto merge of #7908 : anasazi/rust/fix_udp_mut, r=brson
2013-07-20 13:31:34 -07:00
blake2-ppc
24b6901b26
std: Implement Clone for VecIterator and iterators using it
...
The theory is simple, the immutable iterators simply hold state
variables (indicies or pointers) into frozen containers. We can freely
clone these iterators, just like we can clone borrowed pointers.
VecIterator needs a manual impl to handle the lifetime struct member.
2013-07-20 20:30:57 +02:00
blake2-ppc
ffe2623e47
iterator: Add test for .cycle()
2013-07-20 20:24:00 +02:00
blake2-ppc
4623e81aa5
iterator: Let closure-less iterators derive Clone
2013-07-20 20:22:48 +02:00
blake2-ppc
435fcda5e9
iterator: Add .cycle() to repeat an iterator
2013-07-20 20:22:48 +02:00
bors
5c999d4eca
auto merge of #7894 : pcwalton/rust/and-pointers-in-at-boxes, r=brson
...
r? @brson
2013-07-20 10:55:34 -07:00
blake2-ppc
3509f9d5ae
str: Implement Container for ~str, @str and Mutable for ~str
...
~str and @str need separate implementations for use in generic
functions, where it will not automatically use the impl on &str.
2013-07-20 19:28:38 +02:00
blake2-ppc
625ca7afe4
option: Add .chain_mut_ref()
...
.chain_mut_ref() is the mutable alternative to .chain_ref().
A use case example for this method is extraction of an optional value
from an Option<Container> value.
2013-07-20 19:19:13 +02:00
blake2-ppc
5991c60750
option: Title-case Some
and None
in docs and fail messages
...
For accuracy, say 'get_ref None' instead of 'get_ref none', and so on.
2013-07-20 19:19:13 +02:00
bors
e3142c5d3e
auto merge of #7858 : bblum/rust/kill, r=brson
...
Some notes about the commits.
Exit code propagation commits:
* ```Reimplement unwrap()``` has the same old code from ```arc::unwrap``` ported to use modern atomic types and finally (it's considerably nicer this way)
* ```Add try_unwrap()``` has some new slightly-tricky (but pretty simple) concurrency primitive code
* ```Add KillHandle``` and ```Add kill::Death``` are the bulk of the logic.
Task killing commits:
* ```Implement KillHandle::kill() and friends```, ```Do a task-killed check```, and ```Add BlockedTask``` implement the killing logic;
* ```Change the HOF context switchers``` turns said logic on
Linked failure commits:
* ```Replace *rust_task ptrs``` adapts the taskgroup code to work for both runtimes
* ```Enable taskgroup code``` does what it says on the tin.
r? @brson
2013-07-20 03:55:39 -07:00
bors
fdbd56ca38
auto merge of #7419 : catamorphism/rust/default-package, r=graydon
...
r? @brson `rustpkg build`, if executed in a package source directory inside
a workspace, will now build that package. By "inside a workspace"
I mean that the parent directory has to be called `src`, and rustpkg
will create a `build` directory in .. if there isn't already one.
Same goes for `rustpkg install` and `rustpkg clean`.
For the time being, `rustpkg build` (etc.) will still error out if
you run it inside a directory whose parent isn't called `src`.
I'm not sure whether or not it's desirable to have it do something
in a non-workspace directory.
2013-07-20 02:16:41 -07:00
blake2-ppc
980646a450
Use Option .take() or .take_unwrap() instead of util::replace where possible
2013-07-20 05:12:05 -04:00
Ben Blum
621bc79d0d
Fix warnings in stdtest and extratest. Maybe somebody will care.
2013-07-20 05:12:05 -04:00
Ben Blum
7ad7911222
Add watched and indestructible spawn modes.
2013-07-20 05:12:04 -04:00
Ben Blum
2183145850
Rename TCB to Taskgroup
2013-07-20 05:12:04 -04:00
Ben Blum
f3c79c4026
Enable taskgroup code for newsched spawns.
2013-07-20 05:12:03 -04:00
Ben Blum
0e1be5ff9e
Fix linked failure tests to block forever instead of looping around yield.
2013-07-20 05:08:58 -04:00
Ben Blum
728edb5af6
(cleanup) impl TaskSet
2013-07-20 05:08:58 -04:00
Ben Blum
6d9184609a
(cleanup) Don't check taskgroup generation monotonicity unless cfg(test).
2013-07-20 05:08:58 -04:00
Ben Blum
87bbcb579a
(cleanup) Modernize taskgroup code for the new borrow-checker.
2013-07-20 05:08:58 -04:00
Ben Blum
9bbec651df
Replace *rust_task ptrs in taskgroup code with TaskHandle, for transitioning to newsched killing.
2013-07-20 05:08:57 -04:00
Ben Blum
e2a42416dd
Add option::take(), the building block of the option::take_* family.
2013-07-20 05:08:57 -04:00
Ben Blum
2a7273c71e
Stash a spare kill flag inside tasks, to save two atomic xadds in the blocking fastpath.
2013-07-20 05:08:57 -04:00
Ben Blum
e283c4ddff
Add tests for task killing and blocking.
2013-07-20 05:08:57 -04:00
Ben Blum
a093b5434a
Add test::with_test_task() convenience function.
2013-07-20 05:08:57 -04:00
Ben Blum
9ad1997549
Change the HOF context switchers to pass a BlockedTask instead of a ~Task.
2013-07-20 05:08:57 -04:00
Ben Blum
0101f35f27
Add BlockedTask (wake, try_block, etc) in kill.rs.
2013-07-20 05:08:57 -04:00
Ben Blum
e80efe3fda
Do a task-killed check at the start of task 'timeslices'.
2013-07-20 05:08:56 -04:00
Ben Blum
629f6e8d68
Implement KillHandle::kill() and friends (unkillable, atomically). Close #6377 .
2013-07-20 05:08:56 -04:00
Ben Blum
2a99320583
Add tests for KillHandle
2013-07-20 05:08:56 -04:00
Ben Blum
afc199bea0
Remove join_latch
2013-07-20 05:08:56 -04:00
Ben Blum
6882508b6f
Add kill::Death for task death services and use it in Task.
2013-07-20 05:08:56 -04:00