Commit Graph

1795 Commits

Author SHA1 Message Date
James Miller
df1814ba08 Add some documentation 2013-05-26 12:54:30 +12:00
James Miller
30b471bf23 Add AtomicOption type 2013-05-26 12:39:53 +12:00
James Miller
008e6e5e7e Make AtomicPtr use *mut, instead of ~ 2013-05-26 11:44:31 +12:00
James Miller
523360415c Add basic atomic types 2013-05-25 17:51:26 +12:00
bors
2f69bb9ba9 auto merge of #6712 : thestinger/rust/derive, r=catamorphism 2013-05-24 02:04:47 -07:00
Daniel Micay
0629ef16e8 use deriving for DeepClone 2013-05-24 01:16:15 -04:00
bors
212d6a2f61 auto merge of #6710 : thestinger/rust/swap, r=catamorphism 2013-05-23 22:04:40 -07:00
Daniel Micay
7bff0281c7 optimize util::swap, &mut pointers never alias 2013-05-23 23:00:16 -04:00
Jyun-Yan You
abb2823c35 make arm register definition consistent with rt 2013-05-24 10:42:09 +08:00
Daniel Micay
7d2f836065 add memcpy intrinsic to mirror memmove 2013-05-23 22:29:30 -04:00
Daniel Micay
5ba5865e85 swap_ptr: rm equality check
This isn't needed semantically, and it's the wrong case to optimize for.
2013-05-23 21:57:37 -04:00
Erick Tryzelaar
dc970c13f4 cleanup warnings from libstd 2013-05-23 17:48:16 -07:00
Erick Tryzelaar
1965d72957 core: remove iter_bytes helper functions 2013-05-23 17:48:16 -07:00
Patrick Walton
18df18c817 libstd: Fix merge fallout. 2013-05-22 21:57:11 -07:00
Patrick Walton
c10e0cb9c9 syntax: Change syntax extensions to expand to std::foo instead of core::foo 2013-05-22 21:57:08 -07:00
Patrick Walton
f3723cf7c4 libextra: Rename the actual metadata names of libcore to libstd and libstd to libextra 2013-05-22 21:57:07 -07:00
Patrick Walton
ebfc2b8e56 librustc: Rename core injection to std injection 2013-05-22 21:57:05 -07:00
Patrick Walton
0c820d4123 libstd: Rename libcore to libstd and libstd to libextra; update makefiles.
This only changes the directory names; it does not change the "real"
metadata names.
2013-05-22 21:57:05 -07:00
Jihyun Yu
06685bacf8 add smallintset 2013-05-22 21:01:21 +09:00
bors
5a3e320514 auto merge of #6647 : alexcrichton/rust/unnecessary-alloc, r=graydon
This adds a lint mode for detecting unnecessary allocations on the heap. This isn't super fancy, currently it only has two rules

1. For a function's arguments, if you allocate a `[~|@]str` literal, when the type of the argument is a `&str`, emit a warning.
2. For the same case, emit warnings for boxed vectors when slices are required.

After adding the lint, I rampaged through the libraries and removed all the unnecessary allocations I could find.
2013-05-20 23:55:20 -07:00
bors
6d4845668f auto merge of #6372 : brson/rust/intrinsics, r=catamorphism
...s
2013-05-20 15:49:45 -07:00
bors
54eafc009d auto merge of #6639 : osaut/rust/arc-clean, r=brson
* Add ARC::get method and implements the function from it.
* Add an example showing a simple use of ARC.

Update PR #6622 to avoid git noise.

I will remove the function get later.
2013-05-20 14:46:45 -07:00
Brian Anderson
7bd4217766 Replace all uses of rust-intrinsic ABI with calls to unstable::intrinsics 2013-05-20 14:41:56 -07:00
Alex Crichton
82fa0018c8 Remove all unnecessary allocations (as flagged by lint) 2013-05-20 16:10:40 -05:00
Steve Klabnik
eb3f47a40a Remove two warnings about unneccesary safe blocks.
Since a snapshot was done last night, these are good to go.
2013-05-20 09:17:19 -07:00
Olivier Saut
3f232bc4a0 Add ARC::get method and implements the function from it. Add an example showing a simple use of ARC. 2013-05-20 12:07:14 +02:00
Olivier Saut
a9c7d3f775 Typo corrected and updated copyright years 2013-05-20 12:06:37 +02:00
Brian Anderson
66319b0278 Register snapshots 2013-05-19 23:34:32 -07:00
bors
9f671698e6 auto merge of #6106 : thestinger/rust/iter, r=bstrie
I don't have a strong opinion on the function vs. method, but there's no point in having both. I'd like to make a `repeat` adaptor like Python/Haskell for turning a value into an infinite stream of the value, so this has to at least be renamed.
2013-05-19 08:13:30 -07:00
Corey Richardson
cc57ca012a Use assert_eq! rather than assert! where possible 2013-05-19 08:16:02 -04:00
bors
3ee479f3e9 auto merge of #6577 : brson/rust/io-upstream, r=pcwalton
r?

This is all of my scheduler work on #4419 from the last 3 weeks or so. I've had a few failed pull requests so far but I think the problems are ironed out.

* TCP
* The beginnings of runtime embedding APIs
* Porting various corners of core to be compatible with both schedulers
* libuv timer bindings
* Further refinement of I/O error handling, including a new, incomplete, `read_error` condition
* Incomplete refactoring to make tasks work without coroutines and user-space scheduling
* Implementations of Reader/Writer extension methods
* Implementations of the most important part of core::comm

I'm particularly happy with how easy the [comm types on top of the scheduler](https://github.com/brson/rust/blob/io-upstream/src/libcore/rt/comm.rs). Note that these implementations do not use pipes. If anything here needs careful review though it's this code.

This branch passes 95% of the run-pass tests (with `TESTARGS=--newrt`)

In the next week I'll probably spend some time adding preliminary multithreading and seeing how close we are to removing the old runtime.
2013-05-18 18:37:25 -07:00
Olivier Saut
4b13895c2f Remove trailing whitespaces 2013-05-18 11:53:51 +02:00
Daniel Micay
d953a5ce43 replace old_iter::repeat with the Times trait 2013-05-18 04:57:21 -04:00
Brian Anderson
26becc308e core: Wire up oneshot pipes to newsched 2013-05-17 17:54:27 -07:00
Brian Anderson
03a8e59615 Merge remote-tracking branch 'brson/io' into incoming 2013-05-17 17:53:50 -07:00
Olivier Saut
7dc466f91f Correct the example given for a future, add punctuation where necessary 2013-05-17 23:11:18 +02:00
Huon Wilson
aa179cb0f1 rustc: relax limits on (u)int type limit lint. Fixes #6130. 2013-05-18 01:49:36 +10:00
bors
ce6dc2451f auto merge of #6520 : thestinger/rust/rc, r=pcwalton
This is still enough to prevent cycles (explanation given in the docstring).
2013-05-16 03:25:43 -07:00
Daniel Micay
4702667a62 allow constructing Rc/RcMut from Const types too 2013-05-15 19:18:09 -04:00
Huon Wilson
5dc5efefd4 syntax: deprecate #[auto_{en,de}code] in favour of #[deriving({En,De}codable)].
Replace all instances of #[auto_*code] with the appropriate #[deriving] attribute
and remove the majority of the actual code, leaving stubs to refer the user to
the new syntax.
2013-05-16 08:55:57 +10:00
bors
8a15333c06 auto merge of #6498 : thestinger/rust/deep_clone, r=thestinger
This is mostly for `std::rc` and `std::arc` (but I haven't implemented it for ARC yet).

Implementing it correctly for managed boxes is *very* non-trivial. It would probably require an unholy mix of reflection and TLS.
2013-05-15 12:22:58 -07:00
Brian Anderson
0d1331f4a0 Merge remote-tracking branch 'brson/io' into incoming 2013-05-15 12:09:15 -07:00
Brian Anderson
4724966b06 core::rt: Add uv timer bindings 2013-05-15 12:19:15 -07:00
bors
4e82610099 auto merge of #6487 : recrack/rust/vec_len, r=thestinger
Rename vec::len(var) to var.len()

```
libcore, libfuzzer, librustc, librustdoc, libstd, libsyntax
test/auxiliary
test/bench
test/run-pass
```
2013-05-15 07:38:07 -07:00
Daniel Micay
cda3ac905a rc: fix tests 2013-05-15 04:34:31 -04:00
Daniel Micay
75822f2894 add a DeepClone trait
for deep copies through shared ownership boundaries
2013-05-15 01:36:41 -04:00
Youngmin Yoo
a2a8596c3d Rename vec::len(var) to var.len() 2013-05-15 11:05:28 +09:00
bors
cf0f760560 auto merge of #6333 : bjz/rust/cond-macro, r=thestinger
Addressing issue #6037, this Scheme-style conditional helps to improve code clarity in instances where the `if`, `else if`, and `else` keywords obscure predicates undesirably.

Here is an example:

~~~rust
let clamped =
    if x > mx { mx }
    else if x < mn { mn }
    else { x };
~~~

Using `cond!`, the above could be written as:

~~~rust
let clamped = cond!(
    (x > mx) { mx }
    (x < mn) { mn }
    _        { x  }
);
~~~

The optional default case is denoted by `_`.

I have altered `std::fun_treemap` to demonstrate it in use. I am definitely interested in using it for some of the numeric functions, but I will have to wait for it to reach `stage0` first.
2013-05-14 18:11:00 -07:00
Brendan Zabarauskas
7e4a176dd3 Use parentheses for cond! macro instead of preceding pipes
This is temporary. Once the macro parser has improved or been re-written these can be removed.
2013-05-15 11:02:17 +10:00
bors
c30414f980 auto merge of #6471 : gifnksm/rust/reform-rational, r=brson
`std::ratio` module contains `BigRational` type, but the type is not usable by following reasons.
* `Ratio::new` requires `T: Copy + Num + Ord`, but `BigInt` is not implicitly copyable, because it contains unique vector.
* `BigInt` is not implements `Num`

So, I rewrite `Ratio` as follows.
* `Ratio` requires `T: Clone + Integer + Ord`.
  * `Copy` -> `Clone`: to be able to use `BigRational`
  * `Num` -> `Integer`: It is incorrect that a rational number constructed by two non-integer numbers.
* `BigInt` implements `Num` and `Orderable` which are required by `Integer` bound
2013-05-14 15:28:59 -07:00