Commit Graph

1892 Commits

Author SHA1 Message Date
Daniel Micay
f82c96446f iterator: use an IteratorUtil trait 2013-04-15 21:35:41 -04:00
Huon Wilson
d3be98e9f5 libcore,std,syntax,rustc: move tests into mod tests, make them private (no pub mod or pub fn). 2013-04-16 09:57:47 +10:00
bors
dd2c7f61a9 auto merge of #5879 : astrieanna/rust/document_std_base64, r=catamorphism
This adds examples for the methods in std::base64.

Each example is complete in the sense that you can copy-paste it into a file and compile it successfully without adding anything (imports, etc). The hardest part of figuring out how to use this was figuring out the right import statements to put at the top.
2013-04-15 16:18:52 -07:00
Leah Hanson
b5c9990c38 Change to 4-space indents in code examples 2013-04-14 09:24:13 -04:00
Leah Hanson
ced12a74cd update copyright notice on base64.rs 2013-04-14 08:01:54 -04:00
Alex Crichton
52445129fd std: remove unused unsafe blocks/functions 2013-04-14 01:15:46 -04:00
Dan Luu
78bc10d94b Doc review, as requested :-).
Mostly just phrasing things differently, which is a matter of taste. Feel free to use or not use any of the changes I'm suggesting.

I would say this one thing should be changed, though, not necessarily the way I changed it here.

     * Convert any string (literal, `@`, `&`, `~`)
     * that contains a base64 encoded value, to the byte values it encodes.

If this structure is going to be used, either the entire clause, 'that contains a base64 encoded value', should be bracketed by commas, or the comma at the end of the clause should be removed.
2013-04-13 16:17:30 -04:00
Leah Hanson
8e64b61df9 move rustdoc comments so that they attach to the functions rather than the impl blocks. 2013-04-13 08:11:39 -04:00
Daniel Micay
8bf9fc52f4 initial iterator object library 2013-04-13 05:51:14 -04:00
Leah Hanson
27a0269501 Add comments for the implementations of from_base64 and to_base64 for . 2013-04-12 22:15:56 -04:00
bors
76f6606a8c auto merge of #5827 : nikomatsakis/rust/issue-5656-change-meaning-of-borrowed-self, r=pcwalton
See #5656 for details.

r? @pcwalton
2013-04-12 15:14:24 -07:00
Leah Hanson
2ec2d99bbd add rustdoc comments with examples for the string versions of to_base64 and from_base64 2013-04-12 09:41:07 -04:00
bors
2f8b36fc16 auto merge of #5819 : erickt/rust/incoming, r=erickt
Good morning,

This first patch series adds support for `#[deriving(Decodable, Encodable)]`, but does not yet remove `#[auto_encode]` and `#[auto_decode]`. I need a snapshot to remove the old code. Along the way it also extends support for tuple structs and struct enum variants.

Also, it includes a minor fix to the pretty printer. We decided a while ago to use 4 spaces to indent a match arm instead of 2. This updates the pretty printer to reflect that.
2013-04-11 06:55:01 -07:00
Niko Matsakis
03396473b8 libstd: changes to in response to #5656 2013-04-10 17:32:03 -07:00
Erick Tryzelaar
f3ab67ec5f syntax: add {read,emit}_enum_struct_variant{,_field} 2013-04-10 16:32:09 -07:00
Erick Tryzelaar
e31f7b7c74 std: add serialize {read,emit}_tuple{,_arg,_struct,_struct_arg} 2013-04-10 16:32:09 -07:00
Erick Tryzelaar
419f6acf0e std: rename {read,emit}_field to {read,emit}_struct_field 2013-04-10 16:08:22 -07:00
Erick Tryzelaar
97cc571358 std: clean up the order of {De,En}codable methods 2013-04-10 16:08:22 -07:00
Brian Anderson
23e44a529b Bump version to 0.7-pre 2013-04-10 13:12:53 -07:00
Niko Matsakis
5606fc0c90 Revert map.each to something which takes two parameters
rather than a tuple.  The current setup iterates over
`BaseIter<(&'self K, &'self V)>` where 'self is a lifetime declared
*in the each method*.  You can't place such a type in
the impl declaration.  The compiler currently allows it,
but this will not be legal under #5656 and I'm pretty sure
it's not sound now.
2013-04-10 07:51:48 -07:00
Brian Anderson
23251b2438 Bump version to 0.7-pre 2013-04-09 10:59:32 -07:00
Alex Crichton
255193cc1a Removing no longer needed unsafe blocks 2013-04-08 17:50:25 -04:00
Alex Crichton
3136fba5ae Removing some mutable fields in libstd 2013-04-08 17:50:14 -04:00
gifnksm
eebf29ed37 Impl cmp/num traits for BigUint, BigInt
TotalEq, TotalOrd, FromStrRadix, ToStrRadix.
2013-04-07 13:28:17 +09:00
Huon Wilson
c6949b3669 libstd: make complex.rs XXX's into issues and FIXME's 2013-04-05 19:26:58 +11:00
Huon Wilson
82d54602d7 libstd: add basic complex numbers 2013-04-05 18:19:50 +11:00
Huon Wilson
7b0401d774 libstd: add basic rational numbers 2013-04-05 17:54:11 +11:00
Huon Wilson
ba63cba18d libstd: move bigint to dedicated num directory 2013-04-05 17:36:24 +11:00
ILyoan
53232f7acf Fix fileinput test fail 2013-04-04 11:16:26 +09:00
bors
84c296b27d auto merge of #5701 : metajack/rust/net-url-clone, r=thestinger 2013-04-03 16:06:48 -07:00
Jack Moffitt
c4d2b7999a Add Clone derivation for std::net::url types. 2013-04-03 11:03:41 -06: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
Huon Wilson
fea1380a9a libstd: make fileinput tests pass. 2013-04-03 13:38:06 +11: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
Matthijs Hofstra
f2bc28c24f Removed all uses of Mut from workcache, replaced with @mut 2013-04-02 21:15:11 +02:00
Brian Anderson
e3327d3833 Fix warnings 2013-03-31 20:22:47 -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
Erick Tryzelaar
5b7d608bf6 std: add more json decoder tests. 2013-03-30 13:31:03 -07:00
Erick Tryzelaar
9bbf384058 std: clean up the json pretty printer tests 2013-03-30 11:08:57 -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
909d8f0eac std: Add Deque::eachi and a Deque serializer support 2013-03-29 18:02:44 -07:00
Erick Tryzelaar
0de7635f53 Merge remote-tracking branch 'remotes/origin/incoming' into serial 2013-03-29 17:48:44 -07:00
Erick Tryzelaar
e5c7a9e342 std: add serialization support for dlist, linearset, triemap, trieset, treemap, and treeset 2013-03-29 17:44:28 -07:00
Erick Tryzelaar
529ae38605 Merge remote-tracking branch 'remotes/origin/incoming' into serial 2013-03-29 17:41:32 -07:00
Patrick Walton
1e91595520 librustc: Remove fail_unless! 2013-03-29 16:39:08 -07:00
Brian Anderson
518c295a03 Register snapshots 2013-03-29 11:30:42 -07:00
Erick Tryzelaar
bdef3f1930 std: fix json deserializing vectors and a test 2013-03-29 09:10:31 -07:00
Erick Tryzelaar
31563f53d9 Merge remote-tracking branch 'remotes/origin/incoming' into serial 2013-03-29 09:06:36 -07:00
Erick Tryzelaar
d1a83e6986 std: add Encoder::emit_map and Decoder::read_map 2013-03-29 09:04:35 -07:00
Erick Tryzelaar
90b3658cd6 std: remove Encoder::read_rec and Decoder::emit_rec 2013-03-29 07:05:54 -07:00
Erick Tryzelaar
e99cdcfba8 std: remove Encoder::emit_tup{,_elt} and Decoder::read_tup{,_elt} 2013-03-29 07:05:54 -07:00
Erick Tryzelaar
590bbcebe9 std: remove Encoder::emit_{owned,managed}_vec and Decoder::read_{owned,managed}_vec 2013-03-29 07:05:54 -07:00
Erick Tryzelaar
63fc88757f std: remove Encoder::emit_{owned,managed} and Decoder::read_{owned,managed} 2013-03-29 07:05:54 -07:00
Erick Tryzelaar
8b43c620b9 std: remove Encoder::emit_{owned,managed}_str and Decoder::read_{owned,managed}_str 2013-03-29 07:05:54 -07:00
Erick Tryzelaar
2c658fabed std: remove prettyprint
Everyone uses fmt!("%?", ...) instead of the prettyprint
module, so I'm removing this file.
2013-03-29 07:05:54 -07:00
Alex Crichton
be57d745d2 Removing unused imports 2013-03-28 23:56:46 -04:00
Erick Tryzelaar
b05e148dc9 std: change Decoder::read_option to return a generic type
This allows read_option to be used with a custom option type instead
of just core::Option.
2013-03-28 20:34:33 -07:00
Erick Tryzelaar
aa779c1240 std: change Decoder::read_option to return a generic type
This allows read_option to be used with a custom option type instead
of just core::Option.
2013-03-28 13:11:24 -07:00
bors
b1c0a6628b auto merge of #5595 : catamorphism/rust/demoding, r=catamorphism 2013-03-28 04:54:45 -07:00
bors
84ddff3909 auto merge of #5578 : erickt/rust/incoming, r=jbclements,erickt
Hey folks,

This patch series does some work on the json decoder, specifically with auto decoding of enums. Previously, we would take this code:

```
enum A {
    B,
    C(~str, uint)
}
```

and would encode a value of this enum to either `["B", []]` or `["C", ["D", 123]]`. I've changed this to `"B"` or `["C", "D", 123]`. This matches the style of the O'Caml json library [json-wheel](http://mjambon.com/json-wheel.html). I've added tests to make sure all this work.

In order to make this change, I added passing a `&[&str]` vec to `Decode::emit_enum_variant` so the json decoder can convert the name of a variant into it's position. I also changed the impl of `Encodable` for `Option<T>` to have the right upper casing.

I also did some work on the parser, which allows for `fn foo<T: ::cmp::Eq>() { ... }` statements (#5572), fixed the pretty printer properly expanding `debug!("...")` expressions, and removed `ast::expr_vstore_fixed`, which doesn't appear to be used anymore.
2013-03-27 21:51:53 -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
Tim Chevalier
31f8093037 core: Remove unused import 2013-03-27 17:14:06 -07:00
Niko Matsakis
069529bc5c Autoref the argument to the index operator (#4920) 2013-03-27 13:04:03 -04:00
Erick Tryzelaar
c317d3f6fa std: add some better failure msgs to json 2013-03-27 07:04:17 -07:00
Erick Tryzelaar
4e9a63ff91 std: add tests for decoding json enums 2013-03-27 07:04:14 -07:00
Erick Tryzelaar
4d6dcefcbb std: Decode::read_enum_variant should pass in the variant names
Because the json::Decoder uses the string variant name, we need a
way to correlate the string to the enum index. This passes in a
static &[&str] to read_enum_variant, which allows the json::Decoder
to know which branch it's trying to process.
2013-03-27 07:04:13 -07:00
Erick Tryzelaar
478e4498b7 std: add option type directly to serialize::{En,De}code 2013-03-27 07:04:12 -07:00
Erick Tryzelaar
4d995e66a2 std: change default json enum encoder to use strings or a flat vec 2013-03-27 07:04:12 -07:00
Erick Tryzelaar
b10b8c3ee4 std: Add tests for json decoding options 2013-03-27 07:04:11 -07:00
Erick Tryzelaar
c9188c8301 std: fix json PrettyEncoder and add tests 2013-03-27 07:04:10 -07:00
Erick Tryzelaar
6cf99fa54a std: change fail_unless to assert_eq in json.rs 2013-03-27 07:04:09 -07:00
Erick Tryzelaar
89fc95885f std: serializing Options should use the right case 2013-03-27 07:02:59 -07:00
Erick Tryzelaar
b290863be6 std: clean json test imports 2013-03-27 07:01:50 -07:00
Daniel Micay
1c6272a267 base64: add docstring 2013-03-27 03:42:03 -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
Daniel Micay
34c5a09ce3 option: rm functions that duplicate methods 2013-03-26 22:44:40 -04:00
Alex Crichton
d69108d8f7 std: Remove the oldmap module 2013-03-26 19:21:05 -04:00
Alex Crichton
fa7772893a Remove unused imports throughout 2013-03-26 19:20:02 -04: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
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
bors
b48e6998d7 auto merge of #5509 : thestinger/rust/oldmap, r=brson
The reasoning for doing it this way is that it's much easier to transition method-by-method to the `Map` API than trying to do the migration all at once.

I found an issue unrelated to my changes in one of the run-fail tests - if it uses `LinearMap`, it still fails but exits with 0. I xfailed it for now and opened [an issue](https://github.com/mozilla/rust/issues/5512), because it's not caused by these changes.
2013-03-25 18:01:04 -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
Daniel Micay
38f39ac540 expose find_mut in the Map trait 2013-03-24 21:40:16 -04:00
Daniel Micay
f0f4a00e88 smallintmap: add find_mut method 2013-03-24 21:40:13 -04:00
Daniel Micay
7948149456 treemap: add a find_mut method 2013-03-24 16:58:52 -04: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
Daniel Micay
11ca2efce1 turn std::oldmap into a wrapper around LinearMap 2013-03-23 02:16:14 -04: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
Daniel Micay
705c796ffa remove obsolete purity workarounds 2013-03-22 18:08:56 -04:00
Patrick Walton
c1084091d4 libstd: Remove all uses of pure from libstd. 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
Andrew Paseltiner
4055fe83f6 std: 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
bors
334e921421 auto merge of #5481 : thestinger/rust/deque, r=z0w0 2013-03-21 21:57:52 -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
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
Daniel Micay
b2060174d4 deque: add a module docstring 2013-03-21 19:14:02 -04: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
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
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
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
Erick Tryzelaar
cefecd8601 core: add str::each{,i}_reverse 2013-03-20 07:53:23 -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
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
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
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
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
Ben Striegel
748c2c9ebc impl Clone for ~T, ~[T], ~str 2013-03-15 18:26:59 -04:00
Daniel Micay
2b6614f2e6 treemap: use each_mut instead of mutate 2013-03-15 14:14:03 -04:00
Daniel Micay
88278f9c35 treemap: rm old FIXME 2013-03-15 14:12:45 -04:00
Daniel Micay
b3ee49c7e2 deque: add documentation 2013-03-15 14:05:27 -04:00
Daniel Micay
a49ccee68e MutableIter impl for Option + use it in treemap 2013-03-14 23:44:25 -04:00
bors
0c7aeddb5f auto merge of #5365 : thestinger/rust/map, r=catamorphism 2013-03-14 15:06:49 -07:00
Patrick Walton
a410652bc9 librustc: Remove "base types" from the language. 2013-03-13 20:07:09 -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
ILyoan
278a4dbb0f Remove unused imports in std 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
bors
15d78fc398 auto merge of #5329 : wanderview/rust/std-getopts-opts_present, r=graydon
Currently the opts_present() function only checks to see if the option is
configured in the match, but doesn't actually check to see if the option
value has been set.  This means that opt_present('h') may return false while
opts_present([~'h']) returns true.

Add a test case to catch this condition and fix opts_present() to check
the value before returning true.

Note, there is another API difference between these two functions that this
does not address.  Currently if you pass a non-configured option to
opt_present() the program will fail!(), but opts_present() simply returns
false.  If it is acceptable to standardize on the fail!() then opts_present()
should probably be implemented in terms of the opt_present() function.
2013-03-12 09:21:56 -07:00
Brian Anderson
82f190355b Remove uses of log 2013-03-11 23:19:42 -07:00
bors
2fef18abf2 auto merge of #5310 : thestinger/rust/treeset, r=graydon 2013-03-11 22:09:43 -07:00
Ben Kelly
4f4f69d731 Fix std::getopts::opts_present() to check value.
Currently the opts_present() function only checks to see if the option is
configured in the match, but doesn't actually check to see if the option
value has been set.  This means that opt_present('h') may return false while
opts_present([~'h']) returns true.

Add a test case to catch this condition and fix opts_present() to check
the value before returning true.

Note, there is another API difference between these two functions that this
does not address.  Currently if you pass a non-configured option to
opt_present() the program will fail!(), but opts_present() simply returns
false.  If it is acceptable to standardize on the fail!() then opts_present()
should probably be implemented in terms of the opt_present() function.
2013-03-11 23:12:31 -04:00
Brian Anderson
676e0290ed core: Add rt mod and add the new scheduler code 2013-03-11 19:44:29 -07:00
Daniel Micay
9b1a9ec4ea treemap: fix a bug in the union implementation 2013-03-11 22:36:23 -04:00
Daniel Micay
2889a8a4e5 treemap: add more set tests 2013-03-11 22:36:23 -04:00
Daniel Micay
66afa5d17a treemap: refactor the set operation tests 2013-03-11 22:36:19 -04:00
Daniel Micay
d55225f04a treemap: add more tests for set difference 2013-03-11 15:02:55 -04:00
Daniel Micay
ad16fecc33 treemap: inline the TreeSet wrappers 2013-03-11 15:02:50 -04:00
Daniel Micay
a5c88366f8 treemap: indentation fixes 2013-03-11 15:02:18 -04:00
Daniel Micay
58cec70127 treemap: make set_advance public 2013-03-11 15:02:15 -04: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
Ben Kelly
13e58597a1 Correct copyright year to be 2012-2013.
Previous year range of 2011-2013 was based on file creation date.  The
check_license python script, however, only accepts copyrights starting
in 2012 or later.
2013-03-10 20:47:28 -04:00
Ben Kelly
a363862102 Fix formatting and errors in std::getopts example.
There were three issues effecting the example in the getopts rustdoc:

1. The blockquote was incorrectly formatted.  Fixed by switching to using
   an explicit markdown code section with ```.
2. The `fail fail_str(f)` would not compile.  Fixed by using `fail!()` instead
   of `fail`.
3. The line `matches.free[0]` produced a compile error about moving from
   an immutable vector.  Fix by using `copy`.
2013-03-10 17:27:31 -04:00
Alex Crichton
62651df2b4 Fix dvec-related fallout in tests 2013-03-08 09:56:52 -05:00
Alex Crichton
87f864292d std: Remove uses of DVec 2013-03-08 09:54:20 -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
6b5d1afeec librustc: Remove "extern mod { ... }" from librustc, librustdoc, and tests. rs=deexterning 2013-03-07 22:32:52 -08:00
Patrick Walton
87e44af2f2 libstd: Remove extern mod { ... } from libstd. rs=deexterning 2013-03-07 22:32:52 -08:00
Ben Striegel
0fed29cfb7 De-implicit-self libstd 2013-03-07 21:11:09 -05: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
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
Erick Tryzelaar
743cfce703 core: convert vec::{last,last_opt} to return references 2013-03-05 19:39:18 -08:00
Erick Tryzelaar
d6e583ab10 std: remove an unnecessary copy from workcache 2013-03-05 19:37:04 -08:00
bors
afd6196d7b auto merge of #5233 : bstrie/rust/deimpselfcore, r=graydon 2013-03-05 08:12:51 -08:00
bors
eddefbc893 auto merge of #5212 : thestinger/rust/iter, r=graydon
A small step towards fixing #2827
2013-03-05 02:06:50 -08:00
Ben Striegel
9db61e0c21 De-implicit-self libcore 2013-03-04 22:36:15 -05:00
Alex Crichton
cb4ab76e4a Adding missing imports for tests, and gate off others 2013-03-04 12:27:01 -05:00
Alex Crichton
dfb5c10dea Remove unused imports throughout src/ 2013-03-04 12:27:01 -05:00
Jyun-Yan You
5150b9811b rustc: MIPS32 support 2013-03-03 19:27:27 -08:00
Daniel Micay
af645e8487 replace option::iter with a BaseIter impl 2013-03-03 11:01:17 -05:00
Patrick Walton
a38cbebd8c libstd: Remove fn@, fn~, and fn& from libstd. rs=defun 2013-03-02 16:49:31 -08:00
Patrick Walton
a3f728238b librustc: Forbid chained imports and fix the logic for one-level renaming imports 2013-03-02 16:49:30 -08:00
bors
2304fe6208 auto merge of #5196 : thestinger/rust/ord, r=catamorphism
This allows `TreeMap`/`TreeSet` to fully express their requirements and reduces the comparisons from ~1.5 per level to 1 which really helps for string keys.

I also added `ReverseIter` to the prelude exports because I forgot when I originally added it.
2013-03-02 05:15:39 -08:00
Daniel Micay
035233a259 treemap: reimplement using TotalOrd 2013-03-02 14:10:19 -05:00
bors
5aca7d6aef auto merge of #5137 : yjh0502/rust/empty_struct, r=nikomatsakis
The fix is straight-forward, but there are several changes
while fixing the issue.

1) disallow `mut` keyword when making a new struct

In code base, there are following code,

```rust
struct Foo { mut a: int };
let a = Foo { mut a: 1 };
```

This is because of structural record, which is
deprecated corrently (see issue #3089) In structural
record, `mut` keyword should be allowd to control
mutability. But without structural record, we don't
need to allow `mut` keyword while constructing struct.

2) disallow structural records in parser level
This is related to 1). With structural records, there
is an ambiguity between empty block and empty struct
To solve the problem, I change parser to stop parsing
structural records. I think this is not a problem,
because structural records are not compiled already.

Misc. issues

There is an ambiguity between empty struct vs. empty match stmt.
with following code,

```rust
match x{} {}
```

Two interpretation is possible, which is listed blow

```rust
match (x{}) {} //  matching with newly-constructed empty struct
(match x{}) {}  //  matching with empty enum(or struct) x
                //  and then empty block
```

It seems that there is no such code in rust code base, but
there is one test which uses empty match statement:
https://github.com/mozilla/rust/blob/incoming/src/test/run-pass/issue-3037.rs

All other cases could be distinguished with look-ahead,
but this can't be. One possible solution is wrapping with
parentheses when matching with an uninhabited type.

```rust
enum what { }
fn match_with_empty(x: what) -> ~str {
    match (x) { //use parentheses to remove the ambiguity
    }
}
```
2013-03-02 04:21:38 -08:00
bors
36e898962d auto merge of #5185 : ben0x539/rust/net-tcp-docs, r=brson
This changes various type_names to TypeNames and fixes the example for `tcp::accept` that was still using the old `match` syntax and `{|args| ...}` closures.

The `accept` example was fairly outdated. I was just going to stay away from all the IO things until the scheduler revamp lands, but `accept` is probably one of the obvious starting points for networking stuff for a learner, and I don't want to get in the way of anyone's enthusiasm.

Doesn't touch non-comment lines, so I hope I will get away without learning about unit tests. It doesn't seem like the test system is set up to extract tests from doc comments right now.
2013-03-01 20:51:40 -08:00
Jihyun Yu
95bc9ea26d Remove REC, change related tests/docs 2013-03-02 12:57:05 +09:00
Brian Anderson
bcf626812b Rename core::private to core::unstable. #4743 2013-03-01 14:55:47 -08:00
Benjamin Herr
228e83888b std::net::tcp docs: Use current syntax and types
Doesn't touch non-comment lines. This changes various type_names to TypeNames
and fixes the example for `tcp::accept` that was still using the old
`match` syntax and `{|args| ...}` closures.
2013-03-01 22:32:24 +01:00
Patrick Walton
9519ee5d80 librustc: "APL2" -> "ASL2". rs=license-fix 2013-03-01 08:41:31 -08:00
Patrick Walton
c355f17943 Merge remote branch 'sevrak/issue-5164' into incoming 2013-03-01 08:39:02 -08:00
bors
a660bb362c auto merge of #5180 : catamorphism/rust/post-snapshot, r=catamorphism
* Disallow structural records everywhere
* Remove all #[cfg(stage0)] stuff
* Remove the last deprecated modes in libcore
* Un-xfail a test
2013-02-28 22:45:37 -08:00
bors
b7e72974dc auto merge of #5147 : nikomatsakis/rust/remove-legacy-trait-table, r=nikomatsakis
r? @pcwalton
2013-02-28 21:39:39 -08:00
Tim Chevalier
6b6d15ac20 Remove code that was awaiting a snapshot
* Disallow structural records everywhere
* Remove all #[cfg(stage0)] stuff
* Remove the last deprecated modes in libcore
* Un-xfail a test
2013-02-28 20:30:50 -08:00
Niko Matsakis
4ecb672d7f Remove legacy object creation mode, and convert remaining uses of it 2013-02-28 20:28:04 -05:00
bors
916d1a9165 auto merge of #5176 : brson/rust/unwrap_shared_mutable_state, r=nikomatsakis
r?

This fixes the current [random failures](http://buildbot.rust-lang.org/builders/auto-linux/builds/291/steps/test/logs/stdio) on the bots and closes #4436 by removing `unwrap_shared_mutable_state` and the code that depends on it. The result is that ARC-like things will not be unwrappable. This feature is complex and is not used outside of test cases.

Note that there is not consensus to remove it.

(second commit)
2013-02-28 17:21:40 -08:00
Brian Anderson
78d5091a4f core: Remove unwrap_shared_mutable_state. #4436 2013-02-28 15:20:40 -08:00
Alex Crichton
2df07ddc25 Fix implicit leaks of imports throughout libraries
Also touch up use of 'pub' and move some tests around so the tested functions
don't have to be 'pub'
2013-02-28 18:00:34 -05:00
Patrick Walton
2859c1ac6d librustc: Enforce cross-crate method privacy 2013-02-28 11:32:26 -08:00
Patrick Walton
107bf96ff0 librustc: Mark all type implementations public. rs=impl-publicity 2013-02-28 11:32:24 -08:00
sevrak
833ad6018e Fix license attribute on crates 2013-02-28 13:34:01 +00:00
bors
c705440ee3 auto merge of #5155 : bstrie/rust/dedrop, r=pcwalton
This removes all but 6 uses of `drop {}` from the entire codebase. Removing any of the remaining uses causes various non-trivial bugs; I'll start reporting them once this gets merged.
2013-02-27 23:30:40 -08:00
Ben Striegel
43d43adf6b Turn old drop blocks into Drop traits 2013-02-27 19:14:19 -05:00
bors
6ebc761f99 auto merge of #5140 : yjh0502/rust/issue_4458, r=catamorphism
Fix is a bug fix for issue #4458.

This patch is quite straight-forward. A test for result_str() is added.
2013-02-27 15:45:41 -08:00
Patrick Walton
07c3f5c0de librustc: Forbid pub or priv before trait implementations 2013-02-27 09:40:16 -08:00
Patrick Walton
573a31dfa7 libsyntax: Forbid mutable vectors. rs=demuting 2013-02-27 09:40:16 -08:00
Patrick Walton
8d7e6ef772 libsyntax: Forbid ~mut and ~const. rs=demuting 2013-02-27 09:40:15 -08:00
Jihyun Yu
5ae9b2949f Fix: now sha1 result_str() return correct value 2013-02-27 22:48:55 +09:00
bors
8e492ccaa7 auto merge of #5123 : thestinger/rust/treemap, r=nikomatsakis
* replace the dual next() and get() calls with a single next() function
* drop one of the pointer members from the struct
* add a method for using the lazy iterator with a for loop
2013-02-27 05:18:39 -08:00
Daniel Micay
5b0a2d1fc0 treemap: improve the lazy iterator
* replace the dual next() and get() calls with a single next() function
* drop one of the pointer members from the struct
* add a method for using the lazy iterator with a for loop
2013-02-27 05:30:15 -05:00
bors
0e6d895ed8 auto merge of #5119 : Kimundi/rust/incoming, r=catamorphism
Removed deprecated `str()` functions in int-template.rs and uint-template.rs
2013-02-26 10:54:39 -08:00
Marvin Löbel
42b0bacd76 Removed deprecated str() functions in int-template.rs and uint-template.rs 2013-02-26 16:38:30 +01:00
Patrick Walton
e2f90091cf libcore: Move Cell to core and de-~mut core and std 2013-02-26 04:18:12 -08:00
Patrick Walton
c483aab4ae librustc: Implement a lint mode for mutable structures; deny by default. r=tjc 2013-02-26 04:18:11 -08:00
Daniel Micay
1afddff97f remove oldsmallintmap
Closes #4738
2013-02-23 01:40:17 -05:00
bors
c316189d15 auto merge of #5081 : brson/rust/pipes, r=pcwalton
r?
2013-02-22 11:24:38 -08:00
Brian Anderson
dab6a85230 core: Extract comm from pipes. #4742 2013-02-21 17:36:54 -08:00
John Clements
27b06777e6 Cleanup, commenting, trivial renaming 2013-02-21 16:17:06 -08:00
Patrick Walton
c0defda499 librustc: Separate the rest of the trait bounds with + and stop parsing space-separated ones. rs=plussing 2013-02-21 08:29:48 -08:00
Patrick Walton
bf2a225c0b librustc: Separate most trait bounds with '+'. rs=plussing 2013-02-20 21:14:20 -08:00
Graydon Hoare
acc147769e std: update rand-using tests, r=burningtree 2013-02-19 07:38:18 -08:00
bors
6351515d98 auto merge of #5005 : alexcrichton/rust/bitv++, r=catamorphism
These commits take the old bitv implementation and modernize it with an explicit self, some minor touchups, and using what I think is some more recent patterns (like `::new` instead of `Type()`).

Additionally, this adds an implementation of `container::Set` on top of a bit vector to have as a set of `uint`s. I initially tried to parameterize the type for the set to be `T: NumCast` but I was hitting build problems in stage0 which I think means that it's not in a snapshot yet, so it's just hardcoded as a set of `uint`s now. In the future perhaps it could be parameterized. I'm not sure if it would really add anything, though, so maybe it's nicer to be hardcoded anyway.

I also added some extra methods to do normal bit vector operations on the set in-place, but these aren't a part of the `Set` trait right now. I haven't benchmarked any of these operations just yet, but I imagine that there's quite a lot of room for optimization here and there.
2013-02-18 18:40:33 -08:00
Alex Crichton
cf2ddf0437 Add benchmarks to measure differences in bit vectors 2013-02-18 01:24:14 -05:00
Alex Crichton
bf8ed45adc Implement Set container on top of a bit vector 2013-02-17 23:09:21 -05:00
Alex Crichton
393a4b41f6 Favor local closures instead of global functions 2013-02-17 23:09:21 -05:00
Alex Crichton
dc7e6abab7 Remove the 'uint_bits' constant in bitv 2013-02-17 23:09:21 -05:00
Alex Crichton
a01ef8ef87 Change SmallBitv to use uint instead of u32 2013-02-17 23:09:20 -05:00
Alex Crichton
91fae27912 Modernize bitv mut fields and explicit self 2013-02-17 23:09:20 -05:00
Daniel Micay
6956e81c9b vec: grow_fn doesn't require Copy 2013-02-17 14:09:09 -05:00
bors
a6945f2a45 auto merge of #4993 : thestinger/rust/deque, r=graydon
Closes #3748 and #2343.
2013-02-16 23:30:38 -08:00
Seth Pink
60bd4a5385 Removed more capture claueses. 2013-02-17 12:41:45 +10:00
Daniel Micay
8b38e07f24 deque: get rid of Copy requirement
Closes #3748
2013-02-16 21:35:09 -05:00
Daniel Micay
5aa0463564 deque: avoid Copy in grow 2013-02-16 21:34:09 -05:00
Daniel Micay
a257329071 deque: avoid Copy for get 2013-02-16 20:51:04 -05:00
Seth Pink
1f4c758f9b Remove use of capture clause #4965 2013-02-17 11:02:23 +10:00
Daniel Micay
6190661018 deque: avoid Copy in pop_{front,back} 2013-02-16 19:44:58 -05:00
Daniel Micay
373c072e83 deque: avoid Copy in peek_{front,back} 2013-02-16 19:10:10 -05:00
Daniel Micay
5929f15999 deque: avoid Copy in the get function 2013-02-16 19:05:27 -05:00
Daniel Micay
5832fe968f deque: separate the methods that need Copy 2013-02-16 19:00:51 -05:00
Daniel Micay
15879d3f74 deque: rm old return statements 2013-02-16 18:57:45 -05:00
Daniel Micay
ed7c9c4e2a add a Mutable implementation (clear) to std::deque 2013-02-16 18:57:01 -05:00
Daniel Micay
b47e1e9eda modernize std::deque
* use a proper exported data type with private fields
* implement core::container::Container
* use the current constructor convention
* use explicit self
* get rid of DVec and the mutable fields

Closes #2343
2013-02-16 18:20:54 -05:00
Graydon Hoare
585d6f7b00 rustpkg: Massage for landing. 2013-02-15 18:50:51 -08:00
Zack Corr
b10dc1af06 Move semver to std and finish rustpkg 2013-02-15 18:04:10 -08:00
Zack Corr
2192d11cd1 Correct Zack Corr's email in AUTHORS.txt 2013-02-15 18:04:10 -08:00
Patrick Walton
bb833ca0f0 librustc: Stop parsing impl Type : Trait and fix several declarations that slipped through. r=tjc 2013-02-15 16:59:56 -08:00
bors
566bcf2225 auto merge of #4969 : nickdesaulniers/rust/issue3869, r=brson
Issue #3869
review? @nikomatsakis 

Convert all uses of vec::slice to vec::view Issue #3869
Rename const_view to const_slice
Renamed mut_view to mut_slice
Fix windows build error.  `buf` is borrowed by the call to
`as_mut_buf()` and so we must invoke `slice()` outside of that
call.
2013-02-15 13:54:49 -08:00
Luqman Aden
03757482f0 libstd: Fix broken test. 2013-02-15 02:49:54 -08:00
Luqman Aden
4cf51c2531 libstd: Get rid of move. 2013-02-15 02:49:54 -08:00
bors
20fd0c53ed auto merge of #4938 : thestinger/rust/no_zero, r=brson
I removed the unused wrappers methods named `calloc` because they relied on the malloc wrapper having a `bool zero = true` default parameter (which resulted in some accidental zeroing). Perhaps wrapping the actual calloc function would be useful, but I don't know of an existing use case that could use it so I just removed these.

This gives an ~1% performance improvement for TreeMap, which does a lot of small allocations. Vectors use `realloc` which didn't zero before these changes so there's no measurable change in performance.
2013-02-14 18:27:54 -08:00
bors
af2f0ef088 auto merge of #4927 : sanxiyn/rust/remove-dvec, r=catamorphism 2013-02-14 17:23:18 -08:00
Nick Desaulniers
5d62a4a52e Convert all uses of vec::slice to vec::view Issue #3869
Rename const_view to const_slice
Renamed mut_view to mut_slice
2013-02-14 16:14:32 -08:00
bors
3c07d037cd auto merge of #4934 : nickdesaulniers/rust/issue4524cleanup, r=brson
review? @brson
Issue #4524
2013-02-14 15:37:48 -08:00
Daniel Micay
f2f4edd8a7 fix bug in uv_ll tests uncovered by not zeroing 2013-02-14 17:47:15 -05:00
Patrick Walton
9143688197 librustc: Replace impl Type : Trait with impl Trait for Type. rs=implflipping 2013-02-14 14:44:12 -08:00
Nick Desaulniers
4699ac67c6 Remove all final references to die! 2013-02-14 13:09:09 -08:00
Seo Sanghyeon
26697c371d Remove DVec from workcache 2013-02-14 23:12:12 +09:00
Seo Sanghyeon
9324f497b2 Remove DVec from json 2013-02-14 22:51:01 +09:00
Nick Desaulniers
4445b38df2 Remove die!, raplace invocations with fail! Issue #4524 pt 3 2013-02-13 17:01:32 -08:00
bors
d5bf3b85d1 auto merge of #4908 : bstrie/rust/rimov3, r=pcwalton
This patch finishes removing inner vector mutability from the vast majority of the compiler. Exceptions:

* core::dvec: ideally this entire type will be able to be replaced by `~[]`, but Niko asked me to hold off on removing Dvecs until he makes some fixes to borrowed pointers. 
* liveness: liveness.rs is an impenetrable neutron star of deprecated semantics.
* compile-fail: I'm not sure if a lot of these tests are testing inner mutability or mutability in general. I figure that RIMOVing this folder should wait until this syntax is removed from the parser.

I also took this chance to remove many of the inner-mutability-related functions from core::vec, or as many uses of those functions as possible where still necessary. consume_mut and append_mut have been axed. cast_to_mut and cast_from_mut are still needed in a few places.
2013-02-13 15:09:07 -08:00
bors
5e6d7871c6 auto merge of #4840 : jbclements/rust/add-json-enum-encoding, r=catamorphism
r?

I added code to the JSON encoder to support the serialization of enums.  Before this, the JSON serializer only handled Option, and encoded None as 'null'. Following this change, all enums are encoded as arrays containing the enum name followed by the encoded fields. This appears consistent with the unstated invariant that the resulting output can be mapped back to the input *if* there's a decoder around that knows the types that were in existence when the serialization occurred.

Also, added test cases.
2013-02-13 13:18:38 -08:00
Graydon Hoare
e5aa399e0d rustc and std: teach about #[bench], modernize to use quote_expr! some. 2013-02-13 11:46:25 -08:00
Graydon Hoare
ebe99637fd std: add stats. 2013-02-13 11:46:25 -08:00
Ben Striegel
e6c82c0375 RIMOV core::vec
Also remove as many uses as possible of vec::cast_to_mut and
cast_from_mut
2013-02-13 12:48:24 -05:00
Niko Matsakis
ab2534974c Adjust borrow checker algorithm to address #4856 unsoundness,
and then adjust code to match. rs=unsound (will review post-landing)
2013-02-12 20:10:50 -08:00
bors
210fa2d017 auto merge of #4874 : thestinger/rust/option, r=catamorphism 2013-02-12 10:35:12 -08:00
Brian Anderson
9701517703 std: Fix uv_tcp_t size on i686-apple-darwin 2013-02-11 19:24:35 -08:00
Brian Anderson
b126c742e5 Merge remote-tracking branch 'thestinger/treemap' 2013-02-11 16:13:50 -08:00
Daniel Micay
f9c7ba009b treemap: cut down on swap_unwrap in remove
Performance before:

    std::treemap::TreeMap
                   sequential_ints 0.083971 s
                       random_ints 0.095861 s
                       delete_ints 0.083931 s
                sequential_strings 0.278272 s
                    random_strings 0.240286 s
                    delete_strings 0.173581 s

Performance after:

    std::treemap::TreeMap
                   sequential_ints 0.083297 s
                       random_ints 0.097644 s
                       delete_ints 0.052602 s
                sequential_strings 0.287326 s
                    random_strings 0.242372 s
                    delete_strings 0.142269 s
2013-02-10 22:03:26 -05:00
Daniel Micay
b0f58f6e68 avoid explicit reborrow in heir_swap 2013-02-10 21:11:33 -05:00
Daniel Micay
195a969bb3 treemap: avoid swap_unwrap in insert
Performance before:

    std::treemap::TreeMap
                   sequential_ints 0.151877 s
                       random_ints 0.160926 s
                       delete_ints 0.08694 s
                sequential_strings 0.316458 s
                    random_strings 0.290778 s
                    delete_strings 0.169892 s

Performance after:

    std::treemap::TreeMap
                   sequential_ints 0.083971 s
                       random_ints 0.095861 s
                       delete_ints 0.083931 s
                sequential_strings 0.278272 s
                    random_strings 0.240286 s
                    delete_strings 0.173581 s
2013-02-10 20:49:44 -05:00
Daniel Micay
f9c15de1fd treemap: use an &mut parameter for skew and split
results in a small performance improvement and reduces the compiled
code size
2013-02-10 20:47:22 -05:00
Jeff Olson
4696fb367c std: fix libuv structs on macos 2013-02-10 14:30:07 -08:00
Daniel Micay
99ff74c1bd make Option's iter method use a lifetime 2013-02-10 16:30:17 -05:00
Jeff Olson
73507c1961 std: strip sillyness from debug comment in iotask teardown 2013-02-10 11:51:05 -08:00
Jeff Olson
dfcdb6eb72 rt/std: update of libuv API glue for libuv submodule update 2013-02-10 11:51:05 -08:00
John Clements
c05954a76b added issue for reference in FIXME 2013-02-10 11:25:46 -08:00
bors
2fc1f41d0d auto merge of #4827 : mcpherrinm/rust/master, r=catamorphism
It seems to me the library needs more work to be done, but having a non-compilable sample program seems like bad news.
2013-02-09 17:28:04 -08:00
bors
d6442e97a5 auto merge of #4854 : thestinger/rust/oldmap, r=catamorphism 2013-02-09 15:02:51 -08:00
John Clements
7736ed6c62 json tidy 2013-02-09 13:37:05 -08:00
John Clements
c952c04462 re-special-case Option in JSON encoding 2013-02-09 13:37:05 -08:00
John Clements
f91160b687 json add enum encoder test case 2013-02-09 13:37:04 -08:00
John Clements
0e9495b980 json bugfix 2013-02-09 13:37:04 -08:00
John Clements
394f8eeb7e tidy 2013-02-09 13:37:04 -08:00
John Clements
fe82374328 json bugfixes 2013-02-09 13:37:04 -08:00
John Clements
765961438d fix typos in sample code, add enum to json encoder, add test case 2013-02-09 13:37:04 -08:00
bors
d90abd5879 auto merge of #4848 : nikomatsakis/rust/issue-4821-bad-kind-computation, r=catamorphism
...ear

values to be copied.  Rewrite kind computation so that instead of directly
computing the kind it computes what kinds of values are present in the type,
and then derive kinds based on that. I find this easier to think about.

Fixes #4821.

r? @catamorphism
2013-02-09 10:20:55 -08:00
Matthew McPherrin
0a062b50f1 Remove trailing whitespace 2013-02-08 20:17:50 -05:00
Daniel Micay
94fd95a4f1 oldmap: rm unneeded unsafe 2013-02-08 19:30:54 -05:00
Daniel Micay
0127828b5b oldmap: separate out the methods that need Copy 2013-02-08 19:20:36 -05:00
Daniel Micay
a32c5c73ee oldmap: get rid of legacy _ref suffixes 2013-02-08 19:12:51 -05:00
Matthew McPherrin
46df7985a5 Merge branch 'master' of https://github.com/mozilla/rust 2013-02-08 15:21:46 -05:00
Niko Matsakis
a380df809c Fix subtle error in caching during kind computation that could cause linear
values to be copied.  Rewrite kind computation so that instead of directly
computing the kind it computes what kinds of values are present in the type,
and then derive kinds based on that. I find this easier to think about.

Fixes #4821.
2013-02-08 07:20:39 -08:00
Daniel Micay
8c32cd2dc8 fix map tests 2013-02-07 22:58:16 -05:00
Daniel Micay
9599cc86f0 implement BaseIter for LinearMap 2013-02-07 22:28:58 -05:00
Daniel Micay
fe841f3e56 implement ReverseIter for SmallIntMap 2013-02-07 22:04:38 -05:00
Daniel Micay
a2f922f282 implement ReverseIter for TreeMap and TreeSet 2013-02-07 22:04:38 -05:00
Daniel Micay
66d5030763 implement BaseIter for SmallIntMap 2013-02-07 22:04:38 -05:00
Daniel Micay
e018244777 make Option's map and map_default use a lifetime 2013-02-07 22:04:38 -05:00
Daniel Micay
f6e0df6563 implement BaseIter for TreeMap 2013-02-07 22:04:37 -05:00
Daniel Micay
83270d2d79 rm each method from the Map trait
the map types should implement BaseIter instead
2013-02-07 22:04:35 -05:00
Daniel Micay
d903231f1e add a BaseIter implementation for PriorityQueue 2013-02-07 20:18:15 -05:00
Patrick Walton
472797b04a librustc: Lots of de-muting. rs=demuting 2013-02-07 16:17:39 -08:00
bors
37a610a7d9 auto merge of #4831 : bjz/rust/incoming, r=pcwalton
This is useful for comparing more complex types that include floats.
2013-02-07 08:32:09 -08:00
Niko Matsakis
a32498d846 Make ~fn non-copyable, make &fn copyable, split barefn/closure types,
correct handling of moves for struct-record update.

Part of #3678.  Fixes #2828, #3904, #4719.
2013-02-07 05:53:30 -08:00
Brendan Zabarauskas
17a14fe0e9 Merge branch 'incoming' of https://github.com/mozilla/rust into incoming 2013-02-07 22:55:23 +11:00
Brendan Zabarauskas
e4c7d8ec87 Add type parameter for epsilon value 2013-02-07 22:54:52 +11:00
Matthew McPherrin
64fedfbc4e Fix sample program to compile in modern rust 2013-02-06 23:42:55 -05:00
Brendan Zabarauskas
b081f59495 Convert fuzzy_epsilon constant to upper case and make public 2013-02-07 10:25:41 +11:00
Daniel Micay
dab2f2fac0 remove old snapshot workaround from smallintmap 2013-02-06 17:37:56 -05:00
Daniel Micay
bdfb930f34 treemap: make map_next and set_next public 2013-02-06 17:37:56 -05:00
Daniel Micay
1694168783 update treemap FIXME 2013-02-06 17:37:56 -05:00
Daniel Micay
37e998696f get rid of implicit vec copies in treemap iterator
Each call to next() was doing a copy rather than a move. There's
currently no way for this to be a method that uses &mut self, so it has
to be a free function. Closes #4763.
2013-02-06 17:37:56 -05:00
Daniel Micay
5b6c26b4e4 treemap: get rid of some implicit vector copies 2013-02-06 17:37:56 -05:00
Daniel Micay
b91a51daca remove issue #3148 workarounds (no longer needed) 2013-02-06 17:37:56 -05:00
Patrick Walton
801f3225b2 oldmap: use &K instead of K in find and get
This reverts commit a4250a96fd.

This is not the cause of the nonexhaustive-match failure.
2013-02-05 19:41:45 -08:00
Graydon Hoare
a4250a96fd Revert "oldmap: use &K instead of K in find and get"
This reverts commit 8e643525d4.
2013-02-05 14:30:53 -08:00
Tim Chevalier
33e2c979ce Merge branch 'incoming' into removing 2013-02-05 10:33:35 -08:00
Tim Chevalier
2dcb3ed745 Merge 2013-02-05 10:33:28 -08:00
bors
f1b05ece93 auto merge of #4796 : catamorphism/rust/derecord_std, r=catamorphism
See #4665
2013-02-05 07:04:15 -08:00
bors
80cd485b49 auto merge of #4784 : alexcrichton/rust/bitv-clear-fix, r=graydon
I think that the inversion of `op(&mut w)` may have just been a mistake?
2013-02-04 22:39:53 -08:00
Alex Crichton
406a73fde2 Fix the each_storage() iterator on big bit vectors 2013-02-04 22:59:33 -05:00
bors
bffe3088c7 auto merge of pull req #4777 from thestinger/rust, r=graydon 2013-02-04 17:24:40 -08:00
Tim Chevalier
73a7672b8d std: Stamp out structural records
See #4665
2013-02-04 16:48:52 -08:00
Brian Anderson
e08a805b30 Merge remote-tracking branch 'bstrie/rimov' into incoming
Conflicts:
	src/libsyntax/parse/parser.rs
	src/test/bench/graph500-bfs.rs
	src/test/bench/sudoku.rs
	src/test/run-pass/borrowck-mut-vec-as-imm-slice.rs
	src/test/run-pass/empty-mutable-vec.rs
	src/test/run-pass/foreach-nested.rs
	src/test/run-pass/swap-2.rs
2013-02-04 11:58:30 -08:00
Erick Tryzelaar
9adfa59d8e core: convert ToStr::to_str to take explicit &self 2013-02-03 20:47:26 -08:00
Daniel Micay
8e643525d4 oldmap: use &K instead of K in find and get 2013-02-03 23:30:56 -05:00
Brian Anderson
3b396d17d6 Merge remote-tracking branch 'thestinger/old_map' into incoming
Conflicts:
	src/test/bench/core-map.rs
2013-02-03 17:56:49 -08:00
Marvin Löbel
af4972f3ce Fixed fmt!, tests, doc-tests. 2013-02-03 15:37:25 -08:00
Marvin Löbel
a612e49a21 Converted the floating point types to the new string conversion functions.
Also fixed all conflicting calls of the old functions in the rest of the codebase.

The set of string conversion functions for each float type now consists of those items:
- to_str(), converts to number in base 10
- to_str_hex(), converts to number in base 16
- to_str_radix(), converts to number in given radix
- to_str_exact(), converts to number in base 10 with a exact number of trailing digits
- to_str_digits(), converts to number in base 10 with a maximum number of trailing digits
- implementations for to_str::ToStr and num::ToStrRadix
- from_str(), parses a string as number in base 10 including decimal exponent and special values
- from_str_hex(), parses a string as a number in base 16 including binary exponent and special values
- from_str_radix(), parses a string as a number in a given base excluding any exponent and special values
- implementations for from_str::FromStr and num::FromStrRadix
2013-02-03 15:37:24 -08:00
Marvin Löbel
7113fd150a Fixed tests still using old integer to_str
Fixed integer tests
2013-02-03 15:37:24 -08:00
Marvin Löbel
eb19462104 Converted libcore/uint-template.rs to the new string functions.
- Moved ToStr implementation of unsigned integers to uint-template.rs.
- Marked the `str()` function as deprecated.
- Forwarded all conversion functions to `core::num::to_str_common()`
  and `core::num::from_str_common()`.
- Fixed most places in the codebase where `to_str()` is being used.
- Added uint-template to_str and from_str overflow tests.
2013-02-03 15:37:24 -08:00
Daniel Micay
4fd9264875 oldmap: &K instead of K for the remove parameter 2013-02-03 18:20:59 -05:00
Daniel Micay
119c78073b oldmap: start conversion to explicit self 2013-02-03 15:55:11 -05:00
Daniel Micay
81b4f36d49 oldmap: remove legacy each method 2013-02-03 15:55:11 -05:00
Daniel Micay
2e496818a5 oldmap: get rid of the legacy each_key method 2013-02-03 15:55:10 -05:00
Daniel Micay
88d9d417a1 oldmap: remove the legacy each_value method 2013-02-03 15:55:10 -05:00
Daniel Micay
643479f2e5 oldmap: implement core::container::Mutable 2013-02-03 15:55:10 -05:00
Daniel Micay
1b4eb145f9 oldmap: implement core::container::Container 2013-02-03 15:55:10 -05:00
Daniel Micay
f4a27b2c7d oldmap: get rid of the legacy contains_key method 2013-02-03 15:55:10 -05:00
Daniel Micay
319eeb1c79 rename map -> oldmap and mark it as deprecated
LinearMap is quite a bit faster, and is fully owned/sendable without
requiring copies. The older std::map also doesn't use explicit self and
relies on mutable fields.
2013-02-03 15:55:10 -05:00
Daniel Micay
df31373406 rm commented out std::map code from json module
it was replaced by LinearMap
2013-02-03 15:55:09 -05:00
Daniel Micay
ed45354a95 remove old StdMap trait
this has been replaced by core::container::Map
2013-02-03 15:55:09 -05:00
Nick Desaulniers
6fb4239bb3 Replace most invocations of fail keyword with die! macro 2013-01-31 22:25:12 -08:00
Daniel Micay
74b317ddc2 modernize smallintmap
* switch to explicit self
* get rid of the @ box
* replace DVec with ~[] (to get rid of the mutable field)
* implement the new container::Map trait
2013-01-31 23:22:51 -05:00
Daniel Micay
348d770fed copy oldsmallintmap.rs to smallintmap.rs 2013-01-31 23:13:56 -05:00
Daniel Micay
70855f5a07 move smallintmap to oldsmallintmap 2013-01-31 23:13:56 -05:00
Daniel Micay
9ba7114515 implement container::Mutable for SmallIntMap 2013-01-31 23:13:56 -05:00
Daniel Micay
aac91267e3 clean up SmallIntMap tests a bit 2013-01-31 23:13:56 -05:00
Daniel Micay
1057eea7ac drop the StdMap implementation from SmallIntMap 2013-01-31 23:13:55 -05:00