Commit Graph

20840 Commits

Author SHA1 Message Date
Alex Crichton
ffb670ffcd Add initial support for a new formatting syntax
The new macro is available under the name ifmt! (only an intermediate name)
2013-08-07 19:21:43 -07: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
Simon Sapin
88b21f592c Add to_ascii_upper, to_ascii_lower and eq_ignore_ascii_case in std::ascii 2013-08-06 20:22:11 +01:00
bors
6972eb4cd7 auto merge of #8321 : alexcrichton/rust/enable-rusti, r=cmr
Now that LLVM has been upgraded, I think that we can try again to re-enable the rusti tests.
2013-08-06 12:14:07 -07:00
bors
72080954b9 auto merge of #8317 : bblum/rust/fast-spawn-unlinked, r=brson
This lazily initializes the taskgroup structs for ```spawn_unlinked``` tasks. If such a task never spawns another task linked to it (or a descendant of it), its taskgroup is simply never initialized at all. Also if an unlinked task spawns another unlinked task, neither of them will need to initialize their taskgroups. This works for the main task too.

I benchmarked this with the following test case and observed a ~~21% speedup (average over 4 runs: 7.85 sec -> 6.20 sec, 2.5 GHz)~~ 11% speedup, see comment below.
```
use std::task;
use std::cell::Cell;
use std::rt::comm;

static NUM: uint = 1024*256;

fn run(f: ~fn()) {
    let mut t = task::task();
    t.unlinked();
    t.spawn(f);
}

fn main() {
    do NUM.times {
        let (p,c) = comm::oneshot();
        let c = Cell::new(c);
        do run { c.take().send(()); }
        p.recv();
    }
}
```
2013-08-06 10:32:00 -07:00
bors
3dfb55ab09 auto merge of #8313 : msullivan/rust/cleanup, r=catamorphism 2013-08-06 08:44:05 -07:00
bors
ba3d03d3a4 auto merge of #8312 : alexcrichton/rust/use-treemap, r=erickt
Closes #4430
2013-08-06 07:05:05 -07:00
bors
ca6385034c auto merge of #8308 : blake2-ppc/rust/str-slice-bytes, r=alexcrichton
`fn slice_bytes` is marked unsafe since it allows violating the valid
string encoding property; but the function did also allow extending the
lifetime of the slice by mistake, since it's returning `&str`.

Use the annotation `slice_bytes<'a>(&'a str, ...) -> &'a str` so
that all uses of `slice_bytes` are region checked correctly.
2013-08-06 05:26:01 -07:00
bors
8adcba4300 auto merge of #8054 : sammykim/rust/move-EnumSet, r=alexcrichton
Fix #8004
2013-08-06 02:26:06 -07:00
Sangeun Kim
a76943be47 Move EnumSet into libextra 2013-08-06 14:45:02 +09:00
bors
f8cf234b34 auto merge of #8265 : blake2-ppc/rust/std-iter, r=thestinger
Fix #8228 by replacing .iter() and .iter_err() in Result by external iterators.

Implement random access for `iterator::Invert` and `vec::ChunkIter` (and bidirectionality).

Implement Repeat iterator.
2013-08-05 22:38:15 -07:00
bors
6f88f4dea5 auto merge of #8278 : cmr/rust/workaround, r=brson 2013-08-05 20:07:59 -07:00
blake2-ppc
45085b9f8d std: Fix bug in ChunkIter::idx
ChunkIter .idx() didn't handle overflow correctly, even though it tried.
2013-08-06 04:05:08 +02:00
blake2-ppc
ea9c5c405e std: Remove uint::iterate, replaced by range 2013-08-06 04:05:08 +02:00
blake2-ppc
08d0b70213 extra: Simplify the bitv iterators using Repeat 2013-08-06 04:05:08 +02:00
blake2-ppc
b5cd81d0e5 std: Improve the documentation for iterator::Invert 2013-08-06 04:05:08 +02:00
blake2-ppc
520f292e48 std: Use method name Option::consume
With Option as the simplest container, `consume` is the way to turn it
into a by-value iterator.
2013-08-06 04:05:07 +02:00
blake2-ppc
78effe7626 std: Rewrite the HashSet set operation iterators
Use the Repeat iterator to carry the "explicit closure capture" that was
previously done with the custom EnvFilterIterator.
2013-08-06 04:05:07 +02:00
blake2-ppc
8046218f0f std: Add iterator::Repeat to repeat an element endlessly 2013-08-06 04:05:07 +02:00
blake2-ppc
a05a9a1c02 std: Improve vec::ChunkIter
Implement clone, bidirectionality and random access for this iterator
2013-08-06 04:05:07 +02:00
blake2-ppc
872d15d464 std: Implement RandomAccessIterator for Invert 2013-08-06 04:05:07 +02:00
blake2-ppc
c5e4c55989 std: Remove unused trait bound in Result::map 2013-08-06 04:05:07 +02:00
blake2-ppc
109e0d85a1 std: Convert Result to use external iterators
convert iter() and iter_err() for Result. Use OptionIterator.
2013-08-06 04:02:21 +02:00
blake2-ppc
ce682cb45f std: Add .consume_iter() for Option, to make it reusable
Let Option be a base for a widely useful one- or zero- item iterator.
Refactor OptionIterator to support any generic element type, so the same
iterator impl can be used for both &T, &mut T and T iterators.
2013-08-06 03:59:56 +02:00
Alex Crichton
d5de801cc1 Re-enable rusti tests 2013-08-05 18:55:53 -07:00
bors
bbda3fa938 auto merge of #8288 : Kimundi/rust/opteitres4, r=brson
This is an alternative version to https://github.com/mozilla/rust/pull/8268, where instead of transitioning to `get()` completely, I transitioned to `unwrap()` completely.

My reasoning for also opening this PR is that having two different functions with identical behavior on a common datatype is bad for consistency and confusing for users, and should be solved as soon as possible. The fact that apparently half the code uses `get()`, and the other half `unwrap()` only makes it worse.

If the final naming decision ends up different, there needs to be a big renaming anyway, but until then it should at least be consistent.

---

- Made naming schemes consistent between Option, Result and Either
- Lifted the quality of the either and result module to that of option
- Changed Options Add implementation to work like the maybe Monad (return None if any of the inputs is None)  
  See https://github.com/mozilla/rust/issues/6002, especially my last comment.
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead  
  See also https://github.com/mozilla/rust/issues/7887.

Todo: 

Adding testcases for all function in the three modules. Even without the few functions I added, the coverage wasn't complete to begin with. But I'd rather do that as a follow up PR, I've touched to much code here already, need to go through them again later.
2013-08-05 16:47:01 -07:00
Ben Blum
1f95bd7684 Lazily initialize 'leaf node' taskgroups for unlinked spawns, for an apparent 11% speedup. 2013-08-05 19:30:25 -04:00
Ben Blum
47e82c8555 (cleanup) Uncomment an assertion that now holds. 2013-08-05 18:40:42 -04:00
bors
29099e450a auto merge of #8298 : darkf/rust/fix-3948, r=pcwalton 2013-08-05 13:49:55 -07:00
Marvin Löbel
0ac7a219f0 Updated std::Option, std::Either and std::Result
- Made naming schemes consistent between Option, Result and Either
- Changed Options Add implementation to work like the maybe monad (return None if any of the inputs is None)
- Removed duplicate Option::get and renamed all related functions to use the term `unwrap` instead
2013-08-05 22:42:21 +02:00
Alex Crichton
991648d099 Use TreeMap's ord implementation for Json
Closes #4430
2013-08-05 13:20:48 -07:00
Michael Sullivan
53c6de5684 Improve debug spew in _match. 2013-08-05 12:30:28 -07:00
Michael Sullivan
7dbc5ae79f Get rid of some NOTEs. 2013-08-05 12:30:28 -07:00
Michael Sullivan
fd01031f3a Warn when using -o option on libraries. Closes #6554. 2013-08-05 11:41:06 -07:00
Michael Sullivan
a20081666b Fix an unused variable warning and clean up some dead code/names. 2013-08-05 11:41:06 -07:00
bors
d8b299d179 auto merge of #8293 : dim-an/rust/trie-iterator, r=thestinger
Closes #5506.
2013-08-05 11:28:56 -07:00
Michael Sullivan
bcf62e7901 Make node_id_to_str print more useful info in some cases. Closes #2410. 2013-08-05 10:33:55 -07:00
bors
2d1eb1916e auto merge of #8292 : thestinger/rust/fix_loop_warning, r=brson 2013-08-05 09:49:56 -07:00
blake2-ppc
476dfc24b3 std: Use correct lifetime parameter on str::raw::slice_bytes
fn slice_bytes is marked unsafe since it allows violating the valid
string encoding property; but the function did also allow extending the
lifetime of the slice by mistake, since it's returning `&str`.

Use the annotation `slice_bytes<'a>(&'a str, ...) -> &'a str` so
that all uses of slice_bytes are region checked correctly.
2013-08-05 17:55:06 +02:00
bors
d89ff7eef9 auto merge of #8289 : sfackler/rust/push_byte, r=erickt
It was previously pushing the byte on top of the string's null
terminator. I added a test to make sure it doesn't break in the future.
2013-08-05 08:10:55 -07:00
bors
c2bacd2e80 auto merge of #8183 : omasanori/rust/migrate-new, r=sanxiyn
It seems that relatively new code uses `Foo::new()` instead of `Foo()` so I wrote a patch to migrate some structs to the former style.
Is it a right direction? If there are any guidelines not to use new()-style, could you add them to the [style guide](https://github.com/omasanori/rust/wiki/Note-style-guide)?
2013-08-05 06:22:57 -07:00
bors
dbaca98d78 auto merge of #8279 : pcwalton/rust/no-main, r=brson
Useful for SDL and possibly Android too.

r? @brson
2013-08-05 04:37:58 -07:00
bors
4db061160d auto merge of #8227 : dim-an/rust/tree-iter, r=thestinger 2013-08-05 02:52:55 -07:00
OGINO Masanori
eab97b5558 Add extra::arena::Arena::new{, _with_size}.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-05 17:43:40 +09:00
bors
7b2163d376 auto merge of #8303 : brson/rust/tls-magic-wtf, r=brson 2013-08-05 00:56:00 -07:00
Brian Anderson
1c1add23f6 std::rt: Use magic to make TLS work from annihilated boxes. #8302 2013-08-05 00:36:02 -07:00
bors
4fdd720421 auto merge of #8299 : brson/rust/yet-more-newsched-fixes, r=brson 2013-08-04 23:16:59 -07:00
Brian Anderson
167bdff041 std::rt: Schedule more scheduler callbacks to avoid dropping messages 2013-08-04 21:56:48 -07:00
Brian Anderson
d123df26ff std: Fix newsched logging truncation
The truncation needs to be done in the console logger in order
to catch all the logging output, and because truncation only matters
when outputting to the console.
2013-08-04 21:56:47 -07:00
darkf
180d050138 Open files in binary mode. Closes #3948 2013-08-04 21:54:24 -07:00