Commit Graph

16756 Commits

Author SHA1 Message Date
bors
08e2cf846a auto merge of #5676 : nikomatsakis/rust/issue-4183-trait_ref, r=nikomatsakis
These are a number of incremental steps towards #4183 and #4646.
2013-04-05 18:00:52 -07:00
Niko Matsakis
13801f60b2 rustc: Be careful about calls to fn types that contain nested errors 2013-04-05 05:36:03 -04:00
Niko Matsakis
d7163985b8 Add comment explaining method visibility 2013-04-05 05:36:03 -04:00
Niko Matsakis
2a44a1bd97 Fix various warnings, NOTEs, etc 2013-04-05 05:36:03 -04:00
Niko Matsakis
d28f734412 Refactor so that references to traits are not represented using a type with a
bare function store (which is not in fact a kind of value) but rather
ty::TraitRef.  Removes many uses of fail!() and other telltale signs of
type-semantic mismatch.

cc #4183 (not a fix, but related)
2013-04-05 05:36:02 -04:00
Niko Matsakis
3333b0f117 Add a (currently unused) "transformed self type" pointer into ty::method 2013-04-05 05:36:02 -04:00
Niko Matsakis
0a0525e366 Pass around a pointer to the ty::method rather than the individual bits of info 2013-04-05 05:36:02 -04:00
Niko Matsakis
569596573a Compute a ty::method for methods that appear in impls as well 2013-04-05 05:36:02 -04:00
Niko Matsakis
007abe9352 Rather than storing a list of ty::method per trait, store one ty::method
per method and list of def-ids per trait.
2013-04-05 05:36:02 -04:00
Niko Matsakis
d94830830f Move the replacement of bound regions out from check_arguments and into check_call / method_resolution 2013-04-05 05:36:02 -04:00
Niko Matsakis
1745a2cd08 refactor check_call_inner to have a better name and be readable 2013-04-05 05:36:02 -04:00
bors
babe506333 auto merge of #5722 : metajack/rust/cell-with-ref-mut, r=catamorphism 2013-04-04 17:12:46 -07:00
bors
c08fb75dcd auto merge of #5431 : crabtw/rust/mips-rt, r=brson
Because the PTHREAD_STACK_MIN of my system is larger than default size, I add the stack_sz check to prevent assertion failure.

Besides, libuv has to be modified because some flags are different from other targets. Instead of using hardcoded numbers, I change them to predefined symbols.

By the way, the toolchain I used is http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/mips-gnu-linux

libuv patch: http://people.cs.nctu.edu.tw/~jyyou/rust/mips-uv.patch

Below is the current test result.

* core test

  stackwalk tests can cause segfault so I ignored them.

```
failures:
    io::tests::test_read_be_int_n
    io::tests::test_read_buffer_big_enough
    io::tests::test_read_f32
    io::tests::test_read_write_be
    io::tests::test_read_write_f32
    io::tests::test_read_write_le
    io::tests::test_simple
    io::tests::test_write_empty
    rand::tests::rng_seeded_custom_seed2
    unstable::uvll::test::test_uv_ll_struct_size_addrinfo
    unstable::uvll::test::test_uv_ll_struct_size_uv_timer_t

result: FAILED. 596 passed; 11 failed; 49 ignored
```

* std test:

```
failures:
    time::tests::run_tests

result: FAILED. 330 passed; 1 failed; 21 ignored
```
2013-04-04 15:36:58 -07:00
Jack Moffitt
2c02aab758 Add cell#with_mut_ref for handling mutable references to the content. 2013-04-04 11:34:35 -06:00
bors
717ed51f12 auto merge of #5716 : dhardy/rust/master, r=thestinger 2013-04-04 06:12:49 -07:00
Diggory Hardy
cb91e91418 Tutorial: rename variable to avoid confusion. 2013-04-04 15:08:25 +02:00
Jyun-Yan You
4f1d8cb6fc fix mac build and comment on stack size check 2013-04-04 18:53:58 +08:00
Jyun-Yan You
fdf48a7b52 rt: improve mips backend 2013-04-04 18:53:58 +08:00
Jyun-Yan You
99b156e78a mk: mips toolchain config 2013-04-04 18:52:24 +08:00
bors
b5d8224212 auto merge of #5713 : brson/rust/tutorial2, r=thestinger
It doesn't quite reflect reality
2013-04-04 02:18:47 -07:00
bors
1dc330c313 auto merge of #5707 : brettcannon/rust/patch-1, r=thestinger
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-04 01:21:50 -07:00
bors
21de574625 auto merge of #5703 : steveklabnik/rust/add_log_docs, r=thestinger
Closes #5699.
2013-04-04 00:18:45 -07:00
Brian Anderson
679b1dcb62 doc: Rewrite task tutorial intro
It doesn't quite reflect reality
2013-04-03 22:54:58 -07:00
bors
aa899c97d9 auto merge of #5710 : ajuckel/rust/patch-1, r=luqmana
One word typo fix
2013-04-03 22:30:45 -07:00
bors
af1baa3bef auto merge of #5691 : ILyoan/rust/main_name, r=thestinger
Existing rust code decides main name by host environment of rustc.
I think it should be chosen by build target.

This patch is also removing one of the android hacks that is not necessary any longer(I think it was not necessary from the first).
2013-04-03 21:39:47 -07:00
ILyoan
53232f7acf Fix fileinput test fail 2013-04-04 11:16:26 +09:00
ILyoan
fac0d9d89b Decides main name by target 2013-04-04 10:44:48 +09:00
ILyoan
f06404860c Remove a android hack 2013-04-04 10:44:48 +09:00
bors
783392f70f auto merge of #5704 : brson/rust/compiletest, r=luqmana 2013-04-03 17:57:48 -07:00
Anthony Juckel
e2c7a4def2 Simple typo fix 2013-04-03 19:10:09 -05:00
Steve Klabnik
a7f0bfbda6 One more typo: dubug -> debug 2013-04-03 16:59:13 -07:00
bors
84c296b27d auto merge of #5701 : metajack/rust/net-url-clone, r=thestinger 2013-04-03 16:06:48 -07:00
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