Commit Graph

1617 Commits

Author SHA1 Message Date
Brendan Zabarauskas ad0b337036 Add is_zero method to Zero 2013-04-26 05:55:26 +10: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