blake2-ppc
7afface3ff
extra: Implement .rev_iter() in treemap
...
Implement reverse iterators for TreeMap and TreeSet, that produce the
keys in backward order.
2013-08-07 22:41:14 -04:00
blake2-ppc
52b01c50cb
extra: External iterators for TreeSet set operations
...
Write external iterators for Difference, Sym. Difference, Intersection
and Union set operations.
These iterators are generic insofar that they could work on any ordered
sequence iterators, even though they are type specialized to the
TreeSetIterator in this case.
Looking at the `check` function in the treeset tests, rustc seems
unwilling to compile a function resembling::
fn check<'a, T: Iterator<&'a int>>(... )
so the tests for these iterators are still running the legacy loop
protocol.
2013-08-07 22:41:14 -04:00
blake2-ppc
4ab05f91f4
extra: Simplify Eq/Ord in treemap
...
Write the Eq and Ord impls for TreeMap in a more straightforward way
using iterator::Zip
2013-08-07 22:41:14 -04:00
Simon Sapin
240f8f03c9
Gedit/gtksourceview language spec: add 'in' keyword
2013-08-07 22:41:14 -04:00
Huon Wilson
8460dac909
std: add missing #[inline] annotation to the f64 arithmetic trait impls.
2013-08-07 22:41:14 -04:00
Do Nhat Minh
a185343fc4
misc help message fix
2013-08-07 22:41:14 -04:00
Alex Crichton
1b103912ea
Add some documentation about globals in ffi docs
2013-08-07 22:41:14 -04:00
Jordi Boggiano
403c52d2ae
Add weak_rng to get a random algo that puts more emphasis on speed than security
2013-08-07 22:41:14 -04:00
Jordi Boggiano
3db9dc1dfd
Document rand module with more emphasis on cryptographic security
2013-08-07 22:41:13 -04:00
Sangeun Kim
a9b7bec2e7
Change const to static
2013-08-07 22:41:13 -04:00
Sangeun Kim
19d0eb9060
Change Freeze to Static
2013-08-07 22:41:13 -04:00
Alex Crichton
ffd80aa276
Fix unit structs in cross-crate situtations
2013-08-07 22:41:13 -04:00
darkf
cc160a0028
extra: add internal
to {de,in}flate_bytes_ naming to address nit
2013-08-07 22:41:13 -04:00
darkf
dd5e8b218f
add extra::flate::deflate_bytes_zlib and a test
2013-08-07 22:41:13 -04:00
darkf
9b221f56f1
add inflate_bytes_zlib to exra::flate
2013-08-07 22:41:13 -04:00
Jordi Boggiano
a8f3f038c0
Turn OptGroups into a main opt and a main and an aliased opts
...
This way opt_present("apple") will match no matter if the user passed -a or --apple
2013-08-07 22:41:13 -04:00
Jordi Boggiano
a7f008bc39
Add missing getopts::groups::optflagmulti function
2013-08-07 22:41:13 -04:00
Alex Crichton
e99eff172a
Forbid priv
where it has no effect
...
This is everywhere except struct fields and enum variants.
2013-08-07 22:41:12 -04:00
Kevin Ballard
8964fcc5ac
Implement DoubleEndedIterator on Range
...
Range is now invertable as long as its element type conforms to Integer.
Remove int::range_rev() et al in favor of range().invert().
2013-08-07 22:41:09 -04:00
blake2-ppc
8523f6d643
rustc: Fix for-range loops that can use iterators
...
Transform range loops that can be regular iterator loops.
2013-08-07 22:39:57 -04:00
blake2-ppc
e7d4a9c7f2
Bugfix .each_edge in middle/graph.rs
...
Edge iterator used the length of the nodes vector, must be a mistake.
2013-08-07 22:39:57 -04:00
blake2-ppc
40bdbf0f5d
std: Fix for-range loops that can use iterators
...
Fix inappropriate for-range loops to use for-iterator constructs (or
other appropriate solution) instead.
2013-08-07 22:39:57 -04:00
blake2-ppc
026c1ae311
extra: Remove all .each methods in smallintmap
2013-08-07 22:39:57 -04:00
bors
a85f9acbfc
auto merge of #8320 : mihneadb/rust/freq_count, r=cmr
2013-08-07 15:02:19 -07:00
bors
98ec79c957
auto merge of #8294 : erickt/rust/map-move, r=bblum
...
According to #7887 , we've decided to use the syntax of `fn map<U>(f: &fn(&T) -> U) -> U`, which passes a reference to the closure, and to `fn map_move<U>(f: &fn(T) -> U) -> U` which moves the value into the closure. This PR adds these `.map_move()` functions to `Option` and `Result`.
In addition, it has these other minor features:
* Replaces a couple uses of `option.get()`, `result.get()`, and `result.get_err()` with `option.unwrap()`, `result.unwrap()`, and `result.unwrap_err()`. (See #8268 and #8288 for a more thorough adaptation of this functionality.
* Removes `option.take_map()` and `option.take_map_default()`. These two functions can be easily written as `.take().map_move(...)`.
* Adds a better error message to `result.unwrap()` and `result.unwrap_err()`.
2013-08-07 13:23:07 -07:00
bors
cdba212e72
auto merge of #8326 : thestinger/rust/iterator, r=alexcrichton
...
The `extra::iter` module wasn't actually included in `extra.rs` when it was moved from `std`... I assume no one is going to miss it.
2013-08-07 10:32:20 -07:00
Mihnea Dobrescu-Balaur
17c12bbd1b
Add frequency count to extra::stat. #8281
2013-08-07 09:46:09 -07:00
bors
29ffbbaaa8
auto merge of #8373 : alexcrichton/rust/disable-rusti, r=cmr
...
These are causing problems on the linux bots, I'll investigate soon.
2013-08-07 08:53:20 -07:00
Erick Tryzelaar
19e17f54a0
std: removed option.take_map{,_default}
2013-08-07 08:52:09 -07:00
Erick Tryzelaar
1e490813b0
core: option.map_consume -> option.map_move
2013-08-07 08:52:09 -07:00
Alex Crichton
0927d62275
Revert "Re-enable rusti tests"
...
This reverts commit d5de801cc1
.
2013-08-07 08:29:49 -07:00
Erick Tryzelaar
9218aaa00e
std: add result.map_move, result.map_err_move
2013-08-07 08:23:55 -07:00
Erick Tryzelaar
5c08237456
option.get -> option.unwrap
2013-08-07 08:16:37 -07:00
bors
597b3fd03f
auto merge of #8305 : huonw/rust/triage-fixes, r=cmr
...
The two deletions are because the test cases are very old (still using `class` and modes!), and, as far as I can tell (since they are so old), the areas they test are well tested by other rpass tests.
2013-08-07 06:56:19 -07:00
Huon Wilson
1ce5effac2
testsuite: add explanation to a Note, and remove duplicated code.
...
Fixes #7302 .
2013-08-07 23:17:52 +10:00
Huon Wilson
e5fb4c4359
testsuite: remove incorrect section of 2 test cases. (Also, &const is disappearing.)
...
Fixes #7304 .
2013-08-07 23:17:52 +10:00
Huon Wilson
1016e8b8f7
testsuite: remove 2 very outdated testcases; functionality is tested by other class-*.rs tests.
...
Fixes #7305 , #7307 .
2013-08-07 23:17:52 +10:00
Huon Wilson
c57fde2b5f
std: adjust str::test_add so that the macro expands to all 3 items ( #8012 ).
...
Closes #3682 .
2013-08-07 23:17:52 +10:00
bors
54c8c23d05
auto merge of #8323 : kballard/rust/saturating, r=thestinger
...
Implement saturating math in `std::num::Saturating` and use it for `Iterator` impls
2013-08-07 04:02:16 -07:00
bors
4da1cfe923
auto merge of #8285 : huonw/rust/deriving+++, r=alexcrichton
...
Some general clean-up relating to deriving:
- `TotalOrd` was too eager, and evaluated the `.cmp` call for every field, even if it could short-circuit earlier.
- the pointer types didn't have impls for `TotalOrd` or `TotalEq`.
- the Makefiles didn't reach deep enough into libsyntax for dependencies.
(Split out from https://github.com/mozilla/rust/pull/8258 .)
2013-08-07 00:56:18 -07:00
Huon Wilson
4f3944a34f
Add test for short-circuiting #[deriving(Eq,Ord,TotalEq,TotalOrd)].
2013-08-07 16:56:50 +10:00
bors
62dbdc4ea2
auto merge of #8287 : sfackler/rust/hex, r=alexcrichton
...
FromHex ignores whitespace and parses either upper or lower case hex
digits. ToHex outputs lower case hex digits with no whitespace. Unlike
ToBase64, ToHex doesn't allow you to configure the output format. I
don't feel that it's super useful in this case.
2013-08-06 21:05:11 -07:00
Daniel Micay
55f3d04101
vec: use offset_inbounds
for iterators
...
This allows LLVM to optimize vector iterators to an `getelementptr` and
`icmp` pair, instead of `getelementptr` and *two* comparisons.
Code snippet:
~~~
fn foo(xs: &mut [f64]) {
for x in xs.mut_iter() {
*x += 10.0;
}
}
~~~
LLVM IR at stage0:
~~~
; Function Attrs: noinline uwtable
define void @"_ZN3foo17_68e1b25bca131dba7_0$x2e0E"({ i64, %tydesc*, i8*, i8*, i8 }* nocapture, { double*, i64 }* nocapture) #1 {
"function top level":
%2 = getelementptr inbounds { double*, i64 }* %1, i64 0, i32 0
%3 = load double** %2, align 8
%4 = getelementptr inbounds { double*, i64 }* %1, i64 0, i32 1
%5 = load i64* %4, align 8
%6 = ptrtoint double* %3 to i64
%7 = and i64 %5, -8
%8 = add i64 %7, %6
%9 = inttoptr i64 %8 to double*
%10 = icmp eq double* %3, %9
%11 = icmp eq double* %3, null
%or.cond6 = or i1 %10, %11
br i1 %or.cond6, label %match_case, label %match_else
match_else: ; preds = %"function top level", %match_else
%12 = phi double* [ %13, %match_else ], [ %3, %"function top level" ]
%13 = getelementptr double* %12, i64 1
%14 = load double* %12, align 8
%15 = fadd double %14, 1.000000e+01
store double %15, double* %12, align 8
%16 = icmp eq double* %13, %9
%17 = icmp eq double* %13, null
%or.cond = or i1 %16, %17
br i1 %or.cond, label %match_case, label %match_else
match_case: ; preds = %match_else, %"function top level"
ret void
}
~~~
Optimized LLVM IR at stage1/stage2:
~~~
; Function Attrs: noinline uwtable
define void @"_ZN3foo17_68e1b25bca131dba7_0$x2e0E"({ i64, %tydesc*, i8*, i8*, i8 }* nocapture, { double*, i64 }* nocapture) #1 {
"function top level":
%2 = getelementptr inbounds { double*, i64 }* %1, i64 0, i32 0
%3 = load double** %2, align 8
%4 = getelementptr inbounds { double*, i64 }* %1, i64 0, i32 1
%5 = load i64* %4, align 8
%6 = lshr i64 %5, 3
%7 = getelementptr inbounds double* %3, i64 %6
%8 = icmp eq i64 %6, 0
%9 = icmp eq double* %3, null
%or.cond6 = or i1 %8, %9
br i1 %or.cond6, label %match_case, label %match_else
match_else: ; preds = %"function top level", %match_else
%.sroa.0.0.in7 = phi double* [ %10, %match_else ], [ %3, %"function top level" ]
%10 = getelementptr inbounds double* %.sroa.0.0.in7, i64 1
%11 = load double* %.sroa.0.0.in7, align 8
%12 = fadd double %11, 1.000000e+01
store double %12, double* %.sroa.0.0.in7, align 8
%13 = icmp eq double* %10, %7
br i1 %13, label %match_case, label %match_else
match_case: ; preds = %match_else, %"function top level"
ret void
}
~~~
2013-08-06 23:54:24 -04:00
Daniel Micay
7d115c9420
add an intrinsic for inbounds GEP
2013-08-06 23:41:20 -04:00
Daniel Micay
f23fb19ee5
vec: avoid ptrtoint
/inttoptr
in the iterators
...
This results in throwing away alias analysis information, because LLVM
does *not* implement reasoning about these conversions yet.
We specialize zero-size types since a `getelementptr` offset will
return us the same pointer, making it broken as a simple counter.
2013-08-06 23:41:20 -04:00
Daniel Micay
8f9bbc476d
remove extra::iter
...
This module provided adaptors for the old internal iterator protocol,
but they proved to be quite unreadable and are not generic enough to
handle borrowed pointers well.
Since Rust no longer defines an internal iteration protocol, I don't
think there's going to be any reuse via these adaptors.
2013-08-06 23:41:20 -04:00
bors
5b4244d917
auto merge of #8231 : SimonSapin/rust/ascii-upper-lower-case, r=cmr
...
Original pull request: Add str.to_ascii_lower() and str.to_ascii_upper() methods in std::str.
2013-08-06 15:32:05 -07:00
Daniel Micay
40d11a5461
iterator: rename Counter::new
to count
...
to match the convention used by `range`, since `iterator::count` is
already namespaced enough and won't be ambiguous
2013-08-06 18:09:20 -04:00
Daniel Micay
c13f4f398a
add Extendable to the prelude
2013-08-06 18:09:20 -04:00
Daniel Micay
b3a317c368
iterator: simplify the take
implementation
2013-08-06 18:09:20 -04:00