Commit Graph

16824 Commits

Author SHA1 Message Date
bors 17ab718d59 auto merge of #5698 : Thiez/rust/de-mutfielding, r=pcwalton
This pull request removes some mut-fields from at_vec, str, vec, unstable, and cell. Sadly in case of Cell this required using either transmute_mut (2 instances) or changing the interface. I chose the former. Perhaps it would be a good idea to merge Cell and Option, and take that opportunity to change the interface to use '&mut self' instead of '&self' (which would enable removing the transmutations) for take and put_back.

r?
2013-04-03 15:07:00 -07:00
Brett Cannon 8dd5a70ef4 Update tut. to not sound like I missed a section
The sentence "Remember that `(float, float)` is a tuple of two floats"
sounds like you've already read a section on tuples, but that section
comes later. Changing it to "Assuming that ..." makes it more about
taking the writer's word that the syntax is how tuples are defined.
2013-04-03 18:52:28 -03:00
bors 5b933aeba2 auto merge of #5696 : thestinger/rust/hashmap, r=sanxiyn
This naming is free now that `oldmap` has finally been removed, so this is a search-and-replace to take advantage of that. It might as well be called `HashMap` instead of being named after the specific implementation, since there's only one.

SipHash distributes keys so well that I don't think there will ever be much need to use anything but a simple hash table with open addressing. If there *is* a better way to do it, it will probably be better in all cases and can just be the default implementation. 

A cuckoo-hashing implementation combining a weaker hash with SipHash could be useful, but that won't be as general purpose - you would need to write a separate fast hash function specialized for the type to really take advantage of it (like taking a page from libstdc++/libc++ and just using the integer value as the "hash"). I think a more specific naming for a truly alternative implementation like that would be fine, with the nice naming reserved for the general purpose container.
2013-04-03 14:04:07 -07:00
Steve Klabnik 3044f5e2b6 typo fix: na -> an 2013-04-03 12:44:41 -07:00
Brian Anderson 34b2336dd0 Fix compiletest on windows 2013-04-03 11:54:49 -07:00
Steve Klabnik d79b22474c Add information about logging macros to the tutorial.
Closes #5699.
2013-04-03 11:40:23 -07:00
bors 6153aae809 auto merge of #5559 : jbclements/rust/change-to-tt-based-parsing, r=jbclements
Changes the parser to parse all streams into token-trees before hitting the parser proper, in preparation for hygiene.  As an added bonus, it appears to speed up the parser (albeit by a totally imperceptible 1%).

Also, many comments in the parser.
Also, field renaming in token-trees (readme->forest, cur->stack).
2013-04-03 11:31:03 -07:00
Jack Moffitt c4d2b7999a Add Clone derivation for std::net::url types. 2013-04-03 11:03:41 -06:00
Matthijs Hofstra 397a478528 Unstable didn't need transmute_mut after all. 2013-04-03 18:28:44 +02:00
Matthijs Hofstra c16919d3a8 Removing mut fields from vec.rs, at_vec.rs, str.rs, unstable.rs, and cell.rs. 2013-04-03 16:33:23 +02:00
Daniel Micay cc148b58ff rename Linear{Map,Set} => Hash{Map,Set} 2013-04-03 10:30:36 -04:00
Daniel Micay 44029a5bbc hashmap: rm linear namespace 2013-04-03 10:30:18 -04:00
bors 260d74dfcc auto merge of #5695 : bstrie/rust/noise, r=thestinger
With --opt-level=3, this version runs in 0.014s on my machine, compared to 0.252s for the previous version. Mostly due to the #[inline] on get().
2013-04-03 04:12:45 -07:00
Ben Striegel 84e5033466 Make bench/noise.rs more idiomatic and 20x faster 2013-04-03 06:54:14 -04:00
bors afd5cba38c auto merge of #5692 : Aatch/rust/tuple-clone, r=thestinger
This implements the clone interface for tuples and adds a test to match. The implementation is only on tuples that have elements that are themselves clone-able. This should allow for `#[deriving(Clone)] on nominal types that contain tuples somewhere.
2013-04-03 01:15:49 -07:00
James Miller e2bffb7971 Implement Clone for tuples 2013-04-03 19:43:23 +13:00
bors 0cc903015b auto merge of #5202 : dbaupp/rust/std-fileinput, r=graydon
As per https://github.com/mozilla/rust/wiki/Note-wanted-libraries.

Iterates over lines in a series of files, e.g. a basic `cat`

```rust
use std::fileinput;
fn main() {
    for fileinput::input |line| {
        io::println(line);
    }   
}
```

The API is essentially a subset of [Python's fileinput module](http://docs.python.org/3.3/library/fileinput.html), although the lack of default arguments and global mutable state means that there are extra functions to handle a few different cases (files from command line arguments, files from a vector, accessing current filename/line number).

A few points that possibly require adjustment:
- Most functions take vectors of `Path` (well, `Option<Path>`) rather than just `~str`, since this seems safer, and allows finer control without the number of different functions/methods increasing exponentially.
- `pathify` has a stupid name.
- I'm not quite sure how to mock tests that require external files: the tests in `libcore/io.rs` seem to indicate using a `tmp` subdirectory, so that's what I did, but I can't reliably build rust on this computer to test (sorry! although I have run the tests in just `fileinput.rs`  after creating `./tmp/` manually).
- The documentation I've written seems pretty crappy and not particularly clear.
- Only UTF8 files are supported.
2013-04-02 22:24:41 -07:00
bors 26d8b5188a auto merge of #5674 : steveklabnik/rust/improve_reader_util_docs, r=catamorphism
I filled out better descriptions for all of the necessary
functions.

r?
2013-04-02 21:18:43 -07:00
bors cb16cd9423 auto merge of #5673 : steveklabnik/rust/improve_io_docs, r=catamorphism
When I submitted #5659, it apparently caused some test failures. Then, because I left it in my incoming rather than making a new branch, I deleted my commit.

Let's try this again, this time, with its own branch so that I don't screw it up.

r?
2013-04-02 20:15:43 -07:00
Huon Wilson fea1380a9a libstd: make fileinput tests pass. 2013-04-03 13:38:06 +11:00
bors f357a03ce3 auto merge of #5685 : thestinger/rust/build, r=graydon 2013-04-02 17:48:46 -07:00
Huon Wilson 1e28d8fdb6 libstd: implement io::Reader for fileinput. 2013-04-03 11:36:05 +11:00
Huon Wilson e4edfa046a libstd: implement fileinput.
Iterate over lines in a series of files. API (mostly) adopted from
Python's fileinput module.
2013-04-03 11:36:05 +11:00
Steve Klabnik a3e2d6ea81 Remove excess trailing whitespace. 2013-04-02 17:31:42 -07:00
Steve Klabnik 86d5ce5cef remove trailing whitespace 2013-04-02 17:29:02 -07:00
Daniel Micay 88e4b5de83 install the librust{doc,pkg} host libraries 2013-04-02 19:25:03 -04:00
bors 5f13e9ccc2 auto merge of #5678 : Thiez/rust/no-Mut, r=thestinger
This pull request completely removes Mut<T> and the associated file (libcore/mutable.rs). Some minor changes were made to workcache (libstd/workcache.rs) as it was using Mut.

r?
2013-04-02 13:36:51 -07:00
Matthijs Hofstra f43e6af38d Removed libcore/mutable.rs, Mut<T> is now dead. 2013-04-02 21:15:23 +02:00
Matthijs Hofstra f2bc28c24f Removed all uses of Mut from workcache, replaced with @mut 2013-04-02 21:15:11 +02:00
Matthijs Hofstra ca52d08c4b Removed mut-fields from Mut, removed borrow_const from Mut 2013-04-02 20:47:29 +02:00
Graydon Hoare 00dbbd01c2 Update COPYRIGHT 2013-04-02 11:07:11 -07:00
Steve Klabnik 948ff6056f Typo fix. u8 -> i8 2013-04-01 18:20:30 -07:00
Steve Klabnik 1d658d9b97 Improve docs for Core::ReaderUtil.
I filled out better descriptions for all of the neccesary
functions.
2013-04-01 18:03:54 -07:00
bors 2815742ba5 auto merge of #5669 : graydon/rust/tweaks, r=thestinger
Just some minor cleanup of version strings and copyrights.
2013-04-01 18:00:43 -07:00
bors 78b53718a8 auto merge of #5667 : graydon/rust/remove-a-mode, r=catamorphism
It seems nobody can figure out whether this is _supposed to_ make a difference anymore, and in testing it seems to work either way, so I removed it. One less alarming warning during a fresh build.
2013-04-01 17:00:42 -07:00
Steve Klabnik a20d1ad0cb Improve documentation for core::io. 2013-04-01 16:37:40 -07:00
Graydon Hoare 951f460aa8 tidy version numbers and copyright dates 2013-04-01 16:15:49 -07:00
bors d1935898ed auto merge of #5662 : catamorphism/rust/docs, r=catamorphism
r? @brson
2013-04-01 16:03:47 -07:00
Tim Chevalier ce09645591 docs: Xfail test, it's just for illustration anyway 2013-04-01 15:21:22 -07:00
bors dc60788215 auto merge of #5660 : brson/rust/doc, r=catamorphism 2013-04-01 15:12:43 -07:00
Brian Anderson 243e601e51 doc: Update tutorial description of core 2013-04-01 14:30:14 -07:00
Brian Anderson 37634f3363 core: Update libc docs to clarify usage 2013-04-01 14:29:09 -07:00
Graydon Hoare 0647a0fc28 remove stray mode on callback, seems to not change anything 2013-04-01 14:18:07 -07:00
Tim Chevalier dbeea18fc5 docs: Document language items, as per #3342 2013-04-01 14:05:03 -07:00
bors 8e9fd72d05 auto merge of #5655 : thestinger/rust/arm, r=brson
Turns out @ isn't valid for the ARM assembler.
2013-03-31 21:54:41 -07:00
Daniel Micay 26fc76acb6 rt/arch/arm: fix syntax used for noexec stack 2013-04-01 00:31:22 -04:00
bors bd7eb7e0f9 auto merge of #5653 : brson/rust/warnings, r=brson 2013-03-31 20:36:40 -07:00
Brian Anderson e3327d3833 Fix warnings 2013-03-31 20:22:47 -07:00
bors be792589d0 auto merge of #5651 : luqmana/rust/incoming, r=thestinger
Change fn() -> &fn().
2013-03-31 19:33:40 -07:00
Luqman Aden d617030d63 Update tutorial.md
Change fn() -> &fn().
2013-03-31 18:34:51 -07:00