Commit Graph

2437 Commits

Author SHA1 Message Date
gareth
622bb6300f Update doc-comments to reflect the current year and trait
names now being capitalized.
2013-04-06 20:57:22 +01:00
gareth
e081c17805 Fix a bug where calling p.destroy() on the result of calling
start_program(...) would cause a segfault when p went
out of scope due to out_file/err_file being closed twice.
2013-04-06 20:57:21 +01:00
bors
d09835d2e3 auto merge of #5751 : metajack/rust/at-clones, r=thestinger
The borrowck-borrow-from-expr-block test had to be updated. I'm not sure why
it compiled before since ~int was already clonable.
2013-04-06 00:06:47 -07:00
Jack Moffitt
d375171fd4 Move tests inside clone.rs and fixed copyright headers. 2013-04-05 17:51:43 -06:00
Jack Moffitt
b22a06000d Implement Clone for @ and @mut types.
The borrowck-borrow-from-expr-block test had to be updated. I'm not sure why
it compiled before since ~int was already clonable.
2013-04-05 16:41:47 -06: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
bors
babe506333 auto merge of #5722 : metajack/rust/cell-with-ref-mut, r=catamorphism 2013-04-04 17:12:46 -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
Jyun-Yan You
fdf48a7b52 rt: improve mips backend 2013-04-04 18:53:58 +08: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
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
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
James Miller
e2bffb7971 Implement Clone for tuples 2013-04-03 19:43:23 +13: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
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
Matthijs Hofstra
f43e6af38d Removed libcore/mutable.rs, Mut<T> is now dead. 2013-04-02 21:15:23 +02:00
Matthijs Hofstra
ca52d08c4b Removed mut-fields from Mut, removed borrow_const from Mut 2013-04-02 20:47:29 +02: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
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
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
Marvin Löbel
df66e8d4a1 Fix underflow in char_range_at_reverse
Added char_range_at_reverse underflow test
2013-03-31 10:03:52 +02:00
bors
042a66514d auto merge of #5638 : luqmana/rust/5405, r=brson
#5405

Also, renames the confusingly named `use_new_rt` in `libcore/unstable/lang.rs`
2013-03-30 20:45:42 -07:00
Luqman Aden
74d20b46c5 Rename confusing var, use_new_rt -> use_old_rt. 2013-03-30 20:00:19 -07:00
Luqman Aden
eadd358b2a Correct type signature for start lang item. 2013-03-30 19:59:21 -07:00
Daniel Micay
258a36738e move dlist from core -> std
Closes #3549
2013-03-30 21:06:26 -04:00
bors
6dd20c8186 auto merge of #5630 : erickt/rust/serial, r=erickt
@nikomatsakis and I were talking about how the serializers were a bit too complicated. None of the users of With the `emit_option` and `read_option` functions, the serializers are now moving more high level. This patch series continues that trend. I've removed support for emitting specific string and vec types, and added support for emitting mapping types.
2013-03-30 15:42:43 -07:00
Niko Matsakis
6965fe4bce Add AbiSet and integrate it into the AST.
I believe this patch incorporates all expected syntax changes from extern
function reform (#3678). You can now write things like:

    extern "<abi>" fn foo(s: S) -> T { ... }
    extern "<abi>" mod { ... }
    extern "<abi>" fn(S) -> T

The ABI for foreign functions is taken from this syntax (rather than from an
annotation).  We support the full ABI specification I described on the mailing
list.  The correct ABI is chosen based on the target architecture.

Calls by pointer to C functions are not yet supported, and the Rust type of
crust fns is still *u8.
2013-03-29 18:36:20 -07:00
Erick Tryzelaar
0de7635f53 Merge remote-tracking branch 'remotes/origin/incoming' into serial 2013-03-29 17:48:44 -07:00
Patrick Walton
1e91595520 librustc: Remove fail_unless! 2013-03-29 16:39:08 -07:00
Erick Tryzelaar
31563f53d9 Merge remote-tracking branch 'remotes/origin/incoming' into serial 2013-03-29 09:06:36 -07:00
Erick Tryzelaar
ed62f6dfe0 core: add consume_reverse 2013-03-29 09:04:26 -07:00
Erick Tryzelaar
1dd11c7179 core: add LinearMap::with_capacity 2013-03-29 07:05:54 -07:00
bors
5da9e12778 auto merge of #5570 : alexcrichton/rust/fix-unused-imports, r=sanxiyn
Before it wouldn't warn about unused imports in the list if something in the list was used. These commits fix that case, add a test, and remove all unused imports in lists of imports throughout the compiler.
2013-03-29 05:57:44 -07:00
bors
7f2788112d auto merge of #5622 : yichoi/rust/pull-0329, r=catamorphism
libcore: language change minor fix for ARM & MIPS

fix context.rs
2013-03-29 04:42:43 -07:00
bors
4e830d11ba auto merge of #5618 : pcwalton/rust/print-in-prelude, r=brson
r? @brson
2013-03-29 01:09:49 -07:00
Young-il Choi
e6f2d7a48c libcore: language change minor fix for ARM & MIPS 2013-03-29 15:46:13 +09:00
Alex Crichton
be57d745d2 Removing unused imports 2013-03-28 23:56:46 -04:00
Erick Tryzelaar
bdf81e1184 core: Inline mallocing wrapper functions
As far as I can tell, this doesn't make rust compile any
faster, but it does at least remove one level of indirection
on malloc, which might help speed up some operations.
2013-03-28 20:34:33 -07:00
Patrick Walton
ef56aa62fb libcore: Add print and println to the prelude 2013-03-28 19:16:06 -07:00
bors
7a6cd2b21e auto merge of #5608 : erickt/rust/incoming, r=catamorphism
@nikomatsakis pointed out that `fn read_option<T>(&self, f: &fn() -> T) -> Option<T>` should have this syntax so it can work with custom option types: `fn read_option<T>(&self, f: &fn(bool) -> T) -> T`.

Also, this also includes some `#[inline(always)]` on the memory functions in `src/libcore/unstable/lang.rs` to reduce one level of indirection when allocating memory.
2013-03-28 19:06:48 -07:00
bors
5a97c484b1 auto merge of #5609 : Kimundi/rust/incoming, r=catamorphism 2013-03-28 14:42:49 -07:00
Marvin Löbel
eac2f3b93e Unbreak 'rustc --help' 2013-03-28 21:44:46 +01:00
Erick Tryzelaar
ce9e5ecb6c core: Inline mallocing wrapper functions
As far as I can tell, this doesn't make rust compile any
faster, but it does at least remove one level of indirection
on malloc, which might help speed up some operations.
2013-03-28 13:11:24 -07:00
Brian Anderson
145f66fdf0 Register snapshots 2013-03-28 12:40:57 -07:00
bors
b1c0a6628b auto merge of #5595 : catamorphism/rust/demoding, r=catamorphism 2013-03-28 04:54:45 -07:00
bors
e549b80e3c auto merge of #5587 : thestinger/rust/total, r=pcwalton
This is needed so that hash tables can require strict equality but not require types to be ordered. It's a subset of the functionality of `TotalOrd` so I made that inherit from `TotalEq`.
2013-03-28 02:36:49 -07:00
bors
d31053277a auto merge of #5586 : pcwalton/rust/expr-repeat-vstore, r=graydon
r? @graydon
2013-03-28 01:33:48 -07:00
bors
f7f6013a62 auto merge of #5574 : thestinger/rust/docstring, r=sanxiyn 2013-03-27 17:48:56 -07:00
Tim Chevalier
b0d1643fa6 core/std: Remove uses of ++ mode
from stackwalk::frame_address and net_tcp::on_tcp_read_cb
As per #4425
2013-03-27 17:14:10 -07:00
Daniel Micay
d2b267bcb5 add a TotalEq trait 2013-03-27 17:29:10 -04:00
Patrick Walton
e5dda811a9 librustc: Allow expr_repeat to be used with any vstore 2013-03-27 13:53:03 -07:00
Daniel Micay
91cb6687a8 cmp: rm TotalOrd impl code duplication 2013-03-27 14:17:16 -04:00
Niko Matsakis
069529bc5c Autoref the argument to the index operator (#4920) 2013-03-27 13:04:03 -04:00
Daniel Micay
9c1bbc586c ops: add a docstring 2013-03-27 03:42:03 -04:00
Daniel Micay
4d3b0a1529 hashmap: improve docstring 2013-03-27 03:42:00 -04:00
Patrick Walton
f41a510631 librustc: Remove obsolete syntax 2013-03-26 21:30:18 -07:00
Patrick Walton
0a4d0f37ca librustc: Enforce that extern mod directives come first, then use directives, then items.
Resolve them in this order as well.
2013-03-26 21:30:17 -07:00
Patrick Walton
8b56a8380b librustc: Modify all code to use new lifetime binder syntax 2013-03-26 21:30:17 -07:00
Patrick Walton
142dbd65da librustc: Remove all uses of the old [T * N] fixed-length vector syntax 2013-03-26 21:29:34 -07:00
Patrick Walton
0d52b22e7b libcore: Change [const T] to const [T] everywhere 2013-03-26 21:29:33 -07:00
bors
5df1aaab98 auto merge of #5414 : thestinger/rust/option, r=catamorphism 2013-03-26 20:18:54 -07:00
Daniel Micay
34c5a09ce3 option: rm functions that duplicate methods 2013-03-26 22:44:40 -04:00
bors
4cb5854d88 auto merge of #5560 : brson/rust/relnotes, r=brson
r?
2013-03-26 19:24:53 -07:00
bors
5011d05db2 auto merge of #5547 : catamorphism/rust/issue-4898, r=catamorphism 2013-03-26 17:54:53 -07:00
Alex Crichton
e4c3d805a4 syntax: Removing uses of HashMap 2013-03-26 19:20:02 -04:00
Alex Crichton
fa7772893a Remove unused imports throughout 2013-03-26 19:20:02 -04:00
Tim Chevalier
3ba7e041f1 core: As per #4898, finish impls for one-tuples 2013-03-26 16:08:05 -07:00
bors
3d588c5286 auto merge of #5555 : Kimundi/rust/str-dealloc-3, r=catamorphism
- Most functions that used to return `~[~str]` for a list of substrings got turned into iterators over `&str` slices
- Some cleanup of apis, docs and code layout
2013-03-26 15:07:07 -07:00
Brian Anderson
f792d177a4 core: Hide GC docs 2013-03-26 12:27:47 -07:00
bors
bbc4ca1349 auto merge of #5532 : brson/rust/coredocs, r=brson
r?
2013-03-26 12:16:19 -07:00
Brian Anderson
e5f8026eba core: Make sure every module at least has a one-line description 2013-03-26 11:48:22 -07:00
Brian Anderson
113fbfc795 core: Clarify prelude docs. #4556 2013-03-26 11:47:52 -07:00
Niko Matsakis
0dc6c414af Check for null in return_to_mut. Fixes #4904. 2013-03-26 14:12:13 -04:00
Marvin Löbel
de468c8cd2 Added more missing lifetime annotations 2013-03-26 19:07:14 +01:00
Marvin Löbel
c88a20d171 Added missing lifetime annotations, doc and whitespace cleanups 2013-03-26 16:24:15 +01:00
Marvin Löbel
06c371605b Fixed all use sites and tests 2013-03-26 14:59:17 +01:00
Marvin Löbel
c99488b3a4 Isolated bug, static vector seems to behave differently than fixed sized one 2013-03-26 14:59:17 +01:00
Marvin Löbel
b9de2b5787 Switched over a bunch of splitting funktions to non-allocating iterators 2013-03-26 14:59:17 +01:00
Marvin Löbel
d74606ead6 pre-rebase commit 2013-03-26 14:59:17 +01:00
Marvin Löbel
624a685283 Moved float str buffer constants to the strconv module 2013-03-26 14:59:17 +01:00
Felix S. Klock II
afaa48cfb5 Spelling fixes; replaced size with capacity in few places. 2013-03-26 14:18:48 +01:00
Felix S. Klock II
a266bda393 Fixes mozilla/rust#3612. 2013-03-26 14:18:48 +01:00
bors
125cdf52cd auto merge of #5542 : catamorphism/rust/issue-4983, r=catamorphism 2013-03-26 04:42:57 -07:00
bors
7481524978 auto merge of #5528 : thestinger/rust/find_mut, r=brson
This currently requires workarounds for the borrow checker not being flow-sensitive for `LinearMap` and `TrieMap`, but it can already be expressed for `TreeMap` and `SmallIntMap` without that.
2013-03-25 22:24:57 -07:00
bors
47ddb59b80 auto merge of #5525 : dbaupp/rust/minor_fixups, r=graydon
Kills some warnings, and implements str::each_char_reverse so that it actually iterates. The test case wasn't detecting a failure, since the loop body was never executed.
2013-03-25 21:18:57 -07:00
bors
00605d58de auto merge of #5513 : apasel422/rust/deriving, r=luqmana
This removes some explicit implementations of `Eq` in favor of `#[deriving(Eq)]` and derives `Clone` for a few core types.
2013-03-25 19:01:00 -07:00
Brian Anderson
30d4124a37 Merge remote-tracking branch 'brson/rt'
Conflicts:
	src/libcore/rt/context.rs
	src/libcore/rt/sched.rs
	src/libcore/rt/thread.rs
	src/libcore/rt/uv.rs
2013-03-25 12:28:54 -07:00
Tim Chevalier
6647150657 core: Fix doc comment error, as per #4983 2013-03-25 11:12:14 -07:00
Daniel Micay
e8bf0a4a49 trie: improve docstring 2013-03-25 00:22:23 -04:00
Daniel Micay
38f39ac540 expose find_mut in the Map trait 2013-03-24 21:40:16 -04:00
Daniel Micay
89e2578a9d trie: add find_mut method 2013-03-24 20:30:35 -04:00
Daniel Micay
d77433386b hashmap: add find_mut method 2013-03-24 19:19:38 -04:00
Daniel Micay
7948149456 treemap: add a find_mut method 2013-03-24 16:58:52 -04:00
Huon Wilson
29e8b6ea9b libcore: implement str::each_char_reverse correctly.
Previously, `each_char_reverse` was not iterating at all, so the
testcase never ran properly.
2013-03-25 01:17:40 +11:00
Huon Wilson
12df65470f Kill some warnings: unused imports and old #[deny(..)]s. 2013-03-25 01:17:23 +11:00
Andrew Paseltiner
45677eebf2 replace impls with deriving where applicable 2013-03-23 06:57:30 -04:00
Andrew Paseltiner
2b83defa4a core: derive Clone for core types 2013-03-23 06:54:13 -04:00
Patrick Walton
28efc234f4 libcore: Fix obsolete syntax in extfmt 2013-03-22 23:09:15 -07:00
Patrick Walton
6d81307a9b librustc: Add explicit lifetime binders and new lifetime notation in core/std/syntax/rustc 2013-03-22 22:24:35 -07:00
Patrick Walton
85c9fc6f8f librustc: Remove the const declaration form everywhere 2013-03-22 22:24:35 -07:00
Patrick Walton
eba3367404 libsyntax: Introduce the new assert! macro; make assert no longer a keyword 2013-03-22 22:24:34 -07:00
Patrick Walton
fa70709e07 libsyntax: Stop parsing pure and static 2013-03-22 22:24:33 -07:00
Daniel Micay
0c8c3b4232 trie: make the TrieSet impl public 2013-03-22 18:04:35 -04:00
Daniel Micay
55fbb9518b trie: inline the other TrieSet wrapper methods 2013-03-22 18:04:35 -04:00
Daniel Micay
04e367b353 trie: rm workaround for issue #3469 2013-03-22 18:03:55 -04:00
bors
e9b077c0e9 auto merge of #5488 : pcwalton/rust/depure, r=pcwalton 2013-03-22 13:00:56 -07:00
Patrick Walton
fbe22afdbe librustdoc: Remove pure from fuzzer and rustdoc. 2013-03-22 12:57:28 -07:00
Patrick Walton
be9bddd463 libcore: Remove pure from libcore. rs=depure 2013-03-22 10:29:17 -07:00
Patrick Walton
4634f7edae librustc: Remove all uses of static from functions. rs=destatic 2013-03-22 10:27:39 -07:00
bors
f011f928dd auto merge of #5463 : alexcrichton/rust/faster-fmt, r=graydon
This is a minor step towards #3571, although I'm sure there's still more work to be done. Previously, `fmt!` collected a bunch of strings in a vector and then called `str::concat`. This changes the behavior by maintaining only one buffer and appending directly into that buffer. This avoids doubly-allocating memory, and it has the added bonus of reducing some allocations in `core::unstable::extfmt`

One of the unfortunate side effects of this is that the `rt` module in `extfmt.rs` had to be duplicated to avoid `stage0` errors. Dealing with the change in conversion functions may require a bit of a dance when a snapshot happens, but I think it's doable.

If the second speedup commit isn't deemed necessary, I got about a 15% speedup with just the first patch which doesn't require any modification of `extfmt.rs`, so no snapshot weirdness.

Here's some other things I ran into when looking at `fmt!`:
* I don't think that #2249 is relevant any more except for maybe removing one of `%i` or `%d`
* I'm not sure what was in mind for using traits with #3571, but I thought that formatters like `%u` could invoke the `to_uint()` method on the `NumCast` trait, but I ran into some problems like those in #5462

I'm having trouble thinking of other wins for `fmt!`, but if there's some suggestions I'd be more than willing to look into if they'd work out or not.
2013-03-22 10:18:53 -07:00
bors
1616ffd0c2 auto merge of #5398 : dbaupp/rust/core-readlines, r=graydon
The `each_line` function in `ReaderUtil` acts very differently to equivalent functions in Python, Ruby, Clojure etc. E.g. given a file `t` with contents `trailing\nnew line\n` and `n` containing `no trailing\nnew line`:

Rust:
```Rust
t: ~[~"trailing", ~"new line", ~""]
n: ~[~"no trailing", ~"new line"]
```

Python:
```Python
>>> open('t').readlines()
['trailing\n', 'new line\n']
>>> open('n').readlines()
['no trailing\n', 'new line']
```

Ruby:
```Ruby
irb(main):001:0> File.readlines('t')
=> ["trailing\n", "new line\n"]
irb(main):002:0> File.readlines('n')
=> ["no trailing\n", "new line"]
```

Clojure
```Clojure
user=> (read-lines "t")
("trailing" "new line")
user=> (read-lines "n")
("no trailing" "new line")
```

The extra string that rust includes at the end is inconsistent, and means that it is impossible to distinguish between the "real" empty line a file that ends `...\n\n`, and the "fake" one after the last `\n`.

The code attached makes Rust's `each_line` act like Clojure (and PHP, i.e. not including the `\n`), as well as adjusting `str::lines` to fix the trailing empty line problem.

Also, add a convenience `read_lines` method to read all the lines in a file into a vector.
2013-03-22 09:24:53 -07:00
Alex Crichton
e93654c96d Pass the fmt! buffer to each conversion method
Achieves a little more speedup and avoids allocations around some strings in
conv_str
2013-03-22 11:49:45 -04:00
bors
d700500d0c auto merge of #5471 : erickt/rust/incoming, r=bstrie
I made a typo in `str::levdistance` in my str pull request. This fixes it.
2013-03-22 06:21:51 -07:00
Huon Wilson
429b8a9b9e libcore: handle trailing newlines more like other languages.
Specifically, `lines` and `each_line` will not emit a trailing empty string
when given "...\n". Also, add `read_lines`, which just collects all of
`each_line` into a vector, and `split_*_no_trailing` which will is the
generalised version of `lines`.
2013-03-23 00:15:05 +11:00
Andrew Paseltiner
98e8fe12d2 core: replace uses of old deriving attribute with new one 2013-03-22 06:24:19 -04:00
bors
9584c60871 auto merge of #5484 : pcwalton/rust/snapshots, r=pcwalton 2013-03-22 00:00:50 -07:00
Erick Tryzelaar
557b8cce8e core: fix a typo in levdistance 2013-03-21 20:45:37 -07:00
bors
d52408d46a auto merge of #5480 : pcwalton/rust/at-const, r=pcwalton
r? @catamorphism
2013-03-21 20:39:51 -07:00
bors
5f2d4102c5 auto merge of #5479 : Kimundi/rust/str-dealloc, r=z0w0
This makes the `trim` and `substr` functions return a slice instead of an `~str`, and removes the unnecessary `Trimmable` trait (`StrSlice` already contains the same functionality).

Also moves the `ToStr` implementations for the three str types into the str module in anticipation of further untangling.
2013-03-21 19:39:53 -07:00
Patrick Walton
e7dbe6cd6f librustc: Register new snapshots 2013-03-21 18:10:20 -07:00
Patrick Walton
02c49b32ca libsyntax: Remove @const from the language 2013-03-21 17:31:35 -07:00
Patrick Walton
d4fee24c7c librustc: Forbid destructors from being attached to any structs that might contain non-Owned fields. r=nmatsakis 2013-03-21 17:31:34 -07:00
bors
80d47fd11f auto merge of #5476 : thestinger/rust/bench, r=graydon
The old string benchmarks weren't very useful because the strings weren't long enough, so I just threw those out for now. I left out benchmarks of `oldmap` because it's clear that it's 30-40% slower and it doesn't implement the `Map` trait.

This also cleanly divides up `insert`, `search` and `remove`.
2013-03-21 17:00:57 -07:00
bors
ec8345b18a auto merge of #5407 : jbclements/rust/add-assert-eq-macro, r=jbclements
Adds an assert_eq! macro that asserts that its two arguments are equal. Error messages can therefore be somewhat more informative than a simple assert, because the error message includes "expected" and "given" values.
2013-03-21 15:24:54 -07:00
Marvin Löbel
0a47cd5ef1 Un-renamed trim and substr functions. 2013-03-21 23:06:05 +01:00
Marvin Löbel
ee2f3d9673 Switched over substr and trim functions in str to be non-allocating, temporary renamed them to better track use-sites 2013-03-21 23:06:04 +01:00
Daniel Micay
5d4063083b trie: make impl pub 2013-03-21 17:50:12 -04:00
Patrick Walton
efb5f8734a libcore: Remove a few possibly-cyclic imports in an effort to unbreak the tree on Linux 2013-03-21 08:06:20 -07:00
bors
b8899138f8 auto merge of #5466 : Kimundi/rust/view-slice-rename, r=bstrie
A slice now always refers to something that returns an borrowed pointer, views don't exist anymore. If you want to have an explictit copy of a slice, use `to_owned()`
2013-03-21 07:06:54 -07:00
Marvin Löbel
9d9a209e9a back-renamed slice_DBG_BRWD, slice_V_DBG_BRWD -> slice, slice_DBG_UNIQ -> slice_unique 2013-03-21 14:05:57 +01:00
Marvin Löbel
8f4448837b removed str::slice_DBG_UNIQ 2013-03-21 11:59:25 +01:00
bors
a8527e2e97 auto merge of #5456 : graydon/rust/fixups, r=pcwalton
Stage markers for stage3 and a trivial prelude fix.
2013-03-20 18:27:48 -07:00
Marvin Löbel
a7d296f24c renamed str::view -> slice_DBG_BRWD
renamed str::slice -> slice_DBG_UNIQ
changed vec slice method -> to_owned()
renamed vec view method  -> slice_V_DBG_BRWD
2013-03-21 01:50:32 +01:00
bors
b12714eff5 auto merge of #5455 : pcwalton/rust/framework, r=catamorphism
r? @catamorphism
2013-03-20 16:42:47 -07:00
John Clements
3cd65c233d change some uses of fail_unless to assert_eq 2013-03-20 16:05:59 -07:00
bors
6f3d1686b2 auto merge of #5447 : erickt/rust/incoming, r=graydon
This normalizes the how we call reverse iteration functions. It also adds a char_len method, and a method to iterate backwards over a string.
2013-03-20 15:30:50 -07:00
Patrick Walton
9c4d804cfe libsyntax: Never use ::<> in the type grammar 2013-03-20 13:54:25 -07:00
Graydon Hoare
9350d14ecb add stage3 markers where necessary for dist-snap 2013-03-20 13:48:57 -07:00
Graydon Hoare
bb9e1e2660 core: add Reader, Writer, ReaderUtil, WriterUtil to prelude. Close #4182. 2013-03-20 13:48:57 -07:00
Erick Tryzelaar
cefecd8601 core: add str::each{,i}_reverse 2013-03-20 07:53:23 -07:00
Erick Tryzelaar
8d5ab3061a core: add char_len method 2013-03-20 07:53:23 -07:00
Erick Tryzelaar
4b0f29a466 core: add char_at_reverse 2013-03-20 07:53:23 -07:00
Patrick Walton
ca3bc644f4 libcore: Make a couple of constructors public. rs=testfixing 2013-03-19 20:37:53 -07:00
Erick Tryzelaar
fe74a1c9a2 core: rename vec::rev_each{,i} to vec::each{,i}_reverse
I'm making this change because the _reverse suffix is more commonly
used in libcore/libstd.
2013-03-19 20:24:04 -07:00
Patrick Walton
e6f53c091e libsyntax: Forbid use (and most other things) within extern { ... } blocks 2013-03-19 18:00:18 -07:00
Patrick Walton
2e7ec80bcc librustc: Enforce privacy for static methods.
This starts moving a bunch of privacy checks into the privacy
checking phase and out of resolve.
2013-03-19 13:40:48 -07:00
Patrick Walton
e78f2e2ac5 librustc: Make the compiler ignore purity.
For bootstrapping purposes, this commit does not remove all uses of
the keyword "pure" -- doing so would cause the compiler to no longer
bootstrap due to some syntax extensions ("deriving" in particular).
Instead, it makes the compiler ignore "pure". Post-snapshot, we can
remove "pure" from the language.

There are quite a few (~100) borrow check errors that were essentially
all the result of mutable fields or partial borrows of `@mut`. Per
discussions with Niko I think we want to allow partial borrows of
`@mut` but detect obvious footguns. We should also improve the error
message when `@mut` is erroneously reborrowed.
2013-03-18 17:21:16 -07:00
Patrick Walton
c4db4faefa libsyntax: Stop parsing old lifetimes, except for the ones on data type declarations. 2013-03-18 17:21:15 -07:00
Patrick Walton
352c070365 librustc: Convert all uses of old lifetime notation to new lifetime notation. rs=delifetiming 2013-03-18 17:21:14 -07:00
Brian Anderson
5af5766512 core: Initialize global state lazily in the Scheduler ctor
I don't want any global one-time initalization functions because
that will make embedding harder.
2013-03-18 17:00:35 -07:00
Brian Anderson
044703435b Add a way to run the test suite with the new scheduler
TESTARGS=--newrt make check-stage1-rpass

Conflicts:
	src/rt/rustrt.def.in
2013-03-18 17:00:35 -07:00
Brian Anderson
a882554a78 core: Refactor uv bindings
I can already see these are going to get massive. Putting them into multiple
files.
2013-03-18 16:59:37 -07:00
Brian Anderson
7ef54c7ecd core: Begin uv file system bindings 2013-03-18 16:59:37 -07:00
Brian Anderson
57e85b5f94 core: Add rt::io and start sketching the API 2013-03-18 16:59:37 -07:00
Brian Anderson
9a075f264a core: Rename rt::io to rt::rtio
This is an internal interface. I want to use rt::io for public interfaces.
2013-03-18 16:59:37 -07:00
Brian Anderson
42cba98509 core: Convert some multiline statements to single-line 2013-03-18 16:59:37 -07:00
Brian Anderson
54bb7226e1 core: Simplify uvll bindings and strip out currently-unused bits
No more mapping uv structs to Rust structs
2013-03-18 16:59:37 -07:00
Brian Anderson
723d2247c1 core: Don't use printf in rtdebug!
The bots were showing a segfault that I can't reproduce. Assuming it's
varargs related so let's not use printf
2013-03-18 16:59:11 -07:00
Brian Anderson
d30c758974 Give core::rt and std::net their own uvll bindings
I intend to do some big refactoring and don't want to deal w/ std just now
2013-03-18 16:59:11 -07:00
Brian Anderson
e8ddef93da core: Cleanup rt::context 2013-03-18 16:59:10 -07:00
Brian Anderson
63d18658c1 rt: Add RUST_DEBUG_MEM to rust_env to avoid races 2013-03-16 14:25:44 -07:00
bors
ebba8b4e35 auto merge of #5408 : thestinger/rust/trie, r=pcwalton
The chunk fix is cherry picked from @graydon's `gc` branch.
2013-03-15 22:39:42 -07:00
bors
6f1e8ef71a auto merge of #5404 : bstrie/rust/decopy, r=pcwalton
Also turn `copy` into `.clone()` in much of run-pass.
2013-03-15 20:15:44 -07:00
Daniel Micay
d856215b92 add a test for the chunk function 2013-03-15 21:45:08 -04:00
Graydon Hoare
0942c80272 core: fix trie chunk function 2013-03-15 21:12:17 -04:00
Daniel Micay
98900d55e7 add constructor to TrieSet (was missing) 2013-03-15 21:03:29 -04:00
bors
4ad9e5c0c2 auto merge of #5396 : ILyoan/rust/fix_rt_tls, r=graydon
Add a conditional compile option for android
2013-03-15 17:18:44 -07:00
bors
6859a6d9a3 auto merge of #5391 : brson/rust/to-bytes, r=graydon
r?

I want to use this function as a method. There's probably a better way to design this but the existing `ToBytes` trait is not what I am looking for (it has a parameter to indicate the byte order).
2013-03-15 16:15:47 -07:00
Ben Striegel
748c2c9ebc impl Clone for ~T, ~[T], ~str 2013-03-15 18:26:59 -04:00
bors
c724dae7de auto merge of #5395 : thestinger/rust/iter, r=pcwalton 2013-03-15 09:21:56 -07:00
ILyoan
1a6a37e01a Fix an android compilation fail 2013-03-15 15:35:39 +09:00
Daniel Micay
a49ccee68e MutableIter impl for Option + use it in treemap 2013-03-14 23:44:25 -04:00
bors
73b253dc80 auto merge of #5371 : thestinger/rust/hidden, r=pcwalton 2013-03-14 20:06:44 -07:00
bors
c3fe0b97de auto merge of #5369 : thestinger/rust/iter, r=z0w0
This can eventually be implemented on other sequence containers like `deque` (it's missing `each` too at the moment).
2013-03-14 19:06:47 -07:00
Brian Anderson
38ac809cc7 core: Add to_bytes method to StrSlice trait 2013-03-14 18:08:55 -07:00
bors
4bf5ad63f0 auto merge of #5367 : brson/rust/5299, r=thestinger
r?
2013-03-14 17:51:47 -07:00
bors
0c7aeddb5f auto merge of #5365 : thestinger/rust/map, r=catamorphism 2013-03-14 15:06:49 -07:00
Patrick Walton
58f248d923 test: Fix tests. rs=tests 2013-03-13 20:08:35 -07:00
Patrick Walton
b1c699815d librustc: Don't accept as Trait anymore; fix all occurrences of it. 2013-03-13 20:07:09 -07:00
Daniel Micay
e4f5866c10 rm FIXME from use of #[doc(hidden)] on pub mod 2013-03-13 22:12:55 -04:00
Daniel Micay
968e0ddc60 hide the linkhack module in the docs 2013-03-13 22:12:43 -04:00
Daniel Micay
c64a5d2d37 add a trait for mutable iterators 2013-03-13 21:29:48 -04:00
Brian Anderson
34113dcf6a core: Add spawn, stream and friends to prelude. #5299 2013-03-13 18:17:12 -07:00
ILyoan
ef0364e9e4 Remove unused import in core 2013-03-14 09:52:51 +09:00
Daniel Micay
becad9bb07 add the mutate_values method to the Map trait 2013-03-13 19:33:10 -04:00
Niko Matsakis
852619d5d7 Remove ++ mode from the compiler (it is parsed as + mode)
and obsolete `-` mode altogether (it *was* parsed as `+` mode).
2013-03-13 17:00:09 -04:00
Niko Matsakis
efc7f82bc4 Revamp foreign code not to consider the Rust modes. This requires
adjusting a few foreign functions that were declared with by-ref
mode.  This also allows us to remove by-val mode in the near future.

With copy mode, though, we have to be careful because Rust will implicitly pass
somethings by pointer but this may not be the C ABI rules.  For example, rust
will pass a struct Foo as a Foo*.  So I added some code into the adapters to
fix this (though the C ABI rules may put the pointer back, oh well).

This patch also includes a lint mode for the use of by-ref mode
in foreign functions as the semantics of this have changed.
2013-03-13 16:59:37 -04:00
bors
695e9fd13c auto merge of #5293 : brson/rust/logging, r=brson
r? @graydon

This removes `log` from the language. Because we can't quite implement it as a syntax extension (probably need globals at the least) it simply renames the keyword to `__log` and hides it behind macros.

After this the only way to log is with `debug!`, `info!`, etc. I figure that if there is demand for `log!` we can add it back later.

I am not sure that we ever agreed on this course of action, though I *think* there is consensus that `log` shouldn't be a statement.
2013-03-13 10:40:07 -07:00
Brian Anderson
0ad3a110be Work around linkage bug cross-compiling from x86_64-apple-darwin to i686-apple-darwin
The correct opendir/readdir to use appear to be the 64-bit versions called
opendir$INODE64, etc. but for some reason I can't get them to link properly
on i686. Putting them in librustrt and making gcc figure it out works.
This mystery will have to wait for another day.
2013-03-12 21:01:40 -07:00
Patrick Walton
b60c3bfa4a libcore: Attempt to put out burning tree on Mac by using the old symbol on 32 bit. rs=bustage 2013-03-12 15:27:45 -07:00
Brian Anderson
806732a70b core: Turn off rtdebug logging 2013-03-12 13:05:45 -07:00
bors
b5334c3095 auto merge of #5333 : brson/rust/context, r=brson
ARM definitely compiles
2013-03-12 01:51:43 -07:00
bors
a95b933350 auto merge of #5328 : bstrie/rust/optadd, r=graydon
This will allow you to use the `+` operator to add together any two
Options, assuming that the contents of each Option likewise implement
`+`. So Some(4) + Some(1) == Some(5), and adding with None leaves the
other value unchanged.

This might be monoidic? I don't know what that word means!
2013-03-12 00:57:43 -07:00
Brian Anderson
e28d4b3516 core: Add context switching for ARM and MIPS
ARM definitely compiles
2013-03-11 23:33:05 -07:00
Brian Anderson
cb37d09f50 core: Remove logging constants 2013-03-11 23:19:42 -07:00
Brian Anderson
82f190355b Remove uses of log 2013-03-11 23:19:42 -07:00
Ben Striegel
a21b43c6bb Implement Add on Option types
This will allow you to use the + operator to add together any two
Options, assuming that the contents of each Option likewise implement
+. So Some(4) + Some(1) == Some(5), and adding with None leaves the
other value unchanged.

This might be monoidic? I don't know what that word means!
2013-03-11 22:46:16 -04:00
Brian Anderson
676e0290ed core: Add rt mod and add the new scheduler code 2013-03-11 19:44:29 -07:00
bors
a6bb4a0f1a auto merge of #5292 : thestinger/rust/nil, r=graydon 2013-03-11 17:27:43 -07:00
Brian Anderson
7e5995197f core: Convert obsolete fn syntax 2013-03-11 15:42:00 -07:00
Jeff Olson
3aa92a91c9 core: convert asserts to fail_unless! 2013-03-11 15:38:55 -07:00
Jeff Olson
5ff66f0405 core: link pthreads explicitly in linux build 2013-03-11 15:38:55 -07:00
Jeff Olson
cf82360e72 core: formatting appeasement 2013-03-11 15:38:55 -07:00
Jeff Olson
a04ba76f8e core: fix broken tests on windows 2013-03-11 15:38:55 -07:00
Jeff Olson
25c3c363a8 core: change import of exchange_alloc for win32 os::_list_dir 2013-03-11 15:38:55 -07:00
Jeff Olson
a69a2acfba rt/core: port os::list_dir to rust ref #4812 2013-03-11 15:38:55 -07:00
Jeff Olson
53db6c7e2a core: rt/core: impl os::env() in rust ref #4812 2013-03-11 15:38:55 -07:00
Jeff Olson
4bc26ce575 rt/core: impl os::getcwd() in rust ref #4812 2013-03-11 15:38:55 -07:00
bors
878a31066d auto merge of #5305 : brson/rust/mut_buf_as_slice, r=brson
r?

Like `buf_as_slice` but for mutable pointers and slices.
2013-03-11 14:06:50 -07:00
Brian Anderson
c88ce30c48 core: Add vec::raw::mut_buf_as_slice 2013-03-11 13:44:32 -07:00
Josh Matthews
86cf248262 Add deriving_eq to Cell. 2013-03-11 15:23:45 -04:00
Patrick Walton
08c840205e librustc: Lint the old drop destructor notation off 2013-03-11 09:36:00 -07:00
Patrick Walton
1274d4a006 test: Fix tests. rs=tests 2013-03-11 09:36:00 -07:00
Patrick Walton
4faf63e472 libstd: Remove all newtype enums from std and core. 2013-03-11 09:35:59 -07:00
Patrick Walton
bd2d17e4a1 libsyntax: Stop parsing bare functions in preparation for switching them over 2013-03-11 09:35:58 -07:00
Patrick Walton
d18f785457 librustc: Replace all uses of fn() with &fn(). rs=defun 2013-03-11 09:35:58 -07:00
Daniel Micay
80c71c839a add a TotalOrd impl for the unit type 2013-03-10 13:54:51 -04:00
Daniel Micay
788de758e3 vec: cleanup 2013-03-09 16:53:39 -05:00
Daniel Micay
06a336ae79 vec: renovate the BaseIter impl
* add 'self region to the borrowed pointer parameter
* rm workaround for #2263
* inline (wrappers)
* iter-trait is gone
2013-03-09 16:27:15 -05:00
Andrew Paseltiner
bef5396af6 core: implement Clone for primitive types 2013-03-09 12:14:12 -05:00
Ben Striegel
fdf69dd7b0 Finish de-implicit-selfing everything but the test suite 2013-03-08 19:34:39 -05:00
Daniel Micay
b69fb75348 implement BaseIter for dlist (removing iter-trait)
Closes #2827
2013-03-08 18:19:30 -05:00
Daniel Micay
cf9e958fe0 rm obsolete iter-trait/option.rs file 2013-03-08 12:34:43 -05:00
Alex Crichton
62651df2b4 Fix dvec-related fallout in tests 2013-03-08 09:56:52 -05:00
Alex Crichton
59de3853be core: Remove the dvec module 2013-03-08 09:54:41 -05:00
Alex Crichton
7ccb0e63c5 core: Remove uses of DVec in io/repr 2013-03-08 09:53:45 -05:00
Patrick Walton
d661711cc2 test: Fix tests. 2013-03-07 22:37:58 -08:00
Patrick Walton
d7e74b5e91 librustc: Convert all uses of assert over to fail_unless! 2013-03-07 22:37:57 -08:00
Patrick Walton
239e64242c libsyntax: Stop parsing structural record types 2013-03-07 22:32:52 -08:00
Patrick Walton
6b5d1afeec librustc: Remove "extern mod { ... }" from librustc, librustdoc, and tests. rs=deexterning 2013-03-07 22:32:52 -08:00
Patrick Walton
fd271adc75 libcore: Remove extern mod { ... } from libcore. rs=deexterning 2013-03-07 22:32:51 -08:00
bors
c3c018f8ab auto merge of #5256 : thestinger/rust/bool, r=brson 2013-03-06 19:12:40 -08:00
Niko Matsakis
3168fe06ff Add manual &self/ and &static/ and /&self declarations that
are currently inferred.  New rules are coming that will require
them to be explicit.  All add some explicit self declarations.
2013-03-06 15:12:57 -05:00
Daniel Micay
7782aa82d2 bool: make the from_str function a FromStr impl 2013-03-06 13:05:59 -05:00
bors
4b79a58d9d auto merge of #5252 : nikomatsakis/rust/issue-5087-make-trait-not-impl-self, r=pcwalton
Two changes:

- The first fixes an inconsistency in coherence whereby extension methods were added to the inherent methods table, but only in cross-crate scenarios.  This causes some minor fallout in tests and so forth.  In one case (comm) I added inherent and trait methods so as to avoid the need to import traits like `GenericPort` just to use a port.

- The second makes objects not implement the associated trait, as discussed in #5087.

r? @pcwalton
2013-03-06 09:27:59 -08:00
Niko Matsakis
6d764cc361 Make object types not implement associated trait. Fixes #5087. 2013-03-06 11:02:19 -05:00
Niko Matsakis
6267339d68 Fix bug in coherence that causes all cross-crate impls to be regarded as
inherent impls, not just those of the `impl Type` variety.
2013-03-06 11:02:19 -05:00
Ben Striegel
12f06bb496 Finish de-implicit-selifizng libcore 2013-03-06 04:00:25 -05:00
bors
959e483fb7 auto merge of #5235 : yjh0502/rust/io_float, r=graydon
When parsing bytes from a wire, there is a need to parse floating-point bytes to float values ([u8*4] to f32, [u8*8] to f64). This can be done via cast::transmute, but there is no way to do it safely.

It's quite common, so I think I't better to support it in core library.
2013-03-05 22:00:40 -08:00
Erick Tryzelaar
743cfce703 core: convert vec::{last,last_opt} to return references 2013-03-05 19:39:18 -08:00