Commit Graph

2010 Commits

Author SHA1 Message Date
gareth
04a39359f8 Rename unwrap_input/unwrap_output as suggested by
@brson. Also fix a few documentation bugs.
2013-05-27 13:50:33 +01:00
gareth
49a1ab8745 Make test_change_working_directory change the current
directory to be the parent of the current-current directory,
instead of changing to the tmp directory, which was causing
issues with OS X and its /tmp => /private/tmp symlink.
2013-05-27 13:50:33 +01:00
gareth
76c31217be Refactor core::run in order to address many of the issues
mentioned in #2625.

This change makes the module more oriented around
Process values instead of having to deal with process ids
directly.

Apart from issues mentioned in #2625, other changes include:
- Changing the naming to be more consistent - Process/process
  is now used instead of a mixture of Program/program and
  Process/process.
- More docs/tests.

Some io/scheduler related issues remain (mentioned in #2625).
2013-05-27 13:50:33 +01:00
bors
f5d4ea84f5 auto merge of #6748 : steveklabnik/rust/bool_docs, r=thestinger
There was some before, but now we have a big header, as well as
lots of individual bits of documentation.
2013-05-26 10:32:02 -07:00
Steve Klabnik
9bb8077c18 Add documentation for libstd/bool.rs.
There was some before, but now we have a big header, as well as
lots of individual bits of documentation.
2013-05-26 09:39:55 -05:00
Daniel Micay
14846613bb inline bump_box_refcount 2013-05-26 10:26:04 -04:00
Daniel Micay
b25c520102 make transmute_copy use memcpy, and inline it 2013-05-26 10:26:04 -04:00
Daniel Micay
f6023a01d4 use uninit for cast::transmute_copy 2013-05-26 10:26:03 -04:00
Daniel Micay
d9c0f0f188 add memset32/memset64 2013-05-26 10:26:03 -04:00
Daniel Micay
2eaa5dbb60 C++0x -> C++11 2013-05-26 10:26:03 -04:00
Daniel Micay
cf8e9f9aec make the memcpy/memmove intrinsics higher-level
This allows them to make use of the type's alignment, instead of being
pessimistic and assuming it is only 1.
2013-05-26 10:26:03 -04:00
Tim Chevalier
a243ea39c3 testsuite: Add a test for listing the root directory...
...and don't treat Path("/") like Path("").
2013-05-25 20:47:44 -07:00
Tim Chevalier
196851c4c9 core: Fail with a better error message when list_dir gets an empty path
(Yes, this did happen in real life...)
2013-05-25 20:47:43 -07:00
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
bors
e2f8b51dc5 auto merge of #6722 : alexcrichton/rust/issue-4219-no-merge-hack, r=brson
Changes the int/uint modules to all use macros instead of using the `merge` attribute. It would be nice to have #4375 resolved as well for this, but that can probably come at a later date.

Closes #4219.
2013-05-25 15:13:54 -07:00
James Miller
523360415c Add basic atomic types 2013-05-25 17:51:26 +12:00
Alex Crichton
ec8fb884e9 Remove usage of the #[merge] hack with int modules 2013-05-24 15:31:34 -05: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
Brendan Zabarauskas
b9824e18c2 Add Scheme-style cond! macro to syntax::ext::expand
Addresses issue #6037
2013-05-15 07:02:43 +10:00
Brian Anderson
133aabc5bb Ignore two failing flatpipes tests 2013-05-14 11:35:10 -07:00
Alex Crichton
ccfb3ebf03 rusti: Remove #[allow(vecs_implicitly_copyable)] 2013-05-14 12:25:18 -04:00
Marvin Löbel
04de8f852c Fix cosmetics for fail!() calls 2013-05-14 16:36:24 +02:00
Björn Steinbrink
bdc182cc41 Use static string with fail!() and remove fail!(fmt!())
fail!() used to require owned strings but can handle static strings
now. Also, it can pass its arguments to fmt!() on its own, no need for
the caller to call fmt!() itself.
2013-05-14 16:36:23 +02:00
gifnksm
da9c1fbf27 libstd: Add tests for BigRational 2013-05-14 21:59:13 +09:00
gifnksm
76ecce0e0c libstd: Ratio requires Clone instead of Copy
This allows creating `Ratio<T>` which `T` is non-implicitly copyable types
such as `BigInt`.
2013-05-14 21:59:08 +09:00
gifnksm
41eaa97372 libstd: Rational requires Integer as type bounds instead of Num 2013-05-14 21:55:42 +09:00
gifnksm
e3695468b7 libstd: impl Orderable for BigUint/BigInt 2013-05-14 21:20:27 +09:00
gifnksm
5ce0795de5 libstd: impl Num for BigUint/BigInt 2013-05-14 19:27:20 +09:00
Daniel Micay
e1a1992276 revert PriorityQueue to using init()
uninit() would result in potentially running a destructor on arbitrary
memory if the Ord implementation throws
2013-05-13 19:46:20 -04:00
bors
ad5bfd600d auto merge of #6387 : brson/rust/unstable, r=brson
r? @pcwalton

* Move `SharedMutableState`, `LittleLock`, and `Exclusive` from `core::unstable` to `core::unstable::sync`
* Modernize the `SharedMutableState` interface with methods
* Rename `SharedMutableState` to `UnsafeAtomicRcBox` to match `RcBox`.
2013-05-13 14:49:48 -07:00
Brian Anderson
369231beb4 core: Rename SharedMutableState to UnsafeAtomicRcBox 2013-05-13 12:13:56 -07:00
Brian Anderson
fa1d0477ed core: Move locks, atomic rc to unstable::sync 2013-05-13 12:13:56 -07:00
Patrick Walton
58a37a1f48 libstd: Fix merge fallout. 2013-05-12 17:36:53 -07:00
Patrick Walton
06ef889cdc libsyntax: Remove extern mod foo { ... } from the language. 2013-05-12 16:33:15 -07:00
bors
36771ef609 auto merge of #6429 : gifnksm/rust/bigint-is_even, r=catamorphism
`BigUint::is_even()` didn't return correct value.
2013-05-11 22:40:36 -07:00
Corey Richardson
a279d65102 clean up the last bit of warnings 2013-05-11 20:36:47 -07:00
Tim Chevalier
ed41864464 Warning police 2013-05-11 20:36:44 -07:00
gifnksm
a2b81ccba4 libstd: Fix BigUint::is_even 2013-05-12 10:17:23 +09:00
bors
957251817b auto merge of #6389 : sonwow/rust/issue-3356, r=bstrie
Fix for #3356
2013-05-11 12:55:49 -07:00
bors
9f106a643e auto merge of #6260 : alexcrichton/rust/issue-3466-no-swap, r=pcwalton
There may be a more efficient implementation of `core::util::swap_ptr`. The issue mentioned using `move_val_init`, but I couldn't figure out what that did, so I just used `copy_memory` a few times instead.

I'm not exactly the best at reading LLVM generated by rust, but this does appear to be optimized away just as expected (when possible).
2013-05-10 20:35:00 -07:00
Alex Crichton
998fececd6 Stop using the '<->' operator 2013-05-10 22:51:06 -04:00
bors
c49cf8b330 auto merge of #6205 : brson/rust/flate, r=brson
r? @graydon

I don't think this is necessary in core.
2013-05-10 19:41:00 -07:00
bors
3e0400fb86 auto merge of #6223 : alexcrichton/rust/issue-6183, r=pcwalton
Closes #6183.

The first commit changes the compiler's method of treating a `for` loop, and all the remaining commits are just dealing with the fallout.

The biggest fallout was the `IterBytes` trait, although it's really a whole lot nicer now because all of the `iter_bytes_XX` methods are just and-ed together. Sadly there was a huge amount of stuff that's `cfg(stage0)` gated, but whoever lands the next snapshot is going to have a lot of fun deleting all this code!
2013-05-10 17:56:02 -07:00
Alex Crichton
b05aae2d41 test: Use the new for protocol 2013-05-10 19:20:20 -04:00
Brian Anderson
7652f3ddb8 Move flate from core to std 2013-05-10 16:00:26 -07:00
Youngsoo Son
24ef88cee9 renamed str::from_slice to str::to_owned 2013-05-10 20:08:56 +09:00
bors
fdf601eaf3 auto merge of #6358 : crabtw/rust/mips-segstk, r=brson
I changed ```RED_ZONE_SIZE``` to ```RZ_MAC_32``` because of stack canary failure.
Here is a LLVM patch for MIPS segmented stacks.
http://people.cs.nctu.edu.tw/~jyyou/rust/mips-segstk.patch

Current test results
```
failures:
    rand::tests::test_rng_seeded_custom_seed2
    run::tests::test_forced_destroy_actually_kills
    run::tests::test_unforced_destroy_actually_kills
    time::tests::run_tests
    uv_ll::test::test_uv_ll_struct_size_addrinfo
    uv_ll::test::test_uv_ll_struct_size_uv_timer_t

segfaults:
    rt::io::option::test::test_option_writer_error
    rt::local_services::test::unwind
    rt::sched::test_swap_tasks_then
    stackwalk::test_simple
    stackwalk::test_simple_deep
```
2013-05-10 04:07:50 -07:00
bors
6da2c989ba auto merge of #6329 : sonwow/rust/issue-6306, r=ILyoan
Fix for #6306
2013-05-10 03:04:51 -07:00
Youngsoo Son
b7da975049 renamed vec::from_slice to vec::to_owned 2013-05-10 18:38:54 +09:00
bors
3e106cf2c2 auto merge of #6339 : alexcrichton/rust/unsafe-cvec, r=catamorphism
As noted by @jwise [here](52445129fd (commitcomment-3172192)), it's probably a good idea to keep these unsafe.

The lint check won't warn about these because it ignore `unsafe fn` declarations.
2013-05-09 23:58:53 -07:00
Alex Crichton
a87db3e2cd rustc: Use the new for protocol 2013-05-10 02:46:19 -04:00
Alex Crichton
3ce9dba677 std: Use the new for protocol 2013-05-10 02:46:18 -04:00
Youngsoo Son
c8e93edf55 Move core::task::local_data to core::local_data 2013-05-10 11:42:45 +09:00
bors
7675856253 auto merge of #6354 : Aatch/rust/uninit-intrinsic, r=graydon
Adds an `uninit` intrinsic.

It's just an empty function, so llvm optimizes it down to nothing.

I changed all of the `init` intrinsic usages to `uninit` where it seemed appropriate to.
2013-05-09 12:37:00 -07:00
bors
ce9c0225c4 auto merge of #6349 : thestinger/rust/explicit_copy, r=thestinger
I removed some of the copies, but most are just made explicit. The usage in `libcore` was already fixed, but the attribute was only set to warn (not removed).
2013-05-09 11:18:43 -07:00
Daniel Micay
2bc12635a2 remove vecs_implicitly_copyable from libstd/libcore 2013-05-09 14:00:53 -04:00
Alex Crichton
d6efbad33f Mark c_vec functions as unsafe again 2013-05-09 07:40:19 -04:00
James Miller
414970c46f Add intrinsic declaration where I missed them 2013-05-09 23:16:07 +12:00
James Miller
57509709b4 Make staged versions of the functions that use uninit 2013-05-09 23:05:17 +12:00
bors
ca95e7f94e auto merge of #6345 : seanmoon/rust/fix-typos, r=sanxiyn
Hi there,

Really enjoying Rust. Noticed a few typos so I searched around for a few more--here's some fixes.

Ran `make check` and got `summary of 24 test runs: 4868 passed; 0 failed; 330 ignored`.

Thanks!

Sean
2013-05-09 03:51:32 -07:00
James Miller
f5ab112e6b Replace init() with uninit() where appropriate 2013-05-09 22:41:54 +12:00
Jyun-Yan You
c2bf9bf9fe improve MIPS backend and implement segmented stacks 2013-05-09 16:51:42 +08:00
bors
fda176b070 auto merge of #6337 : thestinger/rust/fix_region, r=thestinger
also removes unnecessary casts from the RcMut implementation
2013-05-09 00:15:33 -07:00
bors
936c07dcf0 auto merge of #6328 : recrack/rust/rename_cleanup, r=sanxiyn
rename vec::each(var) to var.each

> librustc, libsyntax, libstd, librustdoc, libcore
2013-05-08 22:54:37 -07:00
Youngmin Yoo
d4fa0f1485 libstd: rename vec::each(var) to var.each 2013-05-09 14:20:04 +09:00
bors
101d4bf8b2 auto merge of #6332 : huonw/rust/std-base64-match, r=nikomatsakis 2013-05-08 21:45:37 -07:00
Patrick Walton
16a0125e41 libcore: Fix tests. 2013-05-08 17:04:01 -07:00
Patrick Walton
49a66a5c5a librustc: Stop parsing modes and remove them entirely from the language 2013-05-08 17:04:01 -07:00
Patrick Walton
99daec602f librustc: Fix merge fallout. 2013-05-08 17:04:00 -07:00
Patrick Walton
c7522417d4 libstd: Remove some residual mutable fields 2013-05-08 17:04:00 -07:00
Patrick Walton
d12d25534b libcore: Remove more mutable fields from comm 2013-05-08 17:03:59 -07:00
Patrick Walton
6a44482b17 libcore: Remove mutable fields from pipes 2013-05-08 17:03:59 -07:00
Patrick Walton
803a4f45fa libcore: Remove mutable fields from the task builder API 2013-05-08 17:03:59 -07:00
Patrick Walton
b2d1ac100f libcore: Remove mutable fields from rand. 2013-05-08 17:03:58 -07:00
Patrick Walton
ee78d811e4 libstd: Start warning about mutable fields, now that they only exist in stage0 2013-05-08 17:03:58 -07:00
Patrick Walton
bba0680cb0 libstd: Remove mutable fields from future and par 2013-05-08 17:03:58 -07:00
Patrick Walton
92d2ec4d32 libstd: Remove mutable fields from flatpipes and io_util 2013-05-08 17:03:58 -07:00
Patrick Walton
da2ac90812 libstd: Remove mutable fields from fileinput and net_tcp 2013-05-08 17:03:57 -07:00
Daniel Micay
044abef0e5 fix incorrect region code based on the old 'self
also removes unnecessary casts from the RcMut implementation
2013-05-08 16:00:49 -04:00
Sean Moon
bd4ee7c7d2 Fix typos 2013-05-09 02:34:47 +09:00
Huon Wilson
ad5ee00c93 libstd: convert chained ifs to a match in base64. 2013-05-08 23:50:15 +10:00
bors
b6f9295654 auto merge of #6317 : brson/rust/durable, r=z0w0
#6312
2013-05-08 05:03:38 -07:00
bors
625e518ffe auto merge of #6305 : thestinger/rust/rc, r=nikomatsakis 2013-05-08 00:21:38 -07:00
bors
847552f48b auto merge of #6301 : bjz/rust/numeric-traits, r=pcwalton
This is part of the redesign of the numeric traits tracked in issue #4819.

Renamed:

- `Exponential::expm1` -> `Float::exp_m1` - for consistency with underscore usage elsewhere
- `Exponential::log` -> `Exponential::ln` - a less ambiguous name for the natural logarithm
- `{float, f64, f32}::logarithm` -> `Exponential::log` - for arbitrary base logarithms
- `Real::log_2` -> `Real::ln_2`  - for consistency with `ln`
- `Real::log_10` -> `Real::ln_10` - for consistency with `ln`

Added:

- `Signed::abs_sub` - wraps libm's `fdim` function
- `Float::is_normal` - returns `true` if the number is neither zero, infinite, subnormal or NaN
- `Float::classify` - returns the floating point category of the number
- `Float::ln_1p` - returns the natural logarithm of the number plus one
2013-05-07 16:18:37 -07:00
Brian Anderson
ccc4c1a5e0 std: Replace Durable with 'static 2013-05-07 15:30:40 -07:00
Daniel Micay
96eb1e50a4 arc: mark RWARC as non-Const 2013-05-07 13:03:40 -04:00
Daniel Micay
43165b54e0 rc: remove the managed pointer workaround 2013-05-07 13:02:56 -04:00
bors
38a6a7a394 auto merge of #6276 : brson/rust/issue-6122, r=graydon 2013-05-07 06:06:42 -07:00
Brendan Zabarauskas
a9ac2b95f4 Add abs_sub method to Signed trait 2013-05-07 19:16:03 +10:00
bors
3225870191 auto merge of #6236 : alexcrichton/rust/more-map-methods, r=thestinger
Closes #5392 and #5393

I implemented the pop/swap methods for TrieMap/TreeMap/SmallIntMap, and I also updated all of them such that pop isn't just a remove/insert, but rather it's all done in one operation.

One thing I did notice is that with default methods it'd be really nice to define `insert` and `remove` in terms of `pop` and `swap` (or vice versa, just to have them available).
2013-05-06 23:06:36 -07:00
Alex Crichton
393a409b5d Add pop() and swap() to the Map trait 2013-05-07 01:16:04 -04:00
bors
bf748e5001 auto merge of #6241 : thestinger/rust/rc, r=pcwalton
To provide a reference counted pointer type with deterministic
destruction once managed boxes are switched over to a garbage
collector. Unlike managed boxes, these can be moved instead of just
copied/cloned which is helpful for avoiding reference counts.

Needs #5601 to be fixed in order for safety to be provided without the current ugly workaround of making the pointers contain `Option<@()>` and `Option<@mut ()>` (which are just set to `None`).

@brson: r?
2013-05-06 22:00:37 -07:00
Daniel Micay
3d526d1af3 add task-local reference counted smart pointers
To provide a reference counted pointer type with deterministic
destruction once managed boxes are switched over to a garbage
collector. Unlike managed boxes, these can be moved instead of just
copied/cloned which is helpful for avoiding reference counts.
2013-05-06 17:03:20 -04:00
Niko Matsakis
2e4790ca06 Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze 2013-05-06 16:10:31 -04:00
Brian Anderson
3cafe905a4 std: Workaround bustage on incoming. #6122 2013-05-06 12:28:51 -07:00
Niko Matsakis
84f7ecce5c Adust arena test: can no longer allocate recursively 2013-05-06 09:56:17 -04:00
Brendan Zabarauskas
0211833008 Move FuzzyEq trait into core::cmp and rename it to 'ApproxEq' 2013-05-06 21:51:07 +10:00
Niko Matsakis
4300d4d2fa Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-freeze
Conflicts:
	src/libcore/core.rc
	src/libcore/hashmap.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/num/float.rs
	src/libcore/num/int-template.rs
	src/libcore/num/num.rs
	src/libcore/num/strconv.rs
	src/libcore/num/uint-template.rs
	src/libcore/ops.rs
	src/libcore/os.rs
	src/libcore/prelude.rs
	src/libcore/rt/mod.rs
	src/libcore/unstable/lang.rs
	src/librustc/driver/session.rs
	src/librustc/middle/astencode.rs
	src/librustc/middle/borrowck/check_loans.rs
	src/librustc/middle/borrowck/gather_loans.rs
	src/librustc/middle/borrowck/loan.rs
	src/librustc/middle/borrowck/preserve.rs
	src/librustc/middle/liveness.rs
	src/librustc/middle/mem_categorization.rs
	src/librustc/middle/region.rs
	src/librustc/middle/trans/base.rs
	src/librustc/middle/trans/inline.rs
	src/librustc/middle/trans/reachable.rs
	src/librustc/middle/typeck/check/_match.rs
	src/librustc/middle/typeck/check/regionck.rs
	src/librustc/util/ppaux.rs
	src/libstd/arena.rs
	src/libstd/ebml.rs
	src/libstd/json.rs
	src/libstd/serialize.rs
	src/libstd/std.rc
	src/libsyntax/ast_map.rs
	src/libsyntax/parse/parser.rs
	src/test/compile-fail/borrowck-uniq-via-box.rs
	src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
	src/test/run-pass/borrowck-nested-calls.rs
2013-05-05 15:11:04 -04:00
Brian Anderson
8081e8debf Register snapshots 2013-05-04 15:43:51 -07:00
bors
1f65e4a1d5 auto merge of #6230 : thestinger/rust/whitespace, r=catamorphism
I just had `git apply` fix most of them and then did a quick skim over the diff to fix a few cases where it did the wrong thing (mostly replacing tabs with 4 spaces, when someone's editor had them at 8 spaces).
2013-05-04 00:48:37 -07:00
bors
a47e4cb22f auto merge of #6229 : catamorphism/rust/warning-police, r=catamorphism 2013-05-03 23:48:36 -07:00
Daniel Micay
86efd97a10 add gitattributes and fix whitespace issues 2013-05-03 20:01:42 -04:00
Tim Chevalier
18bf9bd55a std: Warning police 2013-05-03 16:56:33 -07:00
Tim Chevalier
376a5526a7 tidy 2013-05-03 16:06:07 -07:00
Tim Chevalier
4d4cabff9e rustpkg: Implement install command
The install command should work now, though it only installs
    in-place (anything else has to wait until I implement RUST_PATH).

Also including:
    core: Add remove_directory_recursive, change copy_file

    Make copy_file preserve permissions, and add a remove_directory_recursive
    function.
2013-05-03 16:06:07 -07:00
bors
d9c7d0bc93 auto merge of #6185 : gifnksm/rust/prelude-from_str, r=graydon
`core::prelude`  re-exports `core::to_str::ToStr`, but doesn't re-export `core::from_str::FromStr`.
That is inconsistent.
2013-05-03 08:15:38 -07:00
gifnksm
e34a7ecbab Remove extra #[cfg(stage0)] 2013-05-03 15:57:05 +09:00
Brian Anderson
76f7207af2 std: xfail test_serializing_pipes 2013-05-02 22:18:16 -07:00
Patrick Walton
dc5df61bc1 librustc: Update the serializer to work properly with INHTWAMA, removing mutable fields in the process 2013-05-02 17:00:51 -07:00
Patrick Walton
6f2e429041 libstd: De-mut arena 2013-05-02 16:00:10 -07:00
gifnksm
cff6aba76e libcore: Export core::from_str::FromStr from core::prelude 2013-05-02 20:42:54 +09:00
Felix S. Klock II
a636f5160a More cases of [cfg(test)] instead of [test]. 2013-05-02 08:55:08 +02:00
Felix S. Klock II
880e300ed7 mod items need to be marked with cfg(test) not test. 2013-05-02 08:55:08 +02:00
Brendan Zabarauskas
e596128bd8 Remove 'Local Variable' comments 2013-05-02 13:22:04 +10:00
gifnksm
046a285a4b libstd: impl Clone for BigUint/BigInt and replace copy with .clone() 2013-05-02 07:17:29 +09:00
Niko Matsakis
d96c65afc8 keep old sort for stage0 2013-05-01 08:50:04 -04:00
Niko Matsakis
5ab33a2975 correct incorrect handling of overloaded operators, exposing various other bits of rot 2013-05-01 08:49:48 -04:00
bors
f67239fac3 auto merge of #6147 : bjz/rust/numeric-traits, r=brson
After much discussion on IRC and #4819, we have decided to revert to the old naming of the `/` operator. This does not change its behavior. In making this change, we also have had to rename some of the methods in the `Integer` trait. Here is a list of the methods that have changed:

- `Quot::quot` -> `Div::div`
- `Rem::rem` - stays the same
- `Integer::quot_rem` -> `Integer::div_rem`
- `Integer::div` -> `Integer::div_floor`
- `Integer::modulo` -> `Integer::mod_floor`
- `Integer::div_mod` -> `Integer::div_mod_floor`
2013-05-01 01:51:35 -07:00
Brendan Zabarauskas
ee26c7c433 Revert rename of Div to Quot 2013-05-01 15:40:05 +10:00
Tim Chevalier
782e06e0e3 core/std: Fix race condition in os::mkdir_recursive tests
Added a change_dir_locked function to os, and use it in the
mkdir_recursive tests so that the tests don't clobber each other's
directory changes.
2013-04-30 17:58:24 -07:00
Niko Matsakis
418f991118 allover: numerous unused muts etc 2013-04-30 14:10:21 -04:00
Niko Matsakis
a896440ca1 new borrow checker (mass squash) 2013-04-30 06:59:32 -04:00
Niko Matsakis
b5a7e8b353 desnapshot 2013-04-30 06:46:02 -04:00
Niko Matsakis
202b8dcdc4 adapt to snapshot 2013-04-30 06:43:02 -04:00
bors
84e22f2b8e auto merge of #6108 : gifnksm/rust/bigint-shift-bug, r=brson
`std::bigint` contains the following code.
```rust
borrow = *elem << (uint::bits - n_bits);
```
The code above contains a bug that the value of the right operand of the shift operator exceeds the size of the left operand,
because sizeof(*elem) == 32, and 0 <= n_bits < 32 in 64bit architecture.

If `--opt-level` option is not given to rustc, the code above runs as if the right operand is `(uint::bits - n_bits) % 32`,
but if --opt-level is given, `borrow` is always zero.

I wonder why this bug is not catched in the libstd's testsuite (I try the `rustc --test --opt-level=2 bigint.rs` before fixing the bug,
but the unittest passes normally.)

This pull request also removes the implicit vector copies in `bigint.rs`.
2013-04-29 22:30:36 -07:00
bors
48f50ac800 auto merge of #6107 : catamorphism/rust/mkdir_recursive, r=brson
r? @brson This hopefully addresses your concerns about the termination condition, and adds more tests. With a bonus documentation commit.
2013-04-29 20:48:37 -07:00
Patrick Walton
78f33437b6 libstd: Fix merge fallout. 2013-04-29 14:30:57 -07:00
Patrick Walton
a9da34bf6e librustc: Fix merge fallout. 2013-04-29 14:30:57 -07:00
Patrick Walton
39693e7b61 test: Fix more tests. 2013-04-29 14:30:57 -07:00
Patrick Walton
37abf4bad0 librustc: Forbid type implementations on typedefs. 2013-04-29 14:30:57 -07:00
Patrick Walton
876483dcf4 test: Fix tests. 2013-04-29 14:30:56 -07:00
Patrick Walton
b0522a497c librustc: Remove ptr::addr_of. 2013-04-29 14:30:53 -07:00
bors
dbcc3fe63a auto merge of #6110 : bjz/rust/numeric-traits, r=pcwalton
As discussed on issue #4819, I have created four new traits: `Algebraic`, `Trigonometric`, `Exponential` and `Hyperbolic`, and moved the appropriate methods into them from `Real`.

~~~rust
pub trait Algebraic {
    fn pow(&self, n: Self) -> Self;
    fn sqrt(&self) -> Self;
    fn rsqrt(&self) -> Self;
    fn cbrt(&self) -> Self;
    fn hypot(&self, other: Self) -> Self;
}

pub trait Trigonometric {
    fn sin(&self) -> Self;
    fn cos(&self) -> Self;
    fn tan(&self) -> Self;
    fn asin(&self) -> Self;
    fn acos(&self) -> Self;
    fn atan(&self) -> Self;
    fn atan2(&self, other: Self) -> Self;
}

pub trait Exponential {
    fn exp(&self) -> Self;
    fn exp2(&self) -> Self;
    fn expm1(&self) -> Self;
    fn log(&self) -> Self;
    fn log2(&self) -> Self;
    fn log10(&self) -> Self;
}

pub trait Hyperbolic: Exponential {
    fn sinh(&self) -> Self;
    fn cosh(&self) -> Self;
    fn tanh(&self) -> Self;
}
~~~

There was some discussion over whether we should shorten the names, for example `Trig` and `Exp`. No abbreviations have been agreed on yet, but this could be considered in the future.

Additionally, `Integer::divisible_by` has been renamed to `Integer::is_multiple_of`.
2013-04-29 13:39:37 -07:00
Brendan Zabarauskas
20ad931bf3 Rename 'divisible_by' method to 'is_multiple_of', add tests for 'is_odd' and 'is_even' 2013-04-29 16:03:48 +10:00
Brendan Zabarauskas
8f63f9789b Implement Fractional for Ratio 2013-04-29 16:00:27 +10:00
gifnksm
ffa31d235b libstd: modify wrong shift width.
borrow = *elem << (uint::bits - n_bits);

The code above contains a bug that the value of the right operand of the shift operator exceeds the size of the left operand,
because sizeof(*elem) == 32, and 0 <= n_bits < 32 in 64bit architecture.

If `--opt-level` option is not given to rustc, the code above runs as if the right operand is `(uint::bits - n_bits) % 32`,
but if --opt-level is given, `borrow` is always zero.

I wonder why this bug is not catched in the libstd's testsuite (I try the `rustc --test --opt-level=2 bigint.rs` before fixing the bug,
but the unittest passes normally.)
2013-04-29 13:49:27 +09:00
gifnksm
e4ca2da420 libstd: remove implicit copying of BigInt/BigUint 2013-04-29 13:49:27 +09:00
Tim Chevalier
d045ce7b87 core: Use a better termination condition in os::mkdir_recursive
Instead of checking whether the parent is "." or "/", check the
number of components.

Also, more tests.
2013-04-28 21:25:35 -07:00
Daniel Micay
46f91a0fa9 make way for a new iter module 2013-04-28 22:31:39 -04:00
bors
1f9823375b auto merge of #6092 : gifnksm/rust/impl-integer-bigint, r=graydon
This is a follow-up commit for #6041 (and depending on #6048).
Also adding `#[inline(always)]` for almost every methods in `std::bigint`.
2013-04-28 12:51:35 -07:00
gifnksm
92f0dc6b4b libstd: inlining almost every methods in bigint module. 2013-04-28 10:59:58 +09:00
gifnksm
01b3490a55 libstd: impl Integer for BigUint/BigInt.
Also remove abs() method from the non-trait impl for BigInt/BigUint.
That method is provided in the Signed trait.
2013-04-28 10:59:58 +09:00
Daniel Micay
f792baba42 only use #[no_core] in libcore 2013-04-27 21:34:24 -04:00
bors
aa38867e4e auto merge of #6071 : bjz/rust/numeric-traits, r=graydon
As part of the numeric trait reform (see issue #4819), I have added the following traits to `core::num` and implemented them for Rust's primitive numeric types:

~~~rust
pub trait Bitwise: Not<Self>
                 + BitAnd<Self,Self>
                 + BitOr<Self,Self>
                 + BitXor<Self,Self>
                 + Shl<Self,Self>
                 + Shr<Self,Self> {}

pub trait BitCount {
    fn population_count(&self) -> Self;
    fn leading_zeros(&self) -> Self;
    fn trailing_zeros(&self) -> Self;
}

pub trait Bounded {
    fn min_value() -> Self;
    fn max_value() -> Self;
}

pub trait Primitive: Num
                   + NumCast
                   + Bounded
                   + Neg<Self>
                   + Add<Self,Self>
                   + Sub<Self,Self>
                   + Mul<Self,Self>
                   + Quot<Self,Self>
                   + Rem<Self,Self> {
    fn bits() -> uint;
    fn bytes() -> uint;
}

pub trait Int: Integer
             + Primitive
             + Bitwise
             + BitCount {}

pub trait Float: Real
               + Signed
               + Primitive {
    fn NaN() -> Self;
    fn infinity() -> Self;
    fn neg_infinity() -> Self;
    fn neg_zero() -> Self;

    fn is_NaN(&self) -> bool;
    fn is_infinite(&self) -> bool;
    fn is_finite(&self) -> bool;

    fn mantissa_digits() -> uint;
    fn digits() -> uint;
    fn epsilon() -> Self;
    fn min_exp() -> int;
    fn max_exp() -> int;
    fn min_10_exp() -> int;
    fn max_10_exp() -> int;

    fn mul_add(&self, a: Self, b: Self) -> Self;
    fn next_after(&self, other: Self) -> Self;
}
~~~
Note: I'm not sure my implementation for `BitCount::trailing_zeros` and `BitCount::leading_zeros` is correct for uints. I also need some assistance creating appropriate unit tests for them.

More work needs to be done in implementing specialized primitive floating-point and integer methods, but I'm beginning to reach the limits of my knowledge. Please leave your suggestions/critiques/ideas on #4819 if you have them – I'd very much appreciate hearing them.

I have also added an `Orderable` trait:

~~~rust
pub trait Orderable: Ord {
    fn min(&self, other: &Self) -> Self;
    fn max(&self, other: &Self) -> Self;
    fn clamp(&self, mn: &Self, mx: &Self) -> Self;
}
~~~

This is a temporary trait until we have default methods. We don't want to encumber all implementors of Ord by requiring them to implement these functions, but at the same time we want to be able to take advantage of the speed of the specific numeric functions (like the `fmin` and `fmax` intrinsics).
2013-04-27 13:09:35 -07:00
bors
47dbcdc455 auto merge of #6064 : thestinger/rust/char, r=catamorphism 2013-04-27 09:27:36 -07:00
Brendan Zabarauskas
ad0b337036 Add is_zero method to Zero 2013-04-26 05:55:26 +10:00
Daniel Micay
6d589f88f7 implement Ord, TotalEq and TotalOrd for char
Closes #6063
2013-04-25 15:43:16 -04:00
Brendan Zabarauskas
225ac21615 Update impl of Round for Ratio 2013-04-25 11:53:51 +10:00
Brendan Zabarauskas
d4868ee740 Use #[cfg(not(stage0))] to exclude items from stage0
As requested on the mailing list: https://mail.mozilla.org/pipermail/rust-dev/2013-April/003713.html
2013-04-25 08:20:00 +10:00
Brendan Zabarauskas
593bdd9be3 Fix incorrect replacement of modulo with rem 2013-04-25 08:19:59 +10:00
Marvin Löbel
3759b5711d Fixed typo... And a billion other things. 2013-04-24 22:28:02 +02:00
Marvin Löbel
dd74807957 Removed ascii functions from other modules
Replaced str::to_lowercase and str::to_uppercase
2013-04-24 22:26:09 +02:00
bors
e26f992d5e auto merge of #6036 : huonw/rust/core-less-at, r=nikomatsakis
From a cursory `git grep` this removes the last part of `core` that requires on `@` (other than `io` and the task local data section).

It renames `RandRes` to ~~StdRng~~ `IsaacRng` and `XorShiftState` to `XorShiftRng` as well as moving their constructors to static methods. To go with this, it adds `rng()` which is designed to be used when the programmer just wants a random number generator, without caring about which exact algorithm is being used.

It also removes all the `gen_int`, `gen_uint`, `gen_char` (etc) methods on `RngUtil` (by moving the defintions to the actual `Rand` instances). The replacement is using `RngUtil::gen`, either type-inferred or with an annotation (`rng.gen::<uint>()`).

I tried to have the `Rng` and `RngUtil` traits exported by `core::prelude` (since `core::rand` (except for `random()`) is useless without them), but this caused [an explosion of (seemingly unrelated) `error: unresolved import`'s](https://gist.github.com/5451839).
2013-04-24 06:48:50 -07:00
Huon Wilson
4a24f10ac6 libcore: unify gen_<type> methods on rand::RngUtil into the generic gen.
This moves all the basic random value generation into the Rand instances for
each type and then removes the `gen_int`, `gen_char` (etc) methods on RngUtil,
leaving only the generic `gen` and the more specialised methods.

Also, removes some imports that are redundant due to a `use core::prelude::*`
statement.
2013-04-24 22:34:19 +10:00
Huon Wilson
6c0a7c7b7d libcore: remove @Rng from rand, and use traits instead.
Also, rename RandRes -> IsaacRng, and make the constructors static
methods.
2013-04-24 22:34:10 +10:00
Brendan Zabarauskas
aef249056e Implement Signed and Unsigned traits and remove related predicate functions 2013-04-24 12:46:26 +10:00
Alex Crichton
4c08a8d6c3 Removing more unnecessary unsafe blocks throughout 2013-04-23 19:59:13 -04:00
bors
3867470feb auto merge of #6013 : gifnksm/rust/bigint-quot-rem, r=graydon
BigInt had been supported quot/rem and div/mod correctly, but after merging #5990 they have been broken.
This commit fixes it.
2013-04-22 21:09:49 -07:00
bors
aba93c6b60 auto merge of #5966 : alexcrichton/rust/issue-3083, r=graydon
Closes #3083.

This takes a similar approach to #5797 where a set is present on the `tcx` of used mutable definitions. Everything is by default warned about, and analyses must explicitly add mutable definitions to this set so they're not warned about.

Most of this was pretty straightforward, although there was one caveat that I ran into when implementing it. Apparently when the old modes are used (or maybe `legacy_modes`, I'm not sure) some different code paths are taken to cause spurious warnings to be issued which shouldn't be issued. I'm not really sure how modes even worked, so I was having a lot of trouble tracking this down. I figured that because they're a legacy thing that I'd just de-mode the compiler so that the warnings wouldn't be a problem anymore (or at least for the compiler).

Other than that, the entire compiler compiles without warnings of unused mutable variables. To prevent bad warnings, #5965 should be landed (which in turn is waiting on #5963) before landing this. I figured I'd stick it out for review anyway though.
2013-04-22 15:36:51 -07:00
gifnksm
a117cf03bc libstd: correct bigint's quot/rem, div/modulo 2013-04-23 07:04:05 +09:00
Huon Wilson
e6c4471ed8 libstd: denominator isn't quotient 2013-04-22 16:02:24 +10:00
Brendan Zabarauskas
01eb5e8ad3 Rename Div operator trait to Quot and Modulo operator trait to Rem 2013-04-22 01:58:53 +10:00
Alex Crichton
7d317fe7e5 std: remove unused 'mut' variables 2013-04-20 21:03:24 -04:00
Matthijs Hofstra
51a68eb9b1 Replaced many instances of reinterpret_cast with transmute 2013-04-20 22:05:50 +02:00
Alex Crichton
cd982ad3f7 std: clean up tests (mostly unused unsafe blocks) 2013-04-19 23:23:23 -04:00
Patrick Walton
c995a62d44 librustc: WIP patch for using the return value. 2013-04-19 12:00:08 -07:00
Patrick Walton
2dbe20a561 libstd: Micro-optimize vuint_at 2013-04-19 11:53:34 -07:00
Brian Anderson
decd3901d5 core::comm: Modernize constructors to use new 2013-04-18 14:07:35 -07:00
Olivier Saut
a35376e24e Small typos, year date and URL of the fbuild system for reference. 2013-04-18 11:51:12 +02:00
bors
76e77af380 auto merge of #5901 : thestinger/rust/iterator, r=sanxiyn
Can now use them like `x.transform(|i| i + 3).zip(y.filter(|i| i % 2)`.
2013-04-15 21:03:55 -07:00
bors
16e8af9e47 auto merge of #5895 : huonw/rust/no-pub-tests, r=thestinger
This patch is a sledge hammer that moves all tests into `#[cfg(test)] mod test { .. }`, and makes them private, there were several instances of `pub mod tests { #[test] pub fn ... } `.

(The reason for this is I was playing with using `syntax` to index code ([result so far](http://www.ug.it.usyd.edu.au/~hwil7821/rust-api/)) and it was getting some junk from the tests.)

The rustdoc commit is particularly brutal, so it's fine if that one isn't landed.
2013-04-15 20:00:56 -07:00
Daniel Micay
f82c96446f iterator: use an IteratorUtil trait 2013-04-15 21:35:41 -04:00
Huon Wilson
d3be98e9f5 libcore,std,syntax,rustc: move tests into mod tests, make them private (no pub mod or pub fn). 2013-04-16 09:57:47 +10:00
bors
dd2c7f61a9 auto merge of #5879 : astrieanna/rust/document_std_base64, r=catamorphism
This adds examples for the methods in std::base64.

Each example is complete in the sense that you can copy-paste it into a file and compile it successfully without adding anything (imports, etc). The hardest part of figuring out how to use this was figuring out the right import statements to put at the top.
2013-04-15 16:18:52 -07:00
Leah Hanson
b5c9990c38 Change to 4-space indents in code examples 2013-04-14 09:24:13 -04:00
Leah Hanson
ced12a74cd update copyright notice on base64.rs 2013-04-14 08:01:54 -04:00
Alex Crichton
52445129fd std: remove unused unsafe blocks/functions 2013-04-14 01:15:46 -04:00
Dan Luu
78bc10d94b Doc review, as requested :-).
Mostly just phrasing things differently, which is a matter of taste. Feel free to use or not use any of the changes I'm suggesting.

I would say this one thing should be changed, though, not necessarily the way I changed it here.

     * Convert any string (literal, `@`, `&`, `~`)
     * that contains a base64 encoded value, to the byte values it encodes.

If this structure is going to be used, either the entire clause, 'that contains a base64 encoded value', should be bracketed by commas, or the comma at the end of the clause should be removed.
2013-04-13 16:17:30 -04:00
Leah Hanson
8e64b61df9 move rustdoc comments so that they attach to the functions rather than the impl blocks. 2013-04-13 08:11:39 -04:00
Daniel Micay
8bf9fc52f4 initial iterator object library 2013-04-13 05:51:14 -04:00
Leah Hanson
27a0269501 Add comments for the implementations of from_base64 and to_base64 for . 2013-04-12 22:15:56 -04:00
bors
76f6606a8c auto merge of #5827 : nikomatsakis/rust/issue-5656-change-meaning-of-borrowed-self, r=pcwalton
See #5656 for details.

r? @pcwalton
2013-04-12 15:14:24 -07:00
Leah Hanson
2ec2d99bbd add rustdoc comments with examples for the string versions of to_base64 and from_base64 2013-04-12 09:41:07 -04:00
bors
2f8b36fc16 auto merge of #5819 : erickt/rust/incoming, r=erickt
Good morning,

This first patch series adds support for `#[deriving(Decodable, Encodable)]`, but does not yet remove `#[auto_encode]` and `#[auto_decode]`. I need a snapshot to remove the old code. Along the way it also extends support for tuple structs and struct enum variants.

Also, it includes a minor fix to the pretty printer. We decided a while ago to use 4 spaces to indent a match arm instead of 2. This updates the pretty printer to reflect that.
2013-04-11 06:55:01 -07:00
Niko Matsakis
03396473b8 libstd: changes to in response to #5656 2013-04-10 17:32:03 -07:00
Erick Tryzelaar
f3ab67ec5f syntax: add {read,emit}_enum_struct_variant{,_field} 2013-04-10 16:32:09 -07:00
Erick Tryzelaar
e31f7b7c74 std: add serialize {read,emit}_tuple{,_arg,_struct,_struct_arg} 2013-04-10 16:32:09 -07:00
Erick Tryzelaar
419f6acf0e std: rename {read,emit}_field to {read,emit}_struct_field 2013-04-10 16:08:22 -07:00
Erick Tryzelaar
97cc571358 std: clean up the order of {De,En}codable methods 2013-04-10 16:08:22 -07:00
Brian Anderson
23e44a529b Bump version to 0.7-pre 2013-04-10 13:12:53 -07:00
Niko Matsakis
5606fc0c90 Revert map.each to something which takes two parameters
rather than a tuple.  The current setup iterates over
`BaseIter<(&'self K, &'self V)>` where 'self is a lifetime declared
*in the each method*.  You can't place such a type in
the impl declaration.  The compiler currently allows it,
but this will not be legal under #5656 and I'm pretty sure
it's not sound now.
2013-04-10 07:51:48 -07:00
Brian Anderson
23251b2438 Bump version to 0.7-pre 2013-04-09 10:59:32 -07:00
Alex Crichton
255193cc1a Removing no longer needed unsafe blocks 2013-04-08 17:50:25 -04:00
Alex Crichton
3136fba5ae Removing some mutable fields in libstd 2013-04-08 17:50:14 -04:00
gifnksm
eebf29ed37 Impl cmp/num traits for BigUint, BigInt
TotalEq, TotalOrd, FromStrRadix, ToStrRadix.
2013-04-07 13:28:17 +09:00
Huon Wilson
c6949b3669 libstd: make complex.rs XXX's into issues and FIXME's 2013-04-05 19:26:58 +11:00
Huon Wilson
82d54602d7 libstd: add basic complex numbers 2013-04-05 18:19:50 +11:00
Huon Wilson
7b0401d774 libstd: add basic rational numbers 2013-04-05 17:54:11 +11:00
Huon Wilson
ba63cba18d libstd: move bigint to dedicated num directory 2013-04-05 17:36:24 +11:00
ILyoan
53232f7acf Fix fileinput test fail 2013-04-04 11:16:26 +09:00
bors
84c296b27d auto merge of #5701 : metajack/rust/net-url-clone, r=thestinger 2013-04-03 16:06:48 -07:00
Jack Moffitt
c4d2b7999a Add Clone derivation for std::net::url types. 2013-04-03 11:03:41 -06:00
Daniel Micay
cc148b58ff rename Linear{Map,Set} => Hash{Map,Set} 2013-04-03 10:30:36 -04:00