]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoAdd std::num::Saturating
Kevin Ballard [Tue, 6 Aug 2013 02:28:20 +0000 (19:28 -0700)]
Add std::num::Saturating

Saturating is an implementation of saturating math operations (at the
moment just add and sub) for integral types.

10 years agoauto merge of #8293 : dim-an/rust/trie-iterator, r=thestinger
bors [Mon, 5 Aug 2013 18:28:56 +0000 (11:28 -0700)]
auto merge of #8293 : dim-an/rust/trie-iterator, r=thestinger

Closes #5506.

10 years agoauto merge of #8292 : thestinger/rust/fix_loop_warning, r=brson
bors [Mon, 5 Aug 2013 16:49:56 +0000 (09:49 -0700)]
auto merge of #8292 : thestinger/rust/fix_loop_warning, r=brson

10 years agoauto merge of #8289 : sfackler/rust/push_byte, r=erickt
bors [Mon, 5 Aug 2013 15:10:55 +0000 (08:10 -0700)]
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.

10 years agoauto merge of #8183 : omasanori/rust/migrate-new, r=sanxiyn
bors [Mon, 5 Aug 2013 13:22:57 +0000 (06:22 -0700)]
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)?

10 years agoauto merge of #8279 : pcwalton/rust/no-main, r=brson
bors [Mon, 5 Aug 2013 11:37:58 +0000 (04:37 -0700)]
auto merge of #8279 : pcwalton/rust/no-main, r=brson

Useful for SDL and possibly Android too.

r? @brson

10 years agoauto merge of #8227 : dim-an/rust/tree-iter, r=thestinger
bors [Mon, 5 Aug 2013 09:52:55 +0000 (02:52 -0700)]
auto merge of #8227 : dim-an/rust/tree-iter, r=thestinger

10 years agoAdd extra::arena::Arena::new{, _with_size}.
OGINO Masanori [Mon, 5 Aug 2013 08:43:40 +0000 (17:43 +0900)]
Add extra::arena::Arena::new{, _with_size}.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoauto merge of #8303 : brson/rust/tls-magic-wtf, r=brson
bors [Mon, 5 Aug 2013 07:56:00 +0000 (00:56 -0700)]
auto merge of #8303 : brson/rust/tls-magic-wtf, r=brson

10 years agostd::rt: Use magic to make TLS work from annihilated boxes. #8302
Brian Anderson [Mon, 5 Aug 2013 07:32:46 +0000 (00:32 -0700)]
std::rt: Use magic to make TLS work from annihilated boxes. #8302

10 years agoauto merge of #8299 : brson/rust/yet-more-newsched-fixes, r=brson
bors [Mon, 5 Aug 2013 06:16:59 +0000 (23:16 -0700)]
auto merge of #8299 : brson/rust/yet-more-newsched-fixes, r=brson

10 years agostd::rt: Schedule more scheduler callbacks to avoid dropping messages
Brian Anderson [Mon, 5 Aug 2013 04:55:52 +0000 (21:55 -0700)]
std::rt: Schedule more scheduler callbacks to avoid dropping messages

10 years agostd: Fix newsched logging truncation
Brian Anderson [Mon, 5 Aug 2013 04:54:59 +0000 (21:54 -0700)]
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.

10 years agoauto merge of #8220 : luqmana/rust/arm-linux, r=cmr
bors [Mon, 5 Aug 2013 04:34:54 +0000 (21:34 -0700)]
auto merge of #8220 : luqmana/rust/arm-linux, r=cmr

Update the arm linux support some more. We had a previous patch for the RasberryPi. This adds a new target `arm-unknown-linux-gnueabi` for more general arm linux support.

Build/Host machine: x86_64 Debian testing (jessie) with the `gcc-4.4-arm-linux-gnueabi` package

Tested on targets:

- TS-7800 Feroceon (ARMv5TEJ) running Debian 7.0 wheezy
- Beaglebone black (ARMv7) running Angstrom GNU/Linux v2012.12
   - rustc flags:  `--target=arm-unknown-linux-gnueabi --linker=arm-linux-gnueabi-gcc`

- Samsung Galaxy S II (to make sure android still works)
   - rustc flags:  `--target=arm-linux-androideabi --android-cross-path=[path to standalone toolchain]`

Since not all arm devices (i.e. afaik anything older than armv6 like the ts-7800 i tested on) supported getting the tls address via the `mrc` instruction, I made it also try via the magic address the kernel maps into the address space (0xFFFF0FF0). One or the other should work (and on android it seems like both work).

Also fixes a bug where rustc would always try to invoke the android assembler for any kind of arm target.

10 years agoauto merge of #8297 : brson/rust/dlist-dtor, r=brson
bors [Mon, 5 Aug 2013 02:52:57 +0000 (19:52 -0700)]
auto merge of #8297 : brson/rust/dlist-dtor, r=brson

The compiler-generated dtor for DList recurses deeply to drop Nodes.
For big lists this can overflow the stack.

This is a problem for the new scheduler, where split stacks are not implemented.

Thanks @blake2-ppc

10 years agoextra: Don't recurse in DList drop glue. #8295
Brian Anderson [Mon, 5 Aug 2013 01:38:06 +0000 (18:38 -0700)]
extra: Don't recurse in DList drop glue. #8295

The compiler-generated dtor for DList recurses deeply to drop Nodes.
For big lists this can overflow the stack.

10 years agoauto merge of #8282 : brson/rust/more-newsched-fixes, r=brson
bors [Mon, 5 Aug 2013 01:10:53 +0000 (18:10 -0700)]
auto merge of #8282 : brson/rust/more-newsched-fixes, r=brson

10 years agoAdd support for vanilla linux on arm.
Luqman Aden [Thu, 1 Aug 2013 10:39:37 +0000 (06:39 -0400)]
Add support for vanilla linux on arm.

10 years agoauto merge of #8218 : brson/rust/nogc, r=brson
bors [Sun, 4 Aug 2013 23:25:54 +0000 (16:25 -0700)]
auto merge of #8218 : brson/rust/nogc, r=brson

These are both obsoleted by the forthcoming new GC.

10 years agoRemove debug printing.
Dmitry Ermolov [Sun, 4 Aug 2013 22:51:43 +0000 (02:51 +0400)]
Remove debug printing.

10 years agoImplemented iterator for TrieMap
Dmitry Ermolov [Sun, 4 Aug 2013 22:26:38 +0000 (02:26 +0400)]
Implemented iterator for TrieMap

Closes #5506.

10 years agofix warning still mentioning the `again` keyword
Daniel Micay [Sun, 4 Aug 2013 22:21:29 +0000 (18:21 -0400)]
fix warning still mentioning the `again` keyword

10 years agoRemove old tests and code for `select`
Brian Anderson [Sun, 4 Aug 2013 07:40:10 +0000 (00:40 -0700)]
Remove old tests and code for `select`

Not compatible with newsched

10 years agostd::rt: Remove the test for context()
Brian Anderson [Sun, 4 Aug 2013 06:50:28 +0000 (23:50 -0700)]
std::rt: Remove the test for context()

This is no longer testable once newsched is turned on

10 years agostd::rt: Don't allow schedulers to exit before handling all messages
Brian Anderson [Sun, 4 Aug 2013 06:29:21 +0000 (23:29 -0700)]
std::rt: Don't allow schedulers to exit before handling all messages

Every time run_sched_once performs a 'scheduling action' it needs to guarantee
that it runs at least one more time, so enqueue another run_sched_once callback.
The primary reason it needs to do this is because not all async callbacks
are guaranteed to run, it's only guaranteed that *a* callback will run after
enqueing one - some may get dropped.

At the moment this means we wastefully create lots of callbacks to ensure that
there will *definitely* be a callback queued up to continue running the scheduler.
The logic really needs to be tightened up here.

10 years agostd::rt: 3MB stacks!
Brian Anderson [Sun, 4 Aug 2013 06:28:47 +0000 (23:28 -0700)]
std::rt: 3MB stacks!

rustc needs *even more* megabytes when run without optimizations

10 years agostd::rt: Run the tests for Local in a bare thread
Brian Anderson [Sun, 4 Aug 2013 00:40:29 +0000 (17:40 -0700)]
std::rt: Run the tests for Local in a bare thread

Otherwise interferes with the existing runtime

10 years agostd::rt: Improve the error message when the thread-local ptr is null
Brian Anderson [Sun, 4 Aug 2013 00:39:59 +0000 (17:39 -0700)]
std::rt: Improve the error message when the thread-local ptr is null

Also fix some incorrect comments and variable names.

10 years agoauto merge of #8260 : omasanori/rust/fix-extra-unicode, r=pcwalton
bors [Sun, 4 Aug 2013 21:43:51 +0000 (14:43 -0700)]
auto merge of #8260 : omasanori/rust/fix-extra-unicode, r=pcwalton

WIth this patch `RUSTFLAGS='--cfg unicode' make check"` passed successfully.

* Why doesn't `#[link_name="icuuc"]` make libextra to link against libicuuc.so?
* In `extra::unicode::tests`, `use unicode; unicode::is_foo('a')` failed but `use unicode::*; is_foo('a')` succeeded. Is it right?

10 years agoFixed str::raw::push_byte
Steven Fackler [Sun, 4 Aug 2013 20:10:19 +0000 (16:10 -0400)]
Fixed str::raw::push_byte

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.

10 years agoauto merge of #7115 : alexcrichton/rust/llvm-upgrades, r=thestinger
bors [Sun, 4 Aug 2013 19:49:53 +0000 (12:49 -0700)]
auto merge of #7115 : alexcrichton/rust/llvm-upgrades, r=thestinger

This is a reopening of #6713

This is still blocked on windows failures. I'll re-push try once the existing crisis has passed.

10 years agoMerge pull request #8284 from huonw/emacs-in-kw
Daniel Micay [Sun, 4 Aug 2013 19:49:11 +0000 (12:49 -0700)]
Merge pull request #8284 from huonw/emacs-in-kw

etc: add the `in` keyword to the emacs mode.

10 years agoIntegrate new arm patch and fix an LLVM bug
Alex Crichton [Fri, 2 Aug 2013 07:55:49 +0000 (00:55 -0700)]
Integrate new arm patch and fix an LLVM bug

Thanks @luqama!

10 years agoAdd a workaround for 8199 for now
Alex Crichton [Thu, 1 Aug 2013 22:47:09 +0000 (15:47 -0700)]
Add a workaround for 8199 for now

10 years agoFix setting the fixed stack segment attribute on LLVM functions
Alex Crichton [Sun, 26 May 2013 02:26:08 +0000 (21:26 -0500)]
Fix setting the fixed stack segment attribute on LLVM functions

At the same time create a more robust wrapper to try to prevent this type of
issue from cropping up in the future.

10 years agoFix build issues once LLVM has been upgraded
Alex Crichton [Sat, 25 May 2013 22:23:12 +0000 (17:23 -0500)]
Fix build issues once LLVM has been upgraded

* LLVM now has a C interface to LLVMBuildAtomicRMW
* The exception handling support for the JIT seems to have been dropped
* Various interfaces have been added or headers have changed

10 years agoUpdate LLVM
Alex Crichton [Fri, 24 May 2013 05:43:59 +0000 (00:43 -0500)]
Update LLVM

10 years agoTry to fix a periodic windows build failure due to broken rwildcard macro
Brian Anderson [Tue, 21 May 2013 23:34:41 +0000 (16:34 -0700)]
Try to fix a periodic windows build failure due to broken rwildcard macro

10 years agoauto merge of #8262 : dotdash/rust/no_rval_copies, r=pcwalton
bors [Sun, 4 Aug 2013 17:55:53 +0000 (10:55 -0700)]
auto merge of #8262 : dotdash/rust/no_rval_copies, r=pcwalton

rvalues aren't going to be used anywhere but as the argument, so
there's no point in copying them. LLVM used to eliminate the copy
later, but why bother emitting it in the first place?

10 years agoauto merge of #8243 : stepancheg/rust/ipv, r=brson
bors [Sun, 4 Aug 2013 15:49:55 +0000 (08:49 -0700)]
auto merge of #8243 : stepancheg/rust/ipv, r=brson

multicast functions now take IpAddr (without port), because they dont't
need port.

Uv* types renamed:
* UvIpAddr -> UvSocketAddr
* UvIpv4 -> UvIpv4SocketAddr
* UvIpv6 -> UvIpv6SocketAddr

"Socket address" is a common name for (ip-address, port) pair (e.g. in
sockaddr_in struct).

P. S. Are there any backward compatibility concerns? What is std::rt module, is it a part of public API?

10 years agoauto merge of #8237 : blake2-ppc/rust/faster-utf8, r=brson
bors [Sun, 4 Aug 2013 14:10:56 +0000 (07:10 -0700)]
auto merge of #8237 : blake2-ppc/rust/faster-utf8, r=brson

Use unchecked vec indexing since the vector bounds are checked by the
loop. Iterators are not easy to use in this case since we skip 1-4 bytes
each lap. This part of the commit speeds up is_utf8 for ASCII input.

Check codepoint ranges by checking the byte ranges manually instead of
computing a full decoding for multibyte encodings. This is easy to read
and corresponds to the UTF-8 syntax in the RFC.

No changes to what we accept. A comment notes that surrogate halves are
accepted.

Before:

test str::bench::is_utf8_100_ascii ... bench: 165 ns/iter (+/- 3)
test str::bench::is_utf8_100_multibyte ... bench: 218 ns/iter (+/- 5)

After:
test str::bench::is_utf8_100_ascii ... bench: 130 ns/iter (+/- 1)
test str::bench::is_utf8_100_multibyte ... bench: 156 ns/iter (+/- 3)

An improvement upon the previous pull #8133

10 years agoauto merge of #8254 : brson/rust/libuv-mac-supp, r=pcwalton
bors [Sun, 4 Aug 2013 12:28:57 +0000 (05:28 -0700)]
auto merge of #8254 : brson/rust/libuv-mac-supp, r=pcwalton

I suspect that this is a race between process exit and the termination of
worker threads used by libuv (if I sleep before exit it doesn't leak). This
isn't going to cause any real problems but should probably be fixed at
some point.

r? @pcwalton

cc #8253

10 years agoauto merge of #8217 : brson/rust/reset_stack_limit, r=pcwalton
bors [Sun, 4 Aug 2013 10:34:56 +0000 (03:34 -0700)]
auto merge of #8217 : brson/rust/reset_stack_limit, r=pcwalton

In some scenarios upcall_rust_stack_limit fails to record the stack
limit, leaving it 0, and allowing subsequent Rust code to run into
the red zone.

10 years agoImplemented TreeMap::{lower_bound_iter,upper_bound_iter}
Dmitry Ermolov [Thu, 1 Aug 2013 20:59:07 +0000 (00:59 +0400)]
Implemented TreeMap::{lower_bound_iter,upper_bound_iter}

(issue #4604)

10 years agoRemove redundant print.
Dmitry Ermolov [Thu, 1 Aug 2013 20:57:34 +0000 (00:57 +0400)]
Remove redundant print.

10 years agoAdditional check in treemap iterator test.
Dmitry Ermolov [Wed, 31 Jul 2013 16:24:35 +0000 (20:24 +0400)]
Additional check in treemap iterator test.

10 years agort: Fix a corner-case in unwinding that leads to stack overflow
Brian Anderson [Fri, 2 Aug 2013 04:14:43 +0000 (21:14 -0700)]
rt: Fix a corner-case in unwinding that leads to stack overflow

In some scenarios upcall_rust_stack_limit fails to record the stack
limit, leaving it 0, and allowing subsequent Rust code to run into
the red zone.

10 years agostd: Remove gc and stackwalk
Brian Anderson [Fri, 2 Aug 2013 06:31:53 +0000 (23:31 -0700)]
std: Remove gc and stackwalk

These are both obsoleted by the forthcoming new GC.

10 years agoauto merge of #8264 : thestinger/rust/snapshot, r=Aatch
bors [Sun, 4 Aug 2013 06:25:55 +0000 (23:25 -0700)]
auto merge of #8264 : thestinger/rust/snapshot, r=Aatch

10 years agoauto merge of #8269 : brson/rust/fix-task-cleanup, r=brson
bors [Sun, 4 Aug 2013 04:46:56 +0000 (21:46 -0700)]
auto merge of #8269 : brson/rust/fix-task-cleanup, r=brson

...y/catch

And before collect_failure. These are both running user dtors and need to be handled
in the task try/catch block and before the final task cleanup code.

10 years agorm obsolete `for` support from the compiler
Daniel Micay [Sun, 4 Aug 2013 03:51:29 +0000 (23:51 -0400)]
rm obsolete `for` support from the compiler

10 years agolibrustc: Implement `#[no_main]`, which omits the entry point entirely.
Patrick Walton [Sun, 4 Aug 2013 02:59:46 +0000 (19:59 -0700)]
librustc: Implement `#[no_main]`, which omits the entry point entirely.

Useful for SDL and possibly Android too.

10 years agoremove obsolete `foreach` keyword
Daniel Micay [Sat, 3 Aug 2013 16:45:23 +0000 (12:45 -0400)]
remove obsolete `foreach` keyword

this has been replaced by `for`

10 years agoregister snapshots
Daniel Micay [Sat, 3 Aug 2013 16:21:57 +0000 (12:21 -0400)]
register snapshots

10 years agoMerge pull request #8251 from chris-morgan/vim-sigil-highlighting
Daniel Micay [Sun, 4 Aug 2013 01:02:04 +0000 (18:02 -0700)]
Merge pull request #8251 from chris-morgan/vim-sigil-highlighting

Highlight sigils and operators in Vim.

r=huonw, known spurious failure on one bot

10 years agostd::rt: Run local storage cleanup and the box annihilator inside the try/catch
Brian Anderson [Sat, 3 Aug 2013 21:43:16 +0000 (14:43 -0700)]
std::rt: Run local storage cleanup and the box annihilator inside the try/catch

And before collect_failure. These are both running user dtors and need to be handled
in the task try/catch block and before the final task cleanup code.

10 years agoauto merge of #8246 : stepancheg/rust/contains-key, r=thestinger
bors [Sat, 3 Aug 2013 20:40:49 +0000 (13:40 -0700)]
auto merge of #8246 : stepancheg/rust/contains-key, r=thestinger

Map::contains_key can be implemented with Map::find.

Remove several implementations of contains_key.

10 years agoauto merge of #8223 : davidhalperin/rust/master, r=Aatch
bors [Sat, 3 Aug 2013 18:52:50 +0000 (11:52 -0700)]
auto merge of #8223 : davidhalperin/rust/master, r=Aatch

Closes #7907

This is my first pull request so let me know if I've done anything wrong.  I tried to pick off a nice easy one.

10 years agoauto merge of #8219 : sstewartgallus/rust/fix_dynamic_lib, r=graydon
bors [Sat, 3 Aug 2013 17:04:58 +0000 (10:04 -0700)]
auto merge of #8219 : sstewartgallus/rust/fix_dynamic_lib, r=graydon

A test case was also created for this situation to prevent the problem
occuring again.

A similar problem was also fixed for the symbol method.

There was some minor code cleanup.

I am unsatisfied with using /dev/null as an invalid dynamic library. It is not cross platform.

10 years agoauto merge of #8213 : kballard/rust/fd-limit, r=brson
bors [Sat, 3 Aug 2013 14:46:53 +0000 (07:46 -0700)]
auto merge of #8213 : kballard/rust/fd-limit, r=brson

Revert the workaround 49b72bd and instead bump the fd limit on OS X.

10 years agotrans_arg_expr: Omit extra copies for rvalues
Björn Steinbrink [Sat, 3 Aug 2013 10:35:33 +0000 (12:35 +0200)]
trans_arg_expr: Omit extra copies for rvalues

rvalues aren't going to be used anywhere but as the argument, so
there's no point in copying them. LLVM used to eliminate the copy
later, but why bother emitting it in the first place?

10 years agoauto merge of #8186 : huonw/rust/hashmap-=rt, r=Aatch
bors [Sat, 3 Aug 2013 12:37:52 +0000 (05:37 -0700)]
auto merge of #8186 : huonw/rust/hashmap-=rt, r=Aatch

The `new` constructor uses the task-local RNG to retrieve seeds for the
two key values, which requires the runtime. Exposing a constructor that
takes the keys directly allows HashMaps to be used in programs that wish
to avoid the runtime.

10 years agostd: expose the keyed HashMap constructor, for runtime-less use.
Huon Wilson [Thu, 1 Aug 2013 08:11:25 +0000 (18:11 +1000)]
std: expose the keyed HashMap constructor, for runtime-less use.

The `new` constructor uses the task-local RNG to retrieve seeds for the
two key values, which requires the runtime. Exposing a constructor that
takes the keys directly allows HashMaps to be used in programs that wish
to avoid the runtime.

10 years agoFix building problems in extra::unicode.
OGINO Masanori [Fri, 2 Aug 2013 22:06:27 +0000 (07:06 +0900)]
Fix building problems in extra::unicode.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoauto merge of #8206 : omasanori/rust/blk-to-block, r=graydon
bors [Sat, 3 Aug 2013 10:55:52 +0000 (03:55 -0700)]
auto merge of #8206 : omasanori/rust/blk-to-block, r=graydon

Just for consistency.

10 years agoauto merge of #8204 : kballard/rust/str-into-owned, r=graydon
bors [Sat, 3 Aug 2013 09:10:54 +0000 (02:10 -0700)]
auto merge of #8204 : kballard/rust/str-into-owned, r=graydon

The method .into_owned() is meant to be used as an optimization when you
need to get a ~str from a Str, but don't want to unnecessarily copy it
if it's already a ~str.

This is meant to ease functions that look like

  fn foo<S: Str>(strs: &[S])

Previously they could work with the strings as slices using .as_slice(),
but producing ~str required copying the string, even if the vector
turned out be a &[~str] already.

I don't have any concrete uses for this yet, since the one conversion I've done to `&[S]` so far (see PR #8203) didn't actually need owned strings. But having this here may make using `Str` more attractive.

It also may be worth adding an `into_managed()` function, but that one is less obviously useful than `into_owned()`.

10 years agoetc: add the `in` keyword to the emacs mode.
Huon Wilson [Sat, 3 Aug 2013 08:31:23 +0000 (18:31 +1000)]
etc: add the `in` keyword to the emacs mode.

10 years agoauto merge of #8257 : mozilla/rust/rollup, r=thestinger
bors [Sat, 3 Aug 2013 07:25:56 +0000 (00:25 -0700)]
auto merge of #8257 : mozilla/rust/rollup, r=thestinger

1f9c392 r=brson
54e685d r=graydon
1992765 r=thestinger
75155cd r=bblum
def8891 r=graydon

10 years agoMove `use` statements.
OGINO Masanori [Thu, 1 Aug 2013 20:52:08 +0000 (05:52 +0900)]
Move `use` statements.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoRename sum -> _sum.
OGINO Masanori [Thu, 1 Aug 2013 20:51:29 +0000 (05:51 +0900)]
Rename sum -> _sum.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoRemove unused variables.
OGINO Masanori [Thu, 1 Aug 2013 14:46:42 +0000 (23:46 +0900)]
Remove unused variables.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
10 years agoExplicitly impl Clone for RWArc
Kevin Ballard [Thu, 1 Aug 2013 22:02:03 +0000 (15:02 -0700)]
Explicitly impl Clone for RWArc

RWArc had a clone() method, but it was part of impl RWArc instead of
an implementation of Clone.

Stick with the explicit implementation instead of deriving Clone so we
can have a docstring.

Fixes #8052.

10 years agostd: add benchmark for vec.mut_iter.
Huon Wilson [Fri, 2 Aug 2013 14:23:05 +0000 (00:23 +1000)]
std: add benchmark for vec.mut_iter.

10 years agostd: use ptr.offset where possible in the vec iterator.
Huon Wilson [Fri, 2 Aug 2013 13:34:11 +0000 (23:34 +1000)]
std: use ptr.offset where possible in the vec iterator.

Closes #8212.

10 years agooption: mutate() and mutate_default() should return bool
Kevin Ballard [Thu, 1 Aug 2013 22:18:10 +0000 (15:18 -0700)]
option: mutate() and mutate_default() should return bool

Fixes #8047.

10 years agofixed the buffer to make it a more reasonable size
toddaaro [Fri, 2 Aug 2013 23:53:04 +0000 (16:53 -0700)]
fixed the buffer to make it a more reasonable size

10 years agomodified logging function to truncate output and adjusted error output formatting...
toddaaro [Fri, 2 Aug 2013 23:48:29 +0000 (16:48 -0700)]
modified logging function to truncate output and adjusted error output formatting tests to be compatible with both the new and old runtimes

10 years agoMerge pull request #8244 from thestinger/for
Daniel Micay [Sat, 3 Aug 2013 07:07:20 +0000 (00:07 -0700)]
Merge pull request #8244 from thestinger/for

make `for` parse as `foreach` does

r=huonw, bors is acting up and this has been run through the try bots

10 years agorm obsolete documentation on `for`
Daniel Micay [Sat, 3 Aug 2013 05:33:06 +0000 (01:33 -0400)]
rm obsolete documentation on `for`

it is documented in the container/iterator tutorial, not the basic
tutorial

10 years agomake `for` parse as `foreach` does
Daniel Micay [Sat, 3 Aug 2013 03:20:22 +0000 (23:20 -0400)]
make `for` parse as `foreach` does

Closes #6997

10 years agoreplace all remaining `for` with `foreach` or `do`
Daniel Micay [Fri, 2 Aug 2013 06:17:20 +0000 (02:17 -0400)]
replace all remaining `for` with `foreach` or `do`

10 years agoVim highlighting: remove `foreach` keyword
Chris Morgan [Sat, 3 Aug 2013 05:56:18 +0000 (15:56 +1000)]
Vim highlighting: remove `foreach` keyword

10 years agoSuppress a libuv leak on mac
Brian Anderson [Sat, 3 Aug 2013 05:05:32 +0000 (22:05 -0700)]
Suppress a libuv leak on mac

I suspect that this is a race between process exit and the termination of
worker threads used by libuv (if I sleep before exit it doesn't leak). This
isn't going to cause any real problems but should probably be fixed at
some point.

10 years agoauto merge of #8235 : pcwalton/rust/unsafe-extern-fns, r=pcwalton
bors [Sat, 3 Aug 2013 05:05:03 +0000 (22:05 -0700)]
auto merge of #8235 : pcwalton/rust/unsafe-extern-fns, r=pcwalton

r? @brson

10 years agolibrustc: Disallow "unsafe" for external functions
Patrick Walton [Fri, 2 Aug 2013 21:30:00 +0000 (14:30 -0700)]
librustc: Disallow "unsafe" for external functions

10 years agolibrustc: Introduce a new visitor type based on traits and port syntax to it.
Patrick Walton [Sat, 20 Jul 2013 01:42:11 +0000 (18:42 -0700)]
librustc: Introduce a new visitor type based on traits and port syntax to it.

This is preparation for removing `@fn`.

This does *not* use default methods yet, because I don't know
whether they work. If they do, a forthcoming PR will use them.

This also changes the precedence of `as`.

10 years agoHighlight sigils and operators in Vim.
Chris Morgan [Sat, 3 Aug 2013 04:36:27 +0000 (14:36 +1000)]
Highlight sigils and operators in Vim.

Sigil highlighting isn't perfect (especially how it handles ``&``) but
after having used it for a week I feel it to be considerably nicer than
nothing. As usual, if you don't like it, you can turn it off easily by
overriding the default highlighting.

Generics are not handled specially; this means that for something like
``S<T>``, the ``<`` and ``>`` are highlighted as operators. For myself,
I like this, and there is no way to make it properly context aware
without expanding the syntax matching enormously.

Also, special characters are highlighted properly in strings/chars, e.g.
``"\x00"`` or ``'\Ufedcba98'`` appropriately.

10 years agoBump fd limit on macos when running rt tests
Kevin Ballard [Thu, 18 Jul 2013 01:50:53 +0000 (18:50 -0700)]
Bump fd limit on macos when running rt tests

OS X defaults the ulimit for open files to 256 for programs launched
from the Terminal (GUI apps get a higher default). Unfortunately this is
too low for the rt tests, which deliberately overcommit and create a lot
of threads (which means a lot of schedulers, and each scheduler needs at
least 2 fds).

By calling sysctl() and setrlimit() we can bump the fd limit up to the
maximum allowed (on stock OS X it's 10240).

Fixes #7772.

10 years agoRevert "std::rt: Use a constant 4 threads for multithreaded sched tests"
Kevin Ballard [Fri, 2 Aug 2013 01:23:30 +0000 (18:23 -0700)]
Revert "std::rt: Use a constant 4 threads for multithreaded sched tests"

This workaround was less than ideal. A better solution is to raise the
fd limit.

This reverts commit 49b72bdd77916e27aaf95909516702c1450f11ac.

10 years agoauto merge of #8174 : DaGenix/rust/digest-improvements, r=brson
bors [Sat, 3 Aug 2013 02:29:00 +0000 (19:29 -0700)]
auto merge of #8174 : DaGenix/rust/digest-improvements, r=brson

Same content as #8097, but bors had an issue with that pull request. Opening a new one.

10 years agoAdd default implementation of Map::contains_key function
Stepan Koltsov [Sat, 3 Aug 2013 01:54:05 +0000 (05:54 +0400)]
Add default implementation of Map::contains_key function

Map::contains_key can be implemented with Map::find.

Remove several implementations of contains_key.

10 years agoSha1: Update Sha1 to use new functionality in cryptoutil.rs
Palmer Cox [Tue, 30 Jul 2013 04:07:59 +0000 (00:07 -0400)]
Sha1: Update Sha1 to use new functionality in cryptoutil.rs

10 years agoCrypto: Add overflow checking addition functions.
Palmer Cox [Tue, 30 Jul 2013 04:07:51 +0000 (00:07 -0400)]
Crypto: Add overflow checking addition functions.

Added functions to cryptoutil.rs that perform an addition after shifting
the 2nd parameter by a specified constant. These function fail!() if integer
overflow will result. Updated the Sha2 implementation to use these functions.

10 years agoCrypto: Add large input tests for all Digests
Palmer Cox [Tue, 30 Jul 2013 01:12:20 +0000 (21:12 -0400)]
Crypto: Add large input tests for all Digests

Create a helper function in cryptoutil.rs which feeds 1,000,000 'a's into
a Digest with varying input sizes and then checks the result. This is
essentially the same as one of Sha1's existing tests, so, that test was
re-implemented using this method. New tests were added using this method for
Sha512 and Sha256.

10 years agoCrypto: Remove DigestUtil and convert to default methods on the Digest trait.
Palmer Cox [Sat, 27 Jul 2013 19:12:49 +0000 (15:12 -0400)]
Crypto: Remove DigestUtil and convert to default methods on the Digest trait.

10 years agoSha2: Re-write the Sha2 compression functions to improve performance.
Palmer Cox [Sat, 27 Jul 2013 18:03:57 +0000 (14:03 -0400)]
Sha2: Re-write the Sha2 compression functions to improve performance.

The Sha2 compression functions were re-written to execute the message
scheduling calculations in the same loop as the rest of the compression
function. The compiler is able to generate much better code. Additionally,
innermost part of the compression functions were turned into macros to
reduce code duplicate and to make the functions more concise.

10 years agoSha2: Create cryptoutil.rs and re-write the Sha2 module to make use of it.
Palmer Cox [Sat, 27 Jul 2013 18:02:18 +0000 (14:02 -0400)]
Sha2: Create cryptoutil.rs and re-write the Sha2 module to make use of it.

There are 2 main pieces of functionality in cryptoutil.rs:
* A set of unsafe function for efficiently reading and writing u32 and u64
  values. All of these functions are fairly easy to audit to confirm that
  they do what they are supposed to.
* A FixedBuffer struct. This struct keeps track of input data until there
  is enough of it to execute the a function on it which expects a fixed
  block of data.

The Sha2 module was rewritten to take advantage of the new functions in
cryptoutil as well as FixedBuffer. The result is that the duplicate code
for maintaining a buffer of input data is removed from the Sha512 and
Sha256 implementation. Additionally, the FixedBuffer code is much more
efficient than the previous code was.

10 years agoSha2: Remove the result_X() methods; move logic into the Digest impls.
Palmer Cox [Sat, 27 Jul 2013 17:59:41 +0000 (13:59 -0400)]
Sha2: Remove the result_X() methods; move logic into the Digest impls.

The result_X() methods just calculate an output of a fixed size. They don't
really have much to do with running the actually hash algorithm until the very
last step - the output. It makes much more sense to put all this logic into
the Digest impls for each specific variation on the hash function.

10 years agoSha2: Rearrage traits / impls / structs.
Palmer Cox [Sat, 27 Jul 2013 17:46:58 +0000 (13:46 -0400)]
Sha2: Rearrage traits / impls / structs.

The code was arranged so that the core Sha2 code came first, and then
all of the various implementation of Digest followed along later. The
problem is that the Sha512 compression function code is far away from
the Sha512 Digest implementation, so, if you are trying to read over
the code, you need to scroll all around the file for no good reason. The
code was rearranged so that all of the Sha512 code is in one place and
all of the Sha256 code is in another and so that all impls for a struct
are near the definition of that struct.

10 years agoSha2: Remove unecessary integer type specifications.
Palmer Cox [Sat, 27 Jul 2013 17:41:50 +0000 (13:41 -0400)]
Sha2: Remove unecessary integer type specifications.