Commit Graph

916 Commits

Author SHA1 Message Date
Kevin Ballard
d6d9b92683 path2: Adjust the API to remove all the _str mutation methods
Add a new trait BytesContainer that is implemented for both byte vectors
and strings.

Convert Path::from_vec and ::from_str to one function, Path::new().

Remove all the _str-suffixed mutation methods (push, join, with_*,
set_*) and modify the non-suffixed versions to use BytesContainer.
2013-10-15 22:18:30 -07:00
Kevin Ballard
e65d33e9ed path2: Update for loop -> continue 2013-10-15 21:56:54 -07:00
Kevin Ballard
73d3d00ec4 path2: Replace the path module outright
Remove the old path.
Rename path2 to path.
Update all clients for the new path.

Also make some miscellaneous changes to the Path APIs to help the
adoption process.
2013-10-15 21:56:54 -07:00
Steven Fackler
194302493c Remove extra::flatpipes
Closes #9884
2013-10-15 18:54:35 -07:00
Felix S. Klock II
602b3cd56c Only use padded test names to calculate the target padding size. 2013-10-14 17:19:15 -04:00
Felix S. Klock II
c56bf67150 Issue 7655: align the bench printouts so that the numbers tend to be aligned.
(scratching an itch.)

Rebased and updated.
Fixed bug: omitted field init from embedded struct literal in a test.
Fixed bug: int underflow during padding length calculation.
2013-10-14 17:18:34 -04:00
Steve Klabnik
309ab958e6 Removing ccdecl
as per https://github.com/mozilla/rust/pull/9606#discussion_r6930872
2013-10-14 14:33:05 +02:00
Steve Klabnik
16fc6a694c Remove unused abi attributes.
They've been replaced by putting the name on the extern block.

  #[abi = "foo"]

goes to

  extern "foo" { }

Closes #9483.
2013-10-14 13:10:36 +02:00
Corey Richardson
023466ccca extra: implement Encodable/Decodable for Uuid 2013-10-14 01:47:55 -04:00
bors
c147ec6d06 auto merge of #9794 : thestinger/rust/rc, r=alexcrichton
I've left out a way to construct from a `Send` type until #9509 is resolved. I am confident that this interface can remain backwards compatible though, assuming we name the `Pointer` trait method `borrow`.

When there is a way to convert from `Send` (`from_send`), a future RAII-based `Mut` type can be used with this to implemented a mutable reference-counted pointer. For now, I've left around the `RcMut` type but it may drastically change or be removed.
2013-10-11 11:11:21 -07:00
Daniel Micay
18be986c99 clean up the Rc/RcMut types and move to libstd 2013-10-11 13:28:36 -04:00
bors
ed37b00b06 auto merge of #9803 : alexcrichton/rust/less-pub2, r=brson
This change was waiting for privacy to get sorted out, which should be true now
that #8215 has landed.

Closes #4427
2013-10-11 08:56:19 -07:00
Benjamin Herr
63e9e496f6 extra::tempfile: replace mkdtemp with an RAII wrapper
this incidentally stops `make check` from leaving directories in `/tmp`
2013-10-11 15:55:37 +02:00
Alex Crichton
8b4423b04f De-pub some private runtime components
This change was waiting for privacy to get sorted out, which should be true now
that #8215 has landed.

Closes #4427
2013-10-11 06:49:18 -07:00
bors
62812f1e38 auto merge of #9386 : Geal/rust/base64-doc, r=alexcrichton
Standard is now uppercase in the base64 module, and from_base64 now returns a Result
2013-10-09 10:41:31 -07:00
Geoffroy Couprie
0b4f052422 Correct code examples for base64 documentation 2013-10-09 18:36:51 +02:00
Daniel Micay
6a90e80b62 option: rewrite the API to use composition 2013-10-09 09:17:29 -04:00
Huon Wilson
92725ae765 std::rand: Add a trait for seeding RNGs: SeedableRng.
This provides 2 methods: .reseed() and ::from_seed that modify and
create respecitively.

Implement this trait for the RNGs in the stdlib for which this makes
sense.
2013-10-09 22:22:42 +11:00
Huon Wilson
a2b509656a std::rand: Add an implementation of ISAAC64.
This is 2x faster on 64-bit computers at generating anything larger
than 32-bits.

It has been verified against the canonical C implementation from the
website of the creator of ISAAC64.

Also, move `Rng.next` to `Rng.next_u32` and add `Rng.next_u64` to
take full advantage of the wider word width; otherwise Isaac64 will
always be squeezed down into a u32 wasting half the entropy and
offering no advantage over the 32-bit variant.
2013-10-09 22:22:42 +11:00
Alex Crichton
de7d143176 Fix existing privacy/visibility violations
This commit fixes all of the fallout of the previous commit which is an attempt
to refine privacy. There were a few unfortunate leaks which now must be plugged,
and the most horrible one is the current `shouldnt_be_public` module now inside
`std::rt`. I think that this either needs a slight reorganization of the
runtime, or otherwise it needs to just wait for the external users of these
modules to get replaced with their `rt` implementations.

Other fixes involve making things pub which should be pub, and otherwise
updating error messages that now reference privacy instead of referencing an
"unresolved name" (yay!).
2013-10-07 13:00:52 -07:00
Alex Crichton
dd98f7089f Implement feature-gating for the compiler
A few features are now hidden behind various #[feature(...)] directives. These
include struct-like enum variants, glob imports, and macro_rules! invocations.

Closes #9304
Closes #9305
Closes #9306
Closes #9331
2013-10-05 20:19:33 -07:00
bors
549f70989e auto merge of #9734 : luisbg/rust/master, r=alexcrichton
These formats are already covered with 'T' | 'X' in line 571 and 'D' | 'x' in
line 446.
2013-10-05 17:26:35 -07:00
Luis de Bethencourt
72490c9d48 extra: remove commented out 'X' and 'x' formats
These formats are already covered with 'T' | 'X' in line 571 and 'D' | 'x' in
line 446.
2013-10-05 17:30:26 -04:00
bors
2733b189ac auto merge of #9250 : erickt/rust/num, r=erickt
This PR solves one of the pain points with c-style enums. Simplifies writing a fn to convert from an int/uint to an enum. It does this through a `#[deriving(FromPrimitive)]` syntax extension.

Before this is committed though, we need to discuss if `ToPrimitive`/`FromPrimitive` has the right design (cc #4819). I've changed all the `.to_int()` and `from_int()` style functions to return `Option<int>` so we can handle partial functions. For this PR though only enums and `extra::num::bigint::*` take advantage of returning None for unrepresentable values. In the long run it'd be better if `i64.to_i8()` returned `None` if the value was too large, but I'll save this for a future PR.

Closes #3868.
2013-10-05 14:26:44 -07:00
Erick Tryzelaar
0e8ad4d8a2 extra: fix BigInt on 32bit machines 2013-10-05 13:59:06 -07:00
Erick Tryzelaar
e323749397 extra: Don't truncate {u64,i64} when converting to BigInts 2013-10-05 13:59:05 -07:00
Luis de Bethencourt
a0c59941e3 extra: remove unnecessary second level functions
do_strptime() and do_strftime()
2013-10-03 16:01:42 -04:00
bors
8f40641e01 auto merge of #9691 : alexcrichton/rust/rustdoc, r=cmr
This slurps in the commits from #9684 as well as closing #9539.
2013-10-03 00:56:34 -07:00
bors
20760739e9 auto merge of #9689 : luisbg/rust/strftime, r=alexcrichton
Plus testing added for %X and %x which were supported but not tested.

Working towards #2350
2013-10-02 17:01:32 -07:00
Alex Crichton
d06043ba0b rustdoc: Generate hyperlinks between crates
The general idea of hyperlinking between crates is that it should require as
little configuration as possible, if any at all. In this vein, there are two
separate ways to generate hyperlinks between crates:

1. When you're generating documentation for a crate 'foo' into folder 'doc',
   then if foo's external crate dependencies already have documented in the
   folder 'doc', then hyperlinks will be generated. This will work because all
   documentation is in the same folder, allowing links to work seamlessly both
   on the web and on the local filesystem browser.

   The rationale for this use case is a package with multiple libraries/crates
   that all want to link to one another, and you don't want to have to deal with
   going to the web. In theory this could be extended to have a RUST_PATH-style
   searching situtation, but I'm not sure that it would work seamlessly on the
   web as it does on the local filesystem, so I'm not attempting to explore this
   case in this pull request. I believe to fully realize this potential rustdoc
   would have to be acting as a server instead of a static site generator.

2. One of foo's external dependencies has a #[doc(html_root_url = "...")]
   attribute. This means that all hyperlinks to the dependency will be rooted at
   this url.

   This use case encompasses all packages using libstd/libextra. These two
   crates now have this attribute encoded (currently at the /doc/master url) and
   will be read by anything which has a dependency on libstd/libextra. This
   should also work for arbitrary crates in the wild that have online
   documentation. I don't like how the version is hard-wired into the url, but I
   think that this may be a case-by-case thing which doesn't end up being too
   bad in the long run.

Closes #9539
2013-10-02 16:17:08 -07:00
Luis de Bethencourt
8f6e43e273 extra: %W and %+ support in time::strftime
Plus testing added for %X and %x which were supported but not tested.

Working towards #2350
2013-10-02 18:01:44 -04:00
bors
371a7ec569 auto merge of #9675 : sfackler/rust/lint, r=alexcrichton
Closes #9671
2013-10-02 13:26:36 -07:00
bors
aaeb7605c9 auto merge of #9670 : luisbg/rust/strftime, r=alexcrichton 2013-10-02 10:11:38 -07:00
Steven Fackler
b7fe83d573 Check enums in missing_doc lint
Closes #9671
2013-10-02 08:57:03 -07:00
Luis de Bethencourt
1005b7976b extra: %G, %g and %V support in time::strftime
Fixes #2350
2013-10-02 11:22:59 -04:00
Erick Tryzelaar
01be9e9904 extra: Add ToBigInt and ToBigUint traits 2013-10-02 07:55:42 -07:00
Erick Tryzelaar
9de7ad2d8c std: Swap {To,From}Primitive to use the 64bit as the unimplemented version
One downside with this current implementation is that since BigInt's
default is now 64 bit, we can convert larger BigInt's to a primitive,
however the current implementation on 32 bit architectures does not
take advantage of this fact.
2013-10-02 07:55:42 -07:00
Erick Tryzelaar
d9d1dfc195 std: Replace num::IntConvertible with {To,From}Primitive 2013-10-02 07:55:41 -07:00
bors
d00c9269dc auto merge of #9665 : alexcrichton/rust/snapshot, r=brson
Uses the new snapshots to kill the old `loop` and introduce the new `continue`.
2013-10-02 02:31:29 -07:00
Luis de Bethencourt
c463772ebd extra: %U support in time::strftime
Fixes #2350
2013-10-01 22:20:46 -04:00
Alex Crichton
4f67dcb24a Migrate users of 'loop' to 'continue'
Closes #9467
2013-10-01 15:53:13 -07:00
Daniel Micay
c9d4ad07c4 remove the float type
It is simply defined as `f64` across every platform right now.

A use case hasn't been presented for a `float` type defined as the
highest precision floating point type implemented in hardware on the
platform. Performance-wise, using the smallest precision correct for the
use case greatly saves on cache space and allows for fitting more
numbers into SSE/AVX registers.

If there was a use case, this could be implemented as simply a type
alias or a struct thanks to `#[cfg(...)]`.

Closes #6592

The mailing list thread, for reference:

https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-10-01 14:54:10 -04:00
Alex Crichton
af3b132285 syntax: Remove usage of fmt! 2013-09-30 23:21:19 -07:00
Alex Crichton
7e709bfd0d extra: Remove usage of fmt! 2013-09-30 23:21:18 -07:00
bors
67394f20eb auto merge of #9552 : brson/rust/0.9-pre, r=alexcrichton 2013-09-27 13:51:07 -07:00
bors
10e7f12daf auto merge of #9550 : alexcrichton/rust/remove-printf, r=thestinger
The 0.8 release was cut, down with printf!
2013-09-27 08:21:23 -07:00
bors
fcd3776e82 auto merge of #9523 : huonw/rust/kud1ing-docs, r=huonw
Collation of @kud1ing's work in #9511, #9512, #9513 and #9518.
2013-09-26 20:06:09 -07:00
Brian Anderson
99c1fb8c66 Update version numbers to 0.9-pre 2013-09-26 18:18:42 -07:00
Alex Crichton
409182de6d Update the compiler to not use printf/printfln 2013-09-26 17:05:59 -07:00
bors
f210a16718 auto merge of #9520 : blake2-ppc/rust/ringbuf-swap, r=thestinger
extra::ringbuf: Implement method `.swap(uint, uint)` just like vector

RingBuf::swap(&mut self, i, j) swaps the element at indices `i` and `j`
if both elements are in bounds, otherwise it fails.
2013-09-26 13:21:08 -07:00
bors
6f991a2441 auto merge of #9506 : sfackler/rust/visibility, r=alexcrichton 2013-09-26 09:21:09 -07:00
bors
0f9bcaf7fe auto merge of #9503 : dcrewi/rust/fix-digest-visibility, r=alexcrichton
I really have no idea why the tests didn't fail. Maybe it's another cross-crate issue?
2013-09-26 06:56:00 -07:00
kud1ing
3165ddeb40 bitv: backticks for code in documentation 2013-09-26 23:15:42 +10:00
kud1ing
c873216ab6 bigint: backticks for code in documentation 2013-09-26 23:15:42 +10:00
kud1ing
d964f79998 base64: backticks for code in documentation 2013-09-26 23:15:42 +10:00
kud1ing
d798e00337 Enclose code in documentation in backticks 2013-09-26 23:15:42 +10:00
bors
0022f2b204 auto merge of #9500 : fhahn/rust/rename-str_from_bytes-fix, r=alexcrichton
As @Dretch pointed out [here](de39874801 (L2L526)) , from_bytes was accidentally renamed to from_utf8.
2013-09-26 05:36:01 -07:00
blake2-ppc
57757a8051 extra::ringbuf: Implement method .swap(uint, uint) just like vector
RingBuf::swap(&mut self, i, j) swaps the element at indices `i` and `j`
if both elements are in bounds, otherwise it fails.
2013-09-26 09:25:32 +02:00
Steven Fackler
d8957e6332 Some struct visibility fixes 2013-09-25 19:42:02 -07:00
David Creswick
252c6dbe85 Fix visibility of digest implementations 2013-09-25 19:39:17 -05:00
bors
41826c48ed auto merge of #9475 : alexcrichton/rust/rustdoc++, r=cmr
The commit messages are a good technical summary, a good visual summary (contrib is this version):

Pub use statements now rendered. Notice how almost all components are also clickable!
* http://static.rust-lang.org/doc/master/std/prelude/index.html
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/prelude/index.html

Private things hidden by default (for at least some approximation of privacy). I hope to improve this once privacy is totally ironed out.
* http://static.rust-lang.org/doc/master/std/hashmap/struct.HashMap.html
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/hashmap/struct.HashMap.html

Unindentation now works properly:
* http://static.rust-lang.org/doc/master/extra/getopts/index.html
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/extra/getopts/index.html

Also sundown has massively reduced compilation time (of docs, not the of the crates)
2013-09-25 15:40:52 -07:00
Alex Crichton
f648690234 rustdoc: Strip hidden docs by default. 2013-09-25 14:27:43 -07:00
Alex Crichton
bcc7daa6bc rustdoc: Improve comment stripping
There is less implicit removal of various comment styles, and it also removes
extraneous stars occasionally found in docblock comments. It turns out that the
bug for getops was just a differently formatted block.

Closes #9425
Closes #9417
2013-09-25 14:27:42 -07:00
Alex Crichton
3585c64d09 rustdoc: Change all code-blocks with a script
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g'
    find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g'
    find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-25 14:27:42 -07:00
bors
24d46a0f45 auto merge of #9345 : Dretch/rust/digest-result-bytes, r=cmr
I would find this function useful.
2013-09-25 14:25:52 -07:00
Florian Hahn
23a067dc2c Rename from_utf8 to from_bytes again 2013-09-25 22:58:57 +02:00
bors
4531184614 auto merge of #9432 : alexcrichton/rust/correct-item-visibility, r=pcwalton
This fixes private statics and functions from being usable cross-crates, along
with some bad privacy error messages. This is a reopening of #8365 with all the
privacy checks in privacy.rs instead of resolve.rs (where they should be
anyway).

These maps of exported items will hopefully get used for generating
documentation by rustdoc

Closes #8592
2013-09-25 00:55:53 -07:00
Brian Anderson
6d03897376 Don't use libc::exit. #9473
This can cause unexpected errors in the runtime when done while
scheduler threads are still initializing. Required some restructuring
of the main_args functions in our libraries.
2013-09-24 16:34:23 -07:00
Alex Crichton
10a583ce1a Correctly encode item visibility in metadata
This fixes private statics and functions from being usable cross-crates, along
with some bad privacy error messages. This is a reopening of #8365 with all the
privacy checks in privacy.rs instead of resolve.rs (where they should be
anyway).

These maps of exported items will hopefully get used for generating
documentation by rustdoc

Closes #8592
2013-09-24 09:57:25 -07:00
Patrick Walton
3b1d3e5bf8 librustc: Fix merge fallout. 2013-09-23 18:23:23 -07:00
Patrick Walton
90d3da9711 test: Fix rustdoc and tests. 2013-09-23 18:23:22 -07:00
Patrick Walton
68ea9aed96 librustc: Remove @fn managed closures from the language. 2013-09-23 18:23:21 -07:00
Patrick Walton
9a4de3f305 libsyntax: Introduce routines and remove all @fns from libsyntax save the old visitor 2013-09-23 18:23:21 -07:00
Scott Lawrence
a5cf9fdb61 Add docs for extra::semver 2013-09-22 20:23:45 -04:00
Huon Wilson
fb923c7d3f std: merge rand::{Rng,RngUtil} with default methods.
Also, documentation & general clean-up:
- remove `gen_char_from`: better served by `sample` or `choose`.
- `gen_bytes` generalised to `gen_vec`.
- `gen_int_range`/`gen_uint_range` merged into `gen_integer_range` and
  made to be properly uniformly distributed. Fixes #8644.

Minor adjustments to other functions.
2013-09-23 00:11:42 +10:00
Brian Anderson
695cb9fc2b Update version numbers to 0.8 2013-09-21 16:25:08 -07:00
bors
44dc3fba8b auto merge of #9380 : thestinger/rust/par, r=alexcrichton
This was a dead end experiment, and not a sensible way of implementing
generic data parallelism. This also removes the `graph500-bfs.rs`
benchmark because it relies on `extra::par`.

Closes #5626
2013-09-21 10:10:56 -07:00
bors
b094cf48e1 auto merge of #9360 : huonw/rust/4449, r=pnkfelix
Fixes #4449. (Ran it through try-bsd: http://buildbot.rust-lang.org/builders/try-bsd/builds/451)
2013-09-21 02:56:01 -07:00
Alex Crichton
4fd061c426 Implement a web backend for rustdoc_ng
This large commit implements and `html` output option for rustdoc_ng. The
executable has been altered to be invoked as "rustdoc_ng html <crate>" and
it will dump everything into the local "doc" directory. JSON can still be
generated by changing 'html' to 'json'.

This also fixes a number of bugs in rustdoc_ng relating to comment stripping,
along with some other various issues that I found along the way.

The `make doc` command has been altered to generate the new documentation into
the `doc/ng/$(CRATE)` directories.
2013-09-20 22:49:03 -07:00
Daniel Micay
e753618b6b drop extra::par
This was a dead end experiment, and not a sensible way of implementing
generic data parallelism. This also removes the `graph500-bfs.rs`
benchmark because it relies on `extra::par`.

Closes #5626
2013-09-21 01:02:56 -04:00
Huon Wilson
76a53911b4 Uncomment a test. Fixes #4449. 2013-09-20 21:47:57 +10:00
bors
e5fdc7dee5 auto merge of #9320 : chris-morgan/rust/unreachable-macro-part-two-of-two-containing-the-destruction-of-the-unreachable-function, r=alexcrichton
This is the second of two parts of #8991, now possible as a new snapshot
has been made. (The first part implemented the unreachable!() macro; it
was #8992, 6b7b8f2682.)

``std::util::unreachable()`` is removed summarily; any code which used
it should now use the ``unreachable!()`` macro.

Closes #9312.

Closes #8991.
2013-09-20 00:36:11 -07:00
Gareth Smith
b82e0d32ce Add a new Digest.result_bytes convenience function. 2013-09-20 00:05:27 +01:00
Steven Fackler
963707f45d Clean up unused imports 2013-09-19 15:19:25 -07:00
Steven Fackler
48d5b4b8e1 Add Future::spawn_with 2013-09-19 15:19:25 -07:00
Steven Fackler
ff85389344 Modernize extra::future API 2013-09-19 15:19:20 -07:00
Steven Fackler
2df5a13334 Removed future's destructor
It was only there to prevent Future from being copyable, but it's
noncopyable anyways since it contains a ~fn.
2013-09-19 09:06:42 -07:00
bors
99ec14dbb0 auto merge of #9267 : Kimundi/rust/master, r=huonw 2013-09-19 05:06:00 -07:00
Marvin Löbel
06d1dccf95 Turned extra::getopts functions into methods
Some minor api and doc adjustments
2013-09-19 12:32:18 +02:00
bors
a7cf7b7b0b auto merge of #9291 : jzelinskie/rust/remove-cond, r=alexcrichton
This is my first contribution, so please point out anything that I may have missed.

I consulted IRC and settled on `match () { ... }` for most of the replacements.
2013-09-19 00:31:05 -07:00
Chris Morgan
e2807a4565 Replace unreachable() calls with unreachable!().
This is the second of two parts of #8991, now possible as a new snapshot
has been made. (The first part implemented the unreachable!() macro; it
was #8992, 6b7b8f2682.)

``std::util::unreachable()`` is removed summarily; any code which used
it should now use the ``unreachable!()`` macro.

Closes #9312.

Closes #8991.
2013-09-19 15:04:03 +10:00
Alex Crichton
817576ee70 Register new snapshots 2013-09-18 11:07:22 -07:00
Jimmy Zelinskie
4757631369 Remove and replace cond! Closes #9282. 2013-09-18 07:34:02 -04:00
bors
4c6bf48720 auto merge of #9133 : dcrewi/rust/bigint-random-range, r=huonw 2013-09-17 20:35:54 -07:00
David Creswick
af72e4108d Generate random big integers within a range
Thanks to @huonw for feedback
2013-09-17 20:48:04 -05:00
Daniel Micay
befc561fa4 remove unnecessary transmutes 2013-09-17 11:54:37 -04:00
bors
29cdf58861 auto merge of #9244 : thestinger/rust/drop, r=catamorphism
This doesn't close any bugs as the goal is to convert the parameter to by-value, but this is a step towards being able to make guarantees about `&T` pointers (where T is Freeze) to LLVM.
2013-09-17 07:15:42 -07:00
Daniel Micay
4e161a4d40 switch Drop to &mut self 2013-09-16 22:19:23 -04:00
bors
2f96c22a21 auto merge of #9231 : cmr/rust/enum_encoding, r=catamorphism 2013-09-16 17:55:46 -07:00
bors
0ec4d34b3f auto merge of #9211 : klutzy/rust/win32-fix, r=alexcrichton 2013-09-16 11:30:42 -07:00
Corey Richardson
9ea295b7df extra::json: use a different encoding for enums.
It now uses `{"type": VariantName, "fields": [...]}`, which, according to
@Seldaek, since all enums will have the same "shape" rather than being a weird
ad-hoc array, will optimize better in javascript JITs. It also looks prettier,
and makes more sense.
2013-09-16 12:40:32 -04:00
Lindsey Kuper
a7515c87ae Have workcache::test put foo.c in the same directory it runs in.
This prevents a stray `foo.c` from being left lying around after tests
run, and it's more consistent with the rest of the code.
2013-09-16 01:21:00 -04:00
klutzy
6aebf3cc16 extra::fileinput: Enable tests on Win32
They were blocked by #8810, but it works now.
2013-09-16 11:08:17 +09:00
blake2-ppc
8522341274 Remove {uint,int,u64,i64,...}::from_str,from_str_radix
Remove these in favor of the two traits themselves and the wrapper
function std::from_str::from_str.

Add the function std::num::from_str_radix in the corresponding role for
the FromStrRadix trait.
2013-09-15 14:29:16 +02:00
blake2-ppc
ad74fde62f Use std::iter::range_step
Use the iterator version instead of the old uint::/int::range_step
functions.
2013-09-15 00:41:34 -04:00
bors
1c26513ef9 auto merge of #9180 : blake2-ppc/rust/reduce-either, r=catamorphism
Work a bit towards #9157 "Remove Either". These instances don't need to use Either and are better expressed in other ways (removing allocations and simplifying types).
2013-09-14 08:50:50 -07:00
bors
2aa578efd9 auto merge of #9115 : erickt/rust/master, r=erickt
This is a series of patches to modernize option and result. The highlights are:

* rename `.unwrap_or_default(value)` and etc to `.unwrap_or(value)`
* add `.unwrap_or_default()` that uses the `Default` trait
* add `Default` implementations for vecs, HashMap, Option
* add  `Option.and(T) -> Option<T>`, `Option.and_then(&fn() -> Option<T>) -> Option<T>`, `Option.or(T) -> Option<T>`, and `Option.or_else(&fn() -> Option<T>) -> Option<T>`
* add `option::ToOption`, `option::IntoOption`, `option::AsOption`, `result::ToResult`, `result::IntoResult`, `result::AsResult`, `either::ToEither`, and `either::IntoEither`, `either::AsEither`
* renamed `Option::chain*` and `Result::chain*` to `and_then` and `or_else` to avoid the eventual collision with `Iterator.chain`.
* Added a bunch of impls of `Default`
* Added a `#[deriving(Default)]` syntax extension
* Removed impls of `Zero` for `Option<T>` and vecs.
2013-09-14 00:01:04 -07:00
Alex Crichton
0af2bd829e Remove all usage of change_dir_locked
While usage of change_dir_locked is synchronized against itself, it's not
synchronized against other relative path usage, so I'm of the opinion that it
just really doesn't help in running tests. In order to prevent the problems that
have been cropping up, this completely removes the function.

All existing tests (except one) using it have been moved to run-pass tests where
they get their own process and don't need to be synchronized with anyone else.

There is one now-ignored rustpkg test because when I moved it to a run-pass test
apparently run-pass isn't set up to have 'extern mod rustc' (it ends up having
linkage failures).
2013-09-13 21:58:00 -07:00
blake2-ppc
15c9dc7a86 extra::workcache: Remodel the (internal) struct Work
Using an enum with two cases for `Work` reveals simpler code than the
previous `Option<Either<X, Y>>` representation.
2013-09-14 04:07:51 +02:00
blake2-ppc
b4eff79f38 extra::test: Use Result instead of Either.
OptRes was combining a successful value with an error message, which
fits the Result type perfectly.
2013-09-14 04:07:43 +02:00
bors
05bbb480a2 auto merge of #9170 : alexcrichton/rust/flaky-fileinput, r=erickt
The glob tests cannot change the current working directory because the other tests (namely the fileinput ones) depend on the current working directory not changing.
2013-09-13 11:45:56 -07:00
Alex Crichton
a7215dd284 Move glob tests to a run-pass test
The normal unit tests cannot change the current working directory because it
messes with the other tests which depend on a particular working directory.
2013-09-13 10:52:22 -07:00
bors
7c8f503ac5 auto merge of #9141 : alexcrichton/rust/ignore-fileinput, r=catamorphism
These tests are being very flaky on the bots, and the reason is that files are
being created and then when attempted to get read they actually don't exist. I'm
not entirely sure why this is happening, but I also don't fully trust the
std::io implemention using @-boxes to close/flush/write files at the right time.

This moves the tests to using std::rt::io which is hopefully more robust and
something that we can actually reason about. Sadly, due to #8810, these tests
fail on windows, so they're all ignored on windows right now.
2013-09-13 02:25:49 -07:00
Erick Tryzelaar
a0e123eb6e syntax: add #[deriving(Default)] syntax extension 2013-09-12 18:54:13 -07:00
Erick Tryzelaar
ca47eebb44 std: Add a bunch of Default impls 2013-09-12 18:54:13 -07:00
Erick Tryzelaar
38f97ea103 std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else} 2013-09-12 18:54:13 -07:00
Erick Tryzelaar
d625d4a598 std: Add Option.{and,and_then,or,or_else} 2013-09-12 18:54:12 -07:00
Erick Tryzelaar
45c62c08f9 std: rename Option::unwrap_or_default() to unwrap_or() 2013-09-12 18:54:11 -07:00
bors
137b31e2fe auto merge of #8908 : tikue/rust/master, r=anasazi
SyncChan blocks after sending a message until the SyncPort acknowledges receipt of the message.
2013-09-12 07:26:04 -07:00
bors
3c17903c36 auto merge of #9131 : Dretch/rust/glob-range-patterns, r=alexcrichton
This feature was overlooked in the original pull request (#8914).

r? @alexcrichton
2013-09-12 06:06:04 -07:00
bors
0a2d3c5a6f auto merge of #9096 : huonw/rust/linenoise, r=brson
- Wrap calls into linenoise in a mutex so that the functions don't have to be `unsafe` any more (fixes #3921)
- Stop leaking every line that linenoise reads.
- Handle the situation of `rl::complete(some_function); do spawn { rl::read(""); }` which would crash (`fail!` that turned into an abort, possibly due to failing with the lock locked) when the user attempted to tab-complete anything.
- Add a test for the various functions; it has to be run by hand to verify anything works, but it won't bitrot.
2013-09-12 04:36:06 -07:00
Alex Crichton
68a9137eac Rewrite fileinput tests to use std::rt::io
These tests are being very flaky on the bots, and the reason is that files are
being created and then when attempted to get read they actually don't exist. I'm
not entirely sure why this is happening, but I also don't fully trust the
std::io implemention using @-boxes to close/flush/write files at the right time.

This moves the tests to using std::rt::io which is hopefully more robust and
something that we can actually reason about. Sadly, due to #8810, these tests
fail on windows, so they're all ignored on windows right now.
2013-09-12 01:04:39 -07:00
Tim Kuehn
a835995488 Rendezvous stream for synchronous channel messaging 2013-09-11 22:03:54 -04:00
bors
91ab8a3f52 auto merge of #9014 : dcrewi/rust/convert-between-bigints, r=anasazi 2013-09-11 16:46:00 -07:00
Gareth Smith
ef08b2339d Support character range patterns (e.g. [0-9], [a-z]), like other globs do. 2013-09-11 23:46:33 +01:00
Huon Wilson
4ed5fcb122 extra: improvements & bug fixes to rl.
- Removes a layer of indirection in the storage of the completion
  callback.
- Handles user tab completion in a task in which `complete` hasn't been
  properly. Previously, if `complete` was called in one task, and `read`
  called in another, attempting to get completions would crash. This
  makes the completion handlers non-ambiguously task-local only.
- Fix a mismatch in return values between the Rust code and linenoise.
2013-09-11 22:20:33 +10:00
Huon Wilson
fe03d827a4 extra: stop rl from leaking each line that is read. 2013-09-11 22:20:33 +10:00
Huon Wilson
21ce41d42d extra: use a mutex to wrap linenoise calls and make them threadsafe.
Fixes #3921.
2013-09-11 22:20:33 +10:00
bors
5bb8aefed6 auto merge of #9007 : dcrewi/rust/random-bigints, r=huonw 2013-09-11 03:11:05 -07:00
bors
7820fb5ca9 auto merge of #9062 : blake2-ppc/rust/vec-iterator, r=alexcrichton
Visit the free functions of std::vec and reimplement or remove some. Most prominently, remove `each_permutation` and replace with two iterators, ElementSwaps and Permutations.

Replace unzip, unzip_slice with an updated `unzip` that works with an iterator argument.

Replace each_permutation with a Permutation iterator. The new permutation iterator is more efficient since it uses an algorithm that produces permutations in an order where each is only one element swap apart, including swapping back to the original state with one swap at the end.

Unify the seldomly used functions `build`, `build_sized`, `build_sized_opt` into just one function `build`.

Remove `equal_sizes`
2013-09-09 21:31:03 -07:00
blake2-ppc
c11ee0fb67 std::at_vec and vec: Unify build_sized, build_sized_opt into build
These functions have very few users since they are mostly replaced by
iterator-based constructions.

Convert a few remaining users in-tree, and reduce the number of
functions by basically renaming build_sized_opt to build, and removing
the other two. This for both the vec and the at_vec versions.
2013-09-10 05:50:11 +02:00
bors
8c7c0b41d7 auto merge of #9034 : catamorphism/rust/rustpkg-workcache, r=metajack
r? @metajack or @brson - This pull request makes rustpkg use the workcache library to avoid recompilation.
2013-09-09 20:16:02 -07:00
bors
ed695d470b auto merge of #9083 : dcrewi/rust/biguint-bit-ops, r=brson 2013-09-09 14:10:58 -07:00
David Creswick
c3d0fc23d4 Implement bitwise operations on BigUint 2013-09-09 12:15:19 -05:00
David Creswick
4946e0ea5e Merge RandBigUint and RandBigInt into single trait 2013-09-09 11:31:40 -05:00
David Creswick
9bee3d7e5b Convert between BigInts, BigUints, ints, and uints
Previously, conversion to ints, uints, and BigUints clamped the value
within the range of that datatype. With this commit, conversion
overflows fail the task. To handle overflows gracefully, use the new
to_*_opt() methods.
2013-09-09 11:15:03 -05:00
Daniel Micay
6919cf5fe1 rename std::iterator to std::iter
The trait will keep the `Iterator` naming, but a more concise module
name makes using the free functions less verbose. The module will define
iterables in addition to iterators, as it deals with iteration in
general.
2013-09-09 03:21:46 -04:00
Tim Chevalier
ed4859ea78 extra: Address review comments from Jack 2013-09-08 22:00:13 -07:00
Tim Chevalier
02a0fb94ee rustpkg: Use workcache
rustpkg now uses the workcache library to avoid recompilation.
Hooray!
2013-09-08 20:05:12 -07:00
Tim Chevalier
bb30f047f6 workcache: Add the ability to save and load the database...
...as well as the ability to discover inputs and outputs.
2013-09-08 20:05:11 -07:00
Steven Fackler
3eaf750a0d Renamed Uuid::from_utf8 to Uuid::from_bytes
This method doesn't deal with utf8. I guess it got caught in a mass
rename.
2013-09-07 11:05:48 -07:00
bors
124eb2119c auto merge of #9026 : jbclements/rust/let-var-hygiene, r=jbclements
This is a rebase of my approved pull request from ... the end of June? It introduces hygiene for let-bound variables.
2013-09-06 23:35:57 -07:00
bors
3e6de6b7da auto merge of #9016 : sfackler/rust/nanoseconds, r=alexcrichton
The ISO 8601 standard does not mandate any specific precision for
fractional seconds, so this accepts input of any length, ignoring the
part after the nanoseconds place. It may be more correct to round with
the tenths of nanoseconds digit, but then we'd have to deal with
carrying the round through the entire Tm struct (e.g. for a time like
Dec 31 11:59.999999999999).

%f is the format specifier that Python's datetime library uses for
0-padded microseconds so it seemed appropriate here.

cc #2350
2013-09-06 22:25:59 -07:00
Tim Kuehn
39ce095ebd use enumerate in place of 'for ti in range(i, tokens.len()) ... match tokens[ti] ...' 2013-09-06 21:54:03 -04:00
David Creswick
54368afc03 Incorporate feedback from huonw
- use identifiers with underscores to avoid unused variable warning
- implement on R: Rng instead of on R: RngUtil
- bugfix: zero BigInts were being generated twice as often as any
  other number
- test that gen_biguint(0) always returns zero
2013-09-06 13:57:21 -05:00
John Clements
6e3b2ab44d move and duplicate macro defns in sha2 to make them hygienic
... it would also have been possible to add all of their dependencies,
but that would have increased the already-lengthy list of parameters.
Also, if we had macros that could expand into macro defns, you could
stage it. This seemed like the least painful choice.
2013-09-06 09:28:45 -07:00
Alex Crichton
507414daf9 Un-hork the bots by removing intermediate files
The new glob tests created tmp/glob-tests as a directory, but the never removed
it. The `make clean` target then attempted to `rm -f` on this, but it couldn't
remove the directory. This both changes the clean target to `rm -rf` tmp files,
and also alters the tests to delete the directory that all the files are added
into.
2013-09-06 00:17:14 -07:00
Steven Fackler
3c30ecb706 Add fractional second support to str{p,f}time
The ISO 8601 standard does not mandate any specific precision for
fractional seconds, so this accepts input of any length, ignoring the
part after the nanoseconds place. It may be more correct to round with
the tenths of nanoseconds digit, but then we'd have to deal with
carrying the round through the entire Tm struct (e.g. for a time like
Dec 31 11:59.999999999999).

%f is the format specifier that Python's datetime library uses for
0-padded microseconds so it seemed appropriate here.

cc #2350
2013-09-05 23:19:41 -07:00
bors
5efe1e5365 auto merge of #8914 : Dretch/rust/native-glob, r=alexcrichton
This is #8201 with a bunch of amendments to address the comments (and re-based).
2013-09-05 22:00:58 -07:00
David Creswick
dfb04d9953 Convert between BigInts and BigUints 2013-09-05 23:15:33 -05:00
David Creswick
4339952934 test the correct function (oops) 2013-09-05 21:39:14 -05:00
David Creswick
3d735e4a63 Generate random BigUints and BigInts 2013-09-05 19:40:07 -05:00
bors
992b558d3c auto merge of #9004 : brson/rust/issue-8660, r=thestinger
The new scheduler makes better use of threads than the old.
2013-09-05 16:40:48 -07:00
Brian Anderson
738ec516f5 extra: Don't overcommit test tasks. Closes #8660
The new scheduler makes better use of threads than the old.
2013-09-05 16:37:10 -07:00
Gareth Smith
193a1c8af6 Replace os::glob with extra::glob, which is written in rust,
fixing issue #6100.
2013-09-05 21:19:47 +01:00
Florian Hahn
de39874801 Rename str::from_bytes to str::from_utf8, closes #8985 2013-09-05 14:17:24 +02:00
Daniel Micay
b49e9fa794 forbid cast as bool
This is currently unsound since `bool` is represented as `i8`. It will
become sound when `bool` is stored as `i8` but always used as `i1`.

However, the current behaviour will always be identical to `x & 1 != 0`,
so there's no need for it. It's also surprising, since `x != 0` is the
expected behaviour.

Closes #7311
2013-09-04 23:09:51 -04:00
bors
91922f04f8 auto merge of #8966 : FlaPer87/rust/issue/7473, r=bblum
Current access methods are nestable and unsafe. This patch renames
current methods implementation - prepends unsafe_ - and implements 2 new
methods that are both safe and un-nestable.

Fixes #7473
2013-09-04 08:50:57 -07:00
Daniel Micay
62a3434529 stop treating char as an integer type
Closes #7609
2013-09-04 08:07:56 -04:00
Flaper Fesp
d0ad251376 Use MuextArc and RWArc in docstrings 2013-09-04 09:14:56 +02:00
Flaper Fesp
c0aa62c872 Fixed docs and styles 2013-09-04 02:28:16 +02:00
Flaper Fesp
408367ba6d Add a safe implementation of MutexArc::access* methods
Current access methods are nestable and unsafe. This patch renames
current methods implementation - prepends unsafe_ - and implements 2 new
methods that are both safe and un-nestable.

Fixes #7473
2013-09-04 01:13:56 +02:00
Flaper Fesp
b22861d16d Rename MutexArc access methods to unsafe_access 2013-09-04 01:12:23 +02:00
bors
1ac8e8885b auto merge of #8884 : blake2-ppc/rust/exact-size-hint, r=huonw
The message of the first commit explains (edited for changed trait name):

The trait `ExactSize` is introduced to solve a few small niggles:

* We can't reverse (`.invert()`) an enumeration iterator
* for a vector, we have `v.iter().position(f)` but `v.rposition(f)`.
* We can't reverse `Zip` even if both iterators are from vectors

`ExactSize` is an empty trait that is intended to indicate that an
iterator, for example `VecIterator`, knows its exact finite size and
reports it correctly using `.size_hint()`. Only adaptors that preserve
this at all times, can expose this trait further. (Where here we say
finite for fitting in uint).

---

It may seem complicated just to solve these small "niggles",
(It's really the reversible enumerate case that's the most interesting)
but only a few core iterators need to implement this trait.

While we gain more capabilities generically for some iterators,
it becomes a tad more complicated to figure out if a type has
the right trait impls for it.
2013-09-03 06:56:05 -07:00
blake2-ppc
7c369ee733 std/extra: Add ExactSize for Bitv, DList, RingBuf, Option iterators 2013-09-01 18:20:24 +02:00
bors
c8db9e2638 auto merge of #8905 : sstewartgallus/rust/cleanup_tests, r=bblum
In this commit I:
- removed unneeded heap allocations
- added extra whitespace to crowded expressions
- and removed unneeded syntax

Also, CC @bblum although this change is fairly unobjectionable.
2013-08-31 12:40:40 -07:00
Steven Stewart-Gallus
e2f2a601e8 Cleanup concurrency tests
In this commit I:
- removed unneeded heap allocations
- added extra whitespace to crowded expressions
- and removed unneeded syntax
2013-08-31 11:26:01 -07:00
bors
5fe553d30f auto merge of #8862 : dcrewi/rust/drop-redundant-ord-impls, r=thestinger
If this were to break something, I would expect existing tests to catch it, and a `make check` run passes locally.
2013-08-30 20:30:35 -07:00
blake2-ppc
db22f2627d std: Implement .rposition() on double-ended iterators with known size
This is a generalization of the vector .rposition() method, to all
double-ended iterators that have the ExactSizeHint trait.

This resolves the slight asymmetry around `position` and `rposition`

* position from front is `vec.iter().position()`
* position from the back was, `vec.rposition()` is now `vec.iter().rposition()`

Additionally, other indexed sequences (only `extra::ringbuf` I think),
will have the same method available once it implements ExactSizeHint.
2013-08-30 20:06:26 +02:00
bors
0553618e08 auto merge of #8858 : blake2-ppc/rust/small-bugs, r=alexcrichton
Fix a bug in `s.slice_chars(a, b)` that did not accept `a == s.len()`.

Fix a bug in `!=` defined for DList.

Also simplify NormalizationIterator to use the CharIterator directly instead of mimicing the iteration itself.
2013-08-30 11:00:43 -07:00
David Creswick
b9601c48a5 partial revert of 31fa865
Ratio is generic and so might contain a non-total orderable type. It
should not use the default Ord implementation.
2013-08-29 17:52:22 -05:00
David Creswick
31fa86511c drop some redundant Ord method implementations 2013-08-29 14:24:24 -05:00
blake2-ppc
15bb9b4e1a extra::dlist: Fix bug in Eq::ne 2013-08-29 17:11:11 +02:00
Huon Wilson
4fea236a85 extra: error message should reflact that RUST_TEST_TASKS should be strictly positive (zero is illegal). 2013-08-29 22:58:27 +10:00
Huon Wilson
3f791acf4d Make the unit-test framework check RUST_TEST_TASKS over RUST_THREADS.
Fixes #7335.
2013-08-29 11:17:09 +10:00
Patrick Walton
aac9d6eee9 librustc: Fix merge fallout 2013-08-27 19:09:27 -07:00
Patrick Walton
2bd46e767c librustc: Fix problem with cross-crate reexported static methods. 2013-08-27 18:47:59 -07:00
Patrick Walton
4f32a2d854 librustc: Fix merge fallout. 2013-08-27 18:47:57 -07:00
Patrick Walton
8693943676 librustc: Ensure that type parameters are in the right positions in paths.
This removes the stacking of type parameters that occurs when invoking
trait methods, and fixes all places in the standard library that were
relying on it. It is somewhat awkward in places; I think we'll probably
want something like the `Foo::<for T>::new()` syntax.
2013-08-27 18:47:57 -07:00
Patrick Walton
5c3504799d librustc: Remove &const and *const from the language.
They are still present as part of the borrow check.
2013-08-27 18:46:51 -07:00
bors
3ab0561b00 auto merge of #8790 : huonw/rust/unsafearc, r=thestinger
`UnsafeAtomicRcBox` &rarr; `UnsafeArc` (#7674), and `AtomicRcBoxData` &rarr; `ArcData` to reflect this.

Also, the inner pointer of `UnsafeArc` is now `*mut ArcData`, which avoids some transmutes to `~`: i.e. less chance of mistakes.
2013-08-27 13:20:47 -07:00
Huon Wilson
71448d7c37 Rename UnsafeAtomicRcBox to UnsafeArc. Fixes #7674. 2013-08-27 20:12:39 +10:00
Flaper Fesp
cd92d2c77f Make rekillable consistent with unkillable
As for now, rekillable is an unsafe function, instead, it should behave
just like unkillable by encapsulating unsafe code within an unsafe
block.

This patch does that and removes unsafe blocks that were encapsulating
rekillable calls throughout rust's libs.

Fixes #8232
2013-08-27 00:34:16 +02:00
gifnksm
f8f17a39ce bigint: fix wrong benchmark fn name 2013-08-26 20:27:20 +09:00
gifnksm
084cfc10f5 bigint: Add benchmarks 2013-08-26 00:26:03 +09:00
gifnksm
fc41ba167c bigint: un-ignore test_shr 2013-08-25 23:55:12 +09:00
gifnksm
17c8f8bd0c bigint: inlining small functions 2013-08-25 22:47:24 +09:00
gifnksm
b247d17629 bigint: remove unnecessary method implements 2013-08-25 22:36:55 +09:00
gifnksm
36d698d544 bigint: cfg(target_arch = ...) => cfg(target_word_size = ...) 2013-08-25 22:24:52 +09:00
bors
6a649e6b8b auto merge of #8710 : pnkfelix/rust/fsk-issue5516-codepoint-fix, r=alexcrichton
...bytes.

(removing previous note about eff-eye-ex'ing #5516 since it actually does not do so, it just gets us half-way.)
2013-08-25 04:21:15 -07:00
Felix S. Klock II
ca0e7b12aa char_len is more succinct than count_chars. 2013-08-25 13:16:12 +02:00
bors
424e8f0fd5 auto merge of #8679 : singingboyo/rust/json-to-impl, r=alexcrichton
to_str, to_pretty_str, to_writer, and to_pretty_writer were at the top
level of extra::json, this moves them into an impl for Json to match
with what's been done for the rest of libextra and libstd.  (or at least for vec and str)

Also meant changing some tests.

Closes #8676.
2013-08-24 03:31:25 -07:00
Felix S. Klock II
cc477dfa74 Added note that there is still more to do on 5516.
Also added regression test for the byte vs codepoint issues that the
previous commit fixes.
2013-08-24 12:12:30 +02:00
bors
bb9c71fe82 auto merge of #8722 : graydon/rust/2013-08-23-test-shard, r=msullivan
This makes it relatively easy for us to split testsuite load between machines in buildbot. I've added buildbot-side support for setting up builders with -a.b suffixes (eg. linux-64-opt-vg-0.5, linux-64-opt-vg-1.5, linux-64-opt-vg-2.5, linux-64-opt-vg-3.5, linux-64-opt-vg-4.5 causes the valgrind-supervised testsuite to split 5 ways across hosts).
2013-08-24 02:21:27 -07:00
bors
c96b1d89c4 auto merge of #8716 : andrew-d/rust/andrew-fix-warnings, r=alexcrichton
Small, but whatever 🎱
2013-08-23 20:56:27 -07:00
Graydon Hoare
2fb5c49abb test: add support for sharding testsuite by passing --test-shard=a.b 2013-08-23 15:30:23 -07:00
Brian Anderson
74b2d9e19b rt: Remove last use of C++ exchange alloc 2013-08-23 14:46:23 -07:00
Andrew Dunham
347943640e Fix two small warnings 2013-08-23 17:26:52 -04:00
Felix S. Klock II
ae63a3e400 Make getopts count (and thus align/paginate) in terms of codepoints not bytes. 2013-08-23 18:31:13 +02:00
bors
9e1e152091 auto merge of #8596 : vadimcn/rust/master, r=alexcrichton
This resolves issue #908.  

Notable changes:
-  On Windows, LLVM integrated assembler emits bad stack unwind tables when segmented stacks are enabled.  However, unwind info directives in the assembly output are correct, so we generate assembly first and then run it through an external assembler, just like it is already done for Android builds.

- Linker is invoked  via "g++" command instead of "gcc": g++ passes the appropriate magic parameters to the linker, which ensure correct registration of stack unwind tables in dynamic libraries.
2013-08-22 21:06:25 -07:00