Commit Graph

1603 Commits

Author SHA1 Message Date
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