Commit Graph

18682 Commits

Author SHA1 Message Date
Corey Richardson
118158729e Work around #8256, do not fail the task, just return None 2013-08-03 22:36:48 -04:00
Daniel Micay
9f74217d80 register snapshots 2013-08-03 21:09:28 -04:00
Daniel Micay
8ce953347c Merge pull request #8251 from chris-morgan/vim-sigil-highlighting
Highlight sigils and operators in Vim.

r=huonw, known spurious failure on one bot
2013-08-03 18:02:04 -07:00
Brian Anderson
3c9e393354 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.
2013-08-03 14:43:16 -07:00
bors
18e3db7392 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.
2013-08-03 13:40:49 -07:00
bors
b5d77d20ec 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.
2013-08-03 11:52:50 -07:00
bors
800dbffa69 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.
2013-08-03 10:04:58 -07:00
bors
34101d2320 auto merge of #8213 : kballard/rust/fd-limit, r=brson
Revert the workaround 49b72bd and instead bump the fd limit on OS X.
2013-08-03 07:46:53 -07:00
Björn Steinbrink
a51e3e46ef 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?
2013-08-03 15:03:58 +02:00
bors
6be014d23c 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.
2013-08-03 05:37:52 -07:00
Huon Wilson
c852a5bb68 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.
2013-08-03 21:00:32 +10:00
OGINO Masanori
c1ad16db5a Fix building problems in extra::unicode.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 19:57:31 +09:00
bors
2765811cb6 auto merge of #8206 : omasanori/rust/blk-to-block, r=graydon
Just for consistency.
2013-08-03 03:55:52 -07:00
bors
39fafd655a 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()`.
2013-08-03 02:10:54 -07:00
Huon Wilson
cdad7f6f3b etc: add the in keyword to the emacs mode. 2013-08-03 18:31:23 +10:00
OGINO Masanori
def88913d8 Move use statements.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:21:01 -04:00
OGINO Masanori
682939724f Rename sum -> _sum.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:20:56 -04:00
OGINO Masanori
afaca4c822 Remove unused variables.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-03 03:20:45 -04:00
Kevin Ballard
75155cd1b0 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.
2013-08-03 03:17:07 -04:00
Huon Wilson
1992765dd3 std: add benchmark for vec.mut_iter. 2013-08-03 03:13:13 -04:00
Huon Wilson
fbb7cd32c3 std: use ptr.offset where possible in the vec iterator.
Closes #8212.
2013-08-03 03:13:11 -04:00
Kevin Ballard
54e685d4fd option: mutate() and mutate_default() should return bool
Fixes #8047.
2013-08-03 03:11:11 -04:00
toddaaro
1f9c392389 fixed the buffer to make it a more reasonable size 2013-08-03 03:09:23 -04:00
toddaaro
eab749a5f3 modified logging function to truncate output and adjusted error output formatting tests to be compatible with both the new and old runtimes 2013-08-03 03:09:04 -04:00
Daniel Micay
b41d04763e make for parse as foreach does
Closes #6997
2013-08-03 03:00:42 -04:00
Daniel Micay
b3ad685f7f replace all remaining for with foreach or do 2013-08-03 03:00:42 -04:00
Chris Morgan
ceb651671a Vim highlighting: remove foreach keyword 2013-08-03 15:56:18 +10:00
Brian Anderson
8f9c1724d0 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.
2013-08-02 22:05:34 -07:00
Patrick Walton
9457ebee55 librustc: Disallow "unsafe" for external functions 2013-08-02 21:57:59 -07:00
Patrick Walton
887c656970 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`.
2013-08-02 21:57:58 -07:00
Chris Morgan
44cb1c3adb 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.
2013-08-03 14:36:27 +10:00
Kevin Ballard
2001cc043b 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.
2013-08-02 21:20:15 -07:00
Kevin Ballard
70d2be0cec 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 49b72bdd77.
2013-08-02 21:18:32 -07:00
bors
efd6eafeb4 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.
2013-08-02 19:29:00 -07:00
Stepan Koltsov
cf9e9b21d5 Add default implementation of Map::contains_key function
Map::contains_key can be implemented with Map::find.

Remove several implementations of contains_key.
2013-08-03 05:54:05 +04:00
Palmer Cox
1252472bb7 Sha1: Update Sha1 to use new functionality in cryptoutil.rs 2013-08-02 18:49:00 -04:00
Palmer Cox
4e7b0ee3cd 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.
2013-08-02 18:49:00 -04:00
Palmer Cox
281b79525b 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.
2013-08-02 18:49:00 -04:00
Palmer Cox
2cbe312343 Crypto: Remove DigestUtil and convert to default methods on the Digest trait. 2013-08-02 18:49:00 -04:00
Palmer Cox
ee3f75366c 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.
2013-08-02 18:49:00 -04:00
Palmer Cox
654c536fec 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.
2013-08-02 18:48:14 -04:00
Palmer Cox
3cac62822e 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.
2013-08-02 18:46:11 -04:00
Palmer Cox
5b01555155 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.
2013-08-02 18:46:11 -04:00
Palmer Cox
a1bbd18dc1 Sha2: Remove unecessary integer type specifications. 2013-08-02 18:46:11 -04:00
Stepan Koltsov
9046516444 Rename IpAddr -> SocketAddr, extract IpAddr from SocketAddr
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).
2013-08-03 02:06:24 +04:00
David Halperin
fe8ad14c87 Add backticks around trait name in conflicting implementations error message 2013-08-02 17:54:54 -04:00
David Halperin
77adec9c9b Add trait name to conflicting implementation error message 2013-08-02 17:54:53 -04:00
Ben Blum
43fecf3556 Add an assert_may_sleep() check on every context switch. 2013-08-02 17:31:45 -04:00
Ben Blum
92f60f4365 Don't fail from kill signals if already unwinding. 2013-08-02 17:31:45 -04:00
Ben Blum
bd35798773 (cleanup) Use more do...finally in extra::sync. 2013-08-02 17:31:45 -04:00
Ben Blum
d30cca46e6 Fix embarrassing bug where 'unkillable' would unwind improperly when it receives a kill signal. 2013-08-02 17:31:45 -04:00
Ben Blum
cde6ad3992 Fix nasty double-free bug where a newrt chan could get killed after rescheduling but before suppressing_finalize. 2013-08-02 17:31:44 -04:00
Ben Blum
be7738bfa1 Add SendDeferred trait and use it to fix #8214. 2013-08-02 17:31:44 -04:00
blake2-ppc
0504d7e57b std: Speed up str::is_utf8
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)
2013-08-02 23:20:57 +02:00
bors
f1c1f92d0c auto merge of #8221 : brson/rust/single-threaded, r=graydon
This is the last major runtime feature needed for the transition to the new scheduler.
2013-08-02 10:52:50 -07:00
bors
986df44753 auto merge of #8195 : bblum/rust/task-cleanup, r=brson
In the first commit it is obvious why some of the barriers can be changed to ```Relaxed```, but it is not as obvious for the once I changed in ```kill.rs```. The rationale for those is documented as part of the documenting commit.

Also the last commit is a temporary hack to prevent kill signals from being received in taskgroup cleanup code, which could be fixed in a more principled way once the old runtime is gone.
2013-08-02 07:31:52 -07:00
bors
af97339771 auto merge of #8193 : cmr/rust/linux-errno, r=graydon 2013-08-02 05:49:53 -07:00
bors
2460170e6a auto merge of #8188 : huonw/rust/cfg-macro, r=pcwalton
Example:

    if cfg!(test) {
       calculation_to_run_only_when_testing();
    }

Closes #8130.
2013-08-02 03:52:51 -07:00
bors
dbde42e59e auto merge of #8175 : brson/rust/nodbg, r=graydon
This stuff is ancient, unused, and tied to oldsched
2013-08-02 01:13:51 -07:00
Brian Anderson
c3fa411459 std: Implement SingleThreaded spawn mode for newsched 2013-08-02 00:26:45 -07:00
Steven Stewart-Gallus
2047026fef Fix calling destructor on uninitialized dynamic library crash.
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.
2013-08-01 23:41:33 -07:00
bors
bbcce8d95c auto merge of #8216 : thestinger/rust/range, r=huonw 2013-08-01 22:10:45 -07:00
Daniel Micay
234acad404 replace range with an external iterator 2013-08-02 00:51:14 -04:00
bors
ecefeb03cc auto merge of #8185 : alexcrichton/rust/issue-8179, r=pcwalton
* All globals marked as `pub` won't have the `internal` linkage type set
* All global references across crates are forced to use the address of the
  global in the other crate via an external reference.

r? @graydon

Closes #8179
2013-08-01 19:46:47 -07:00
bors
5890fcf872 auto merge of #8116 : toddaaro/rust/tls-tk-pr-pre, r=brson
Merged with task killing code this time around.
2013-08-01 18:01:42 -07:00
toddaaro
ce761f4980 xfailed the myserious failing test 2013-08-01 17:23:55 -07:00
OGINO Masanori
09efc4e855 Replace 'blk' -> 'block' in AstBuilder.
I didn't rename variables because they are local and are not parts of
the public interfaces.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-02 09:12:05 +09:00
bors
d346f1a40e auto merge of #8172 : brson/rust/nomorestack, r=pcwalton
The new scheduler does not yet implement split stacks
2013-08-01 16:19:37 -07:00
Kevin Ballard
aa94dfa625 str: Add method .into_owned(self) -> ~str to Str
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.
2013-08-01 15:54:58 -07:00
toddaaro
8e98eabce5 modified local to include an implementation for try_unsafe_borrow::<Task> so that the log methods will work 2013-08-01 15:38:48 -07:00
toddaaro
1d82fe5aea fixed incorrect handling of returned scheduler option and restructed scheduler functions slightly 2013-08-01 15:18:29 -07:00
toddaaro
a5f55b3ead minor tweaks - unboxed the coroutine so that it is no longer a ~ pointer inside the task struct, and also added an assert to verify that send is never called inside scheduler context as it is undefined (BROKEN) if that happens 2013-08-01 15:17:19 -07:00
toddaaro
997719c13d Fixed a race where a scheduler configured to only run tasks pinned to it would "bounch" a regular task in and out of the work queue without allowing a different scheduler to run it. 2013-08-01 15:16:01 -07:00
Ben Blum
37f385e44b Have linked failure tests run on the new scheduler instead of requiring RUST_NEWRT to test. 2013-08-01 15:16:01 -07:00
toddaaro
f7eed22387 A major refactoring that changes the way the runtime uses TLS. In the
old design the TLS held the scheduler struct, and the scheduler struct
held the active task. This posed all sorts of weird problems due to
how we wanted to use the contents of TLS. The cleaner approach is to
leave the active task in TLS and have the task hold the scheduler. To
make this work out the scheduler has to run inside a regular task, and
then once that is the case the context switching code is massively
simplified, as instead of three possible paths there is only one. The
logical flow is also easier to follow, as the scheduler struct acts
somewhat like a "token" indicating what is active.

These changes also necessitated changing a large number of runtime
tests, and rewriting most of the runtime testing helpers.

Polish level is "low", as I will very soon start on more scheduler
changes that will require wiping the polish off. That being said there
should be sufficient comments around anything complex to make this
entirely respectable as a standalone commit.
2013-08-01 15:14:00 -07:00
bors
eb5743bfb2 auto merge of #8170 : brson/rust/nopipes, r=pcwalton
The pipes compiler produced data types that encoded efficient and safe
bounded message passing protocols between two endpoints. It was also
capable of producing unbounded protocols.

It was useful research but was arguably done before its proper time.

I am removing it for the following reasons:

* In practice we used it only for producing the `oneshot` protcol  and
  the unbounded `stream` protocol and all communication in Rust use those.
* The interface between the proto! macro and the standard library
  has a large surface area and was difficult to maintain through
  language and library changes.
* It is now written in an old dialect of Rust and generates code
  which would likely be considered non-idiomatic.
* Both the compiler and the runtime are difficult to understand,
  and likewise the relationship between the generated code and
  the library is hard to understand. Debugging is difficult.
* The new scheduler implements `stream` and `oneshot` by hand
  in a way that will be significantly easier to maintain.

This shouldn't be taken as an indication that 'channel protocols'
for Rust are not worth pursuing again in the future.

Concerned parties may include: @graydon, @pcwalton, @eholk, @bblum

The most likely candidates for closing are #7666, #3018, #3020, #7021, #7667, #7303, #3658, #3295.
2013-08-01 14:37:31 -07:00
Ben Blum
963d37e821 Temporary workaround to prevent taskgroup cleanup code from failing without an exception handler. 2013-08-01 17:07:31 -04:00
Ben Blum
aeaed77301 Make a forgotten assert in comm be cfg(test)-dependent 2013-08-01 16:52:37 -04:00
Ben Blum
036a6d2f00 Document task killing design and relaxed barrier rationale. 2013-08-01 16:52:37 -04:00
Ben Blum
880246618b Relax some atomic barriers. Loosen up all that tension. There, doesn't that feel good? 2013-08-01 16:52:37 -04:00
bors
82b24559e6 auto merge of #8190 : thestinger/rust/for, r=thestinger 2013-08-01 12:52:29 -07:00
Corey Richardson
2b026718c3 Add a boatload of Linux x86/x86-64/arm errnos 2013-08-01 15:37:01 -04:00
Daniel Micay
94f1a5d6f8 migrate to foreach 2013-08-01 15:28:45 -04:00
Brian Anderson
4b3e766ac6 Remove the pipes compiler
The pipes compiler produced data types that encoded efficient and safe
bounded message passing protocols between two endpoints. It was also
capable of producing unbounded protocols.

It was useful research but was arguably done before its proper time.

I am removing it for the following reasons:

* In practice we used it only for producing the `oneshot` and `stream`
  unbounded protocols and all communication in Rust use those.
* The interface between the proto! macro and the standard library
  has a large surface area and was difficult to maintain through
  language and library changes.
* It is now written in an old dialect of Rust and generates code
  which would likely be considered non-idiomatic.
* Both the compiler and the runtime are difficult to understand,
  and likewise the relationship between the generated code and
  the library is hard to understand. Debugging is difficult.
* The new scheduler implements `stream` and `oneshot` by hand
  in a way that will be significantly easier to maintain.

This shouldn't be taken as an indication that 'channel protocols'
for Rust are not worth pursuing again in the future.
2013-08-01 12:17:32 -07:00
Huon Wilson
7c21ccc483 rustc: add a lint for for, suggesting foreach or do.
This is just to aid the transistion to the new `for` loop, by
pointing at each location where the old one occurs.
2013-08-01 15:07:19 -04:00
bors
7daea7c9c1 auto merge of #8165 : graydon/rust/2013-07-31-new-codegen-tests, r=brson
r? @pcwalton or someone
2013-08-01 09:28:36 -07:00
blake2-ppc
78cde5b9fb std: Change Times trait to use do instead of for
Change the former repetition::

    for 5.times { }

to::

    do 5.times { }

.times() cannot be broken with `break` or `return` anymore; for those
cases, use a numerical range loop instead.
2013-08-01 16:54:22 +02:00
blake2-ppc
7e210a8129 std: Replace for with do { .. } expr in std::gc
Change all users of old-style for with internal iterators to using
`do`-loops.

The code in stackwalk.rs does not actually implement the
looping protocol (no break on return false).

The code in gc.rs does not use loop breaks, nor does any code using it.

We remove the capacity to break from the loops in std::gc and implement
the walks using `do { .. }` expressions.

No behavior change.
2013-08-01 16:54:22 +02:00
blake2-ppc
e5a64f2add std: Remove the internal iterator methods from trait Set
.intersection(), .union() etc methods in trait std::container::Set use
internal iters. Remove these methods from the trait.

I reported issue #8154 for the reinstatement of iterator-based set algebra
methods to the Set trait.

For bitv and treemap, that lack Iterator implementations of set
operations, preserve them as methods directly on the types themselves.

For HashSet, these methods are replaced by the present .union_iter()
etc.
2013-08-01 16:54:22 +02:00
blake2-ppc
310e0b6e92 extra: Use external iterators in bitv implementation
Convert some internally used functions to use a external iterators.

Change all uses of remaining internal iterators to use `do` expr
2013-08-01 16:54:22 +02:00
blake2-ppc
dbcb74e247 extra: Replace for with do { .. } expr where internal iterators are used 2013-08-01 16:54:22 +02:00
blake2-ppc
b18bd785ec std: Replace for with do { .. } expr where internal iterators are used 2013-08-01 16:54:22 +02:00
blake2-ppc
02bdf90cf6 extra: Use do instead of for in extra::iter 2013-08-01 16:54:22 +02:00
blake2-ppc
6d7a0c8cbc std: Use do blocks instead of for with .iter_bytes() 2013-08-01 16:54:22 +02:00
bors
fe28ac6891 auto merge of #8164 : brson/rust/noportset, r=pcwalton
...haredChan.
2013-08-01 07:46:38 -07:00
Huon Wilson
e995d9935b syntax: implement cfg!() which evaluates to true/false where #[cfg] would keep/remove.
Example:

   if cfg!(test) {
      calculation_to_run_only_when_testing();
   }
2013-08-01 23:03:03 +10:00
bors
18d124b9b5 auto merge of #8158 : bblum/rust/task-cleanup, r=brson
r? @brson
2013-08-01 06:01:39 -07:00
bors
9824d90ffd auto merge of #8155 : stepancheg/rust/unit-zero, r=alexcrichton 2013-08-01 04:19:35 -07:00
bors
5c6069c7a9 auto merge of #8184 : thestinger/rust/retreat, r=huonw 2013-08-01 02:37:36 -07:00
Daniel Micay
1fc4db2d08 migrate many for loops to foreach 2013-08-01 05:34:55 -04:00
Alex Crichton
ea5f829307 Resolve globals having different addresses across crates
* All globals marked as `pub` won't have the `internal` linkage type set
* All global references across crates are forced to use the address of the
  global in the other crate via an external reference.
2013-08-01 01:54:34 -07:00
Daniel Micay
5f59c46e0f rc: from_{owned,const} -> from_{send,freeze} 2013-08-01 04:39:00 -04:00
bors
1b018dd9ba auto merge of #8149 : omasanori/rust/cleanup, r=alexcrichton
Fixed a warning.
2013-08-01 00:40:33 -07:00
bors
8ec70ae5de auto merge of #8162 : thestinger/rust/no-copy, r=brson 2013-07-31 22:52:31 -07:00
Daniel Micay
b57ffef37e convert pure to a reserved keyword 2013-08-01 01:00:32 -04:00
Daniel Micay
dabd476203 make in and foreach get treated as keywords 2013-08-01 00:21:13 -04:00
Graydon Hoare
4700b00ef7 register snapshots. 2013-07-31 19:38:43 -07:00
Brian Anderson
05eff5f731 extra: Remove dbg module and rt support code
This stuff is ancient, unused, and tied to oldsched
2013-07-31 18:51:57 -07:00
Brian Anderson
1d256ba6e8 test: Disable morestack tests
The new scheduler does not yet implement split stacks
2013-07-31 18:11:19 -07:00
Daniel Micay
c47be6929b remove copy as a keyword 2013-07-31 20:18:28 -04:00
Daniel Micay
4bad515854 rm ancient error for lowercase kinds
3 of these kinds no longer even exist in the CamelCase form
2013-07-31 20:18:26 -04:00
Graydon Hoare
8261f2c37c test: add more codegen tests, add copyright headers to all. 2013-07-31 15:02:22 -07:00
Brian Anderson
ebd14c92f8 std: Remove PortSet. Not supported by new scheduler. Replace uses with SharedChan. 2013-07-31 14:59:49 -07:00
bors
ef87e2cc96 auto merge of #8151 : sanxiyn/rust/atomicrmw, r=cmr
#8039 broke ARM build, and nothing uses these yet.
2013-07-31 14:58:20 -07:00
bors
66a0b5870d auto merge of #8150 : dotdash/rust/assert_bloat, r=huonw
Assertions without a message get a generated message that consists of a
prefix plus the stringified expression that is being asserted. That
prefix is currently a unique string, while a static string would be
sufficient and needs less code.
2013-07-31 12:58:22 -07:00
Ben Blum
bc7cee7bbf Move atomically to unstable::sync, and document what it actually does. Close #7872. 2013-07-31 14:37:22 -04:00
Ben Blum
2e6dc161b6 Give tasks useful names. #2891 2013-07-31 14:37:22 -04:00
bors
389aba0952 auto merge of #8146 : dotdash/rust/simple_take_glue, r=thestinger
These glue function just return void, no point in having a copy for each
type.
2013-07-31 09:22:21 -07:00
bors
9e857458d6 auto merge of #8145 : brson/rust/rttestfixes, r=pcwalton
Two commits here that fix test case dependencies on the old scheduler.
2013-07-31 07:34:24 -07:00
OGINO Masanori
6a69d27a0f Remove unused variables.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-07-31 23:22:57 +09:00
Stepan Koltsov
a5912736be Implement Zero for unit 2013-07-31 18:19:26 +04:00
bors
5d409ccd30 auto merge of #8143 : brson/rust/change-dir-lock, r=luqmana 2013-07-31 05:46:21 -07:00
bors
6296dc0d73 auto merge of #8141 : graydon/rust/foreach-in-sketch, r=brson
This is a preliminary implementation of `for ... in ... { ...}` using a transitionary keyword `foreach`. Codesize seems to be a little bit down (10% or less non-opt) and otherwise it seems quite trivial to rewrite lambda-based loops to use it. Once we've rewritten the codebase away from lambda-based `for` we can retarget that word at the same production, snapshot, rewrite the keywords in one go, and expire `foreach`.

Feedback welcome. It's a desugaring-based approach which is arguably something we should have been doing for other constructs before. I apologize both for the laziness associated with doing it this way and with any sense that I'm bending rules I put in place previously concerning "never doing desugarings". I put the expansion in `expand.rs` and would be amenable to the argument that the code there needs better factoring / more helpers / to move to a submodule or helper function. It does seem to work at this point, though, and I gather we'd like to get the shift done relatively quickly.
2013-07-31 03:58:21 -07:00
Seo Sanghyeon
428ea7d7ce Revert atomicrmw {max, min, umax, umin} 2013-07-31 19:44:20 +09:00
bors
8b7e241e02 auto merge of #8139 : brson/rust/rm-old-task-apis, r=pcwalton
This removes a bunch of options from the task builder interface that are irrelevant to the new scheduler and were generally unused anyway. It also bumps the stack size of new scheduler tasks so that there's enough room to run rustc and changes the interface to `Thread` to not implicitly join threads on destruction, but instead require an explicit, and mandatory, call to `join`.
2013-07-31 02:10:24 -07:00
Björn Steinbrink
c725926cf5 Reduce code bloat from assert!()
Assertions without a message get a generated message that consists of a
prefix plus the stringified expression that is being asserted. That
prefix is currently a unique string, while a static string would be
sufficient and needs less code.
2013-07-31 10:15:52 +02:00
bors
8a737b5020 auto merge of #8138 : Dretch/rust/posix-path-push, r=pcwalton
\ is allowed inside file names on linux, for example my system has a file at:

`/run/udev/firmware-missing/intel-ucode\x2f06-3a-09`
2013-07-31 00:22:21 -07:00
Björn Steinbrink
fac18c1cb8 Unify the take glue functions for unique pointer types
These glue function just return void, no point in having a copy for each
type.
2013-07-31 08:21:26 +02:00
bors
4fbd37d4bd auto merge of #8135 : dim-an/rust/master, r=pcwalton
Fix std::getopt::opts_str

Closes #6492 (std::getopt::opts_str fails for arguments other than the first one).
2013-07-30 22:34:20 -07:00
Brian Anderson
0a87589b94 test: Remove a test of the oldsched runtime api 2013-07-30 21:51:18 -07:00
Brian Anderson
11fc1fd485 test: Use a test extern in various foreign fn tests 2013-07-30 21:13:55 -07:00
Brian Anderson
91f1ab4896 rt: Use the correct global change_dir lock 2013-07-30 21:06:02 -07:00
bors
5633a5363b auto merge of #8008 : bblum/rust/select, r=brson
Main logic in ```Implement select() for new runtime pipes.```. The guts of the ```PortOne::try_recv()``` implementation are now split up across several functions, ```optimistic_check```, ```block_on```, and ```recv_ready```.

There is one weird FIXME I left open here, in the "implement select" commit -- an assertion I couldn't get to work in the receive path, on an invariant that for some reason doesn't hold with ```SharedPort```. Still investigating this.
2013-07-30 18:58:17 -07:00
Graydon Hoare
a696f0fecb test: add testcases for external iterators using foreach. 2013-07-30 18:50:28 -07:00
Graydon Hoare
62b6fa0943 rustc: silence unused-var warning. 2013-07-30 18:50:28 -07:00
Graydon Hoare
e5b0f1d132 rustc: fix a pp bug. 2013-07-30 18:50:28 -07:00
Graydon Hoare
c29e9fb60b syntax: implement foreach .. in .. { .. } via desugaring. 2013-07-30 18:50:28 -07:00
Brian Anderson
33df9fc1d0 std: Remove foreign_stack_size spawn option. Irrelevant to future FFI changes 2013-07-30 17:10:23 -07:00
Brian Anderson
8f835d42d7 std: Remove get_task function. Unused 2013-07-30 17:10:21 -07:00
bors
6534b4d4ce auto merge of #8115 : bjz/rust/num-traits, r=brson
Continues #4819
2013-07-30 17:10:19 -07:00
Graydon Hoare
9a2d183d6a syntax: add temporary 'foreach' keyword. 2013-07-30 16:11:49 -07:00
Graydon Hoare
a8840d70a5 syntax: add 'in' keyword 2013-07-30 16:11:49 -07:00
Gareth Smith
de0092c48e No longer treat \ as a path separator on posix systems. 2013-07-30 23:43:39 +01:00
OGINO Masanori
5ec1d5b69d FALSE is not 1u8 but 0u8, of cource.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-07-31 07:13:38 +09:00
Brian Anderson
81dda9d9cb std: Remove CurrentScheduler spawn mode. Unused 2013-07-30 14:23:46 -07:00
Brian Anderson
08480e4fda std: Remove ExistingScheduler spawn mode. Unused 2013-07-30 14:23:46 -07:00
Brian Anderson
5d2b8d4372 std: Remove PlatformThread spawn mode. Obsolete 2013-07-30 14:23:45 -07:00
Brian Anderson
85fd75ac47 std: Remove ThreadPerTask spawn mode. Unimplemented 2013-07-30 14:23:45 -07:00
Brian Anderson
cb9ee7f5be std: Remove ManualThreads spawn mode 2013-07-30 14:23:45 -07:00
Brian Anderson
0144c83213 std::rt: Change Thread interface to require an explicit join
Makes it more obvious what's going on
2013-07-30 14:23:44 -07:00
Brian Anderson
7265cc6530 std::rt: Use 2MB stacks
Seems to be around the minimum needed by rustc without split stacks
2013-07-30 14:17:56 -07:00
Dmitry Ermolov
ef7e94550c Fix comment. 2013-07-31 00:08:53 +04:00
Dmitry Ermolov
ed0f014935 Fix opts_str.
opt_val doesn't not fail! for missing options.

Closes #6492
2013-07-30 23:26:52 +04:00
Dmitry Ermolov
0ed8713d79 Modify test to expose issue #6492. 2013-07-30 23:23:19 +04:00
bors
436d9fa45d auto merge of #8133 : blake2-ppc/rust/overlong-utf8, r=cmr
Fix is_utf8 and UTF-8 char width functions to deny non-canonical 'overlong encodings' in UTF-8.

We address the function is_utf8 to make it more strict and correct, but no changes are made to the handling of invalid UTF-8.

Fixes issue #3787
2013-07-30 12:16:20 -07:00
blake2-ppc
8f9014c159 std: Mark the static constants in str.rs as private
static variables are pub by default, which is not reflected in our code
(we need to use priv).
2013-07-30 19:34:54 +02:00
Ben Blum
6b75e92afe UnsafeArc methods return unsafe pointers, so are not themselves unsafe. 2013-07-30 13:19:26 -04:00
Ben Blum
fa8102ab4a Unkillable is not unsafe. Close #7832. 2013-07-30 13:19:25 -04:00
Ben Blum
9675cd311a (cleanup) Fix unimplemented message for kill_all in newsched. 2013-07-30 13:19:25 -04:00
Ben Blum
3f6b4c24ec Add a better-for-testing optimistic_check() for pipes with cfg(test). 2013-07-30 13:19:25 -04:00
Ben Blum
cccfa8acc4 Add test cases for select 2013-07-30 13:19:25 -04:00
Ben Blum
f34fadd126 Implement select() for new runtime pipes. 2013-07-30 13:19:25 -04:00
blake2-ppc
aa89325cb0 std: Add from_bytes test for utf-8 using codepoints above 0xffff 2013-07-30 19:16:12 +02:00
blake2-ppc
b4ff95599a std: Deny overlong encodings in UTF-8
An 'overlong encoding' is a codepoint encoded non-minimally using the
utf-8 format. Denying these enforce each codepoint to have only one
valid representation in utf-8.

An example is byte sequence 0xE0 0x80 0x80 which could be interpreted as
U+0, but it's an overlong encoding since the canonical form is just
0x00.

Another example is 0xE0 0x80 0xAF which was previously accepted and is
an overlong encoding of the solidus "/". Directory traversal characters
like / and . form the most compelling argument for why this commit is
security critical.

Factor out common UTF-8 decoding expressions as macros. This commit will
partly duplicate UTF-8 decoding, so it is now present in both
fn is_utf8() and .char_range_at(); the latter using an assumption of
a valid str.
2013-07-30 19:16:12 +02:00
Jordi Boggiano
f7ebab4403 Do not enforce two newlines after the options 2013-07-30 18:40:01 +02:00
blake2-ppc
6dd185930d std: Disallow bytes 0xC0, 0xC1 (192, 193) in utf-8
Bytes 0xC0, 0xC1 can only be used to start 2-byte codepoint encodings,
that are 'overlong encodings' of codepoints below 128.

The reference given in a comment -- https://tools.ietf.org/html/rfc3629
-- does in fact already exclude these bytes, so no additional comment
should be needed in the code.
2013-07-30 17:25:29 +02:00
bors
576f395ddf auto merge of #8121 : thestinger/rust/offset, r=alexcrichton
Closes #8118, #7136

~~~rust
extern mod extra;

use std::vec;
use std::ptr;

fn bench_from_elem(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let v: ~[u8] = vec::from_elem(1024, 0u8);
    }
}

fn bench_set_memory(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let mut v: ~[u8] = vec::with_capacity(1024);
        unsafe {
            let vp = vec::raw::to_mut_ptr(v);
            ptr::set_memory(vp, 0, 1024);
            vec::raw::set_len(&mut v, 1024);
        }
    }
}

fn bench_vec_repeat(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let v: ~[u8] = ~[0u8, ..1024];
    }
}
~~~

Before:

    test bench_from_elem ... bench: 415 ns/iter (+/- 17)
    test bench_set_memory ... bench: 85 ns/iter (+/- 4)
    test bench_vec_repeat ... bench: 83 ns/iter (+/- 3)

After:

    test bench_from_elem ... bench: 84 ns/iter (+/- 2)
    test bench_set_memory ... bench: 84 ns/iter (+/- 5)
    test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-30 07:01:19 -07:00
Marvin Löbel
e33fca9ffe Added str::char_offset_iter() and str::rev_char_offset_iter()
Renamed bytes_iter to byte_iter to match other iterators
Refactored str Iterators to use DoubleEnded Iterators and typedefs instead of wrapper structs
Reordered the Iterator section
Whitespace fixup
Moved clunky `each_split_within` function to the one place in the tree where it's actually needed
Replaced all block doccomments in str with line doccomments
2013-07-30 12:55:48 +02:00
bors
d75ab4a5d7 auto merge of #8107 : michaelwoerister/rust/end_of_spanned, r=cmr
Contiunation of naming cleanup in `libsyntax::ast`:
```rust
ast::node_id => ast::NodeId
ast::local_crate => ast::LOCAL_CRATE
ast::crate_node_id => ast::CRATE_NODE_ID
ast::blk_check_mode => ast::BlockCheckMode
ast::ty_field => ast::TypeField
ast::ty_method => ast::TypeMethod
```
Also moved span field directly into `TypeField` struct and cleaned up overlooked `ast::CrateConfig` renamings from last pull request.

Cheers,
Michael
2013-07-30 01:37:17 -07:00
Daniel Micay
ef870d37a5 implement pointer arithmetic with GEP
Closes #8118, #7136

~~~rust
extern mod extra;

use std::vec;
use std::ptr;

fn bench_from_elem(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let v: ~[u8] = vec::from_elem(1024, 0u8);
    }
}

fn bench_set_memory(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let mut v: ~[u8] = vec::with_capacity(1024);
        unsafe {
            let vp = vec::raw::to_mut_ptr(v);
            ptr::set_memory(vp, 0, 1024);
            vec::raw::set_len(&mut v, 1024);
        }
    }
}

fn bench_vec_repeat(b: &mut extra::test::BenchHarness) {
    do b.iter {
        let v: ~[u8] = ~[0u8, ..1024];
    }
}
~~~

Before:

    test bench_from_elem ... bench: 415 ns/iter (+/- 17)
    test bench_set_memory ... bench: 85 ns/iter (+/- 4)
    test bench_vec_repeat ... bench: 83 ns/iter (+/- 3)

After:

    test bench_from_elem ... bench: 84 ns/iter (+/- 2)
    test bench_set_memory ... bench: 84 ns/iter (+/- 5)
    test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-07-30 02:50:31 -04:00
bors
8695bc74a0 auto merge of #7223 : steveklabnik/rust/vec_initial_docs, r=pcwalton
Let's explain more of what this module is about, not just 'vectors.'
2013-07-29 23:49:23 -07:00
blake2-ppc
99490ad5ba std: Remove macro in vec that's only used once 2013-07-30 02:52:01 +02:00
blake2-ppc
ae09d95160 extra: Add .rev_iter() for bitv 2013-07-30 02:48:40 +02:00
blake2-ppc
5307d3674e std: Implement Extendable for hashmap, str and trie 2013-07-30 02:32:38 +02:00
blake2-ppc
f8ae526f70 extra: Implement iterator::Extendable 2013-07-30 02:06:49 +02:00
blake2-ppc
f68621326e extra: Implement RandomAccessIterator for RingBuf 2013-07-30 01:48:17 +02:00
blake2-ppc
2f10d1e295 extra: Implement DoubleEnded and RandomAccess iterators for bitv 2013-07-30 01:48:17 +02:00
blake2-ppc
2ff84124f0 std: Remove RandomAccessIterator impl for VecMutIterator
The RandomAccessIterator implementation is not sound for the mutable vec
iterator, and makes it easy to duplicate &mut element pointers.
2013-07-30 01:48:17 +02:00
blake2-ppc
66fccdb295 std: Tests for RandomAccessIterators 2013-07-30 01:48:17 +02:00
blake2-ppc
630627c3d4 std: Implement RandomAccessIterator for iterator adaptors
Implement RAI where possible for iterator adaptors such as Map,
Enumerate, Skip, Take, Zip, Cycle (all of the requiring that the adapted
iterator also implements RAI).
2013-07-30 01:48:17 +02:00
blake2-ppc
5d4af58c1d iterator: implement size_hint() for FlatMap 2013-07-30 01:48:17 +02:00
blake2-ppc
4b2931c90f iterator: implement DoubleEndedIterator for FlatMap 2013-07-30 01:48:17 +02:00
Brendan Zabarauskas
4f65fc7ef2 Improve std::num module description, and fix some formatting 2013-07-30 08:59:43 +10:00
Brendan Zabarauskas
b6ea0538a9 Add some missing method wrappers to std::num 2013-07-30 08:58:46 +10:00
bors
bb996bf92e auto merge of #8090 : blake2-ppc/rust/iterator-adaptor-names, r=pcwalton
Drop the "Iterator" suffix for the the structs in std::iterator.
Filter, Zip, Chain etc. are shorter type names for when iterator
pipelines need their types written out in full in return value types, so
it's easier to read and write. the iterator module already forms enough
namespace.
2013-07-29 15:49:18 -07:00
bors
d34016d109 auto merge of #8109 : blake2-ppc/rust/extern-fn-clone, r=thestinger
Implement Clone and DeepClone for functions with 0 to 8 arguments.  `extern fn()` is implicitly copyable so it's simple, except there is no way to implement it generically over #n function arguments.

Allows deriving of Clone on structs containing `extern "Rust" fn`.
2013-07-29 14:01:24 -07:00
Steve Klabnik
538fbc38c9 Adding an initial description to vec.rs.
Let's explain more of what this module is about, not just 'vectors.'
2013-07-29 16:18:41 -04:00
Ben Blum
7326bc879e Optimize try_recv to not require the two context switches when data is available. 2013-07-29 16:04:16 -04:00
Ben Blum
1137fbd9ab Remove ChanOneHack/PortOneHack extra allocation 2013-07-29 16:04:16 -04:00
bors
2830d7d013 auto merge of #8032 : catamorphism/rust/rustpkg-tags, r=graydon
r? @graydon    Package IDs can now be of the form a/b/c#FOO, where (if a/b/c is
    a git repository) FOO is any tag in the repository. Non-numeric
    tags only match against package IDs with the same tag, and aren't
    compared linearly like numeric versions.
    
 While I was at it, refactored the code that calls `git clone`,  and segregated build output properly for different packages.
2013-07-29 11:04:25 -07:00
blake2-ppc
11aad20cf8 std: Implement Clone and DeepClone for extern "Rust" fn
Implement Clone and DeepClone for functions with 0 to 8 arguments.
2013-07-29 19:43:21 +02:00
bors
63c9b112b5 auto merge of #8003 : crnobog/rust/case-insensitive-error-prefix, r=cmr
Paths are case insensitive on windows and rustc and compiletest may disagree on casing.
Fixes test compile-fail/circular_modules_main on win32
2013-07-29 07:31:24 -07:00
Michael Woerister
8a329770b6 New naming convention for ast::{node_id, local_crate, crate_node_id, blk_check_mode, ty_field, ty_method} 2013-07-29 16:16:48 +02:00
bors
8413d4769f auto merge of #8085 : mrordinaire/rust/percent-p, r=huonw
pull request for #8011
2013-07-29 05:40:26 -07:00
Do Nhat Minh
79f1052b19 Added %p directive to fmt!, which expects *T as argument 2013-07-29 20:34:01 +08:00
bors
27812ea5e0 auto merge of #8091 : kevinmehall/rust/const-struct-base, r=alexcrichton
With an expression like

    static w : foo = foo { a:5, ..x };

Rust currently gives the error "constant contains unimplemented expression type". This branch implements support for constant structs with `..base`.
2013-07-28 20:34:29 -07:00
blake2-ppc
4b45f47881 std: Rename Iterator adaptor types to drop the -Iterator suffix
Drop the "Iterator" suffix for the the structs in std::iterator.
Filter, Zip, Chain etc. are shorter type names for when iterator
pipelines need their types written out in full in return value types, so
it's easier to read and write. the iterator module already forms enough
namespace.
2013-07-29 04:20:56 +02:00
Kevin Mehall
1493141bfd Add support for ..base on static struct initializers. 2013-07-28 22:07:27 -04:00
blake2-ppc
4849a42bf6 std: Implement FromIterator for ~str
FromIterator initially only implemented for Iterator<char>, which is the
type of the main iterator.
2013-07-29 02:40:28 +02:00
bors
4cc3bbb83d auto merge of #8095 : jmgrosen/rust/no-iterator-prefixes, r=pcwalton
Resolves #8093
2013-07-28 15:46:37 -07:00
jmgrosen
a0f0f3012e Refactored vec and str iterators to remove prefixes 2013-07-28 13:37:35 -07:00
bors
6dc5e2c61f auto merge of #8046 : kmcallister/rust/unused-log, r=pcwalton 2013-07-28 12:52:25 -07:00
Björn Steinbrink
075560a9f2 Free intermediate translation results as soon as possible
This fixes the recently introduced peak memory usage regression by
freeing the intermediate results as soon as they're not required
anymore instead of keeping them around for the whole compilation
process.

Refs #8077
2013-07-28 20:02:31 +02:00
Stepan Koltsov
b92d1ea723 ReaderUtil::each_byte shouldn't include EOF byte -- Issue #5056 2013-07-28 16:53:00 +04:00
bors
5842ab36b8 auto merge of #8087 : Aatch/rust/atomics, r=huonw
Adds a fence operation to close #8061

Also adds static initializers to for atomic types. Since the fields are private, you aren't able to have `static mut` variables that are an atomic type. Each atomic type's initializer starts at a 0-value (so unset for `AtomicFlag` and false for `AtomicBool`).
2013-07-28 03:55:22 -07:00
bors
fe9929e303 auto merge of #8086 : luqmana/rust/rhelp, r=Aatch
#7617 

While the code that was there should've been perfectly fine (and seemingly is on linux at least) there seems to be some sort of weird interaction going on with statics and vectors. I couldn't get a smaller test case to reproduce that behaviour. The for loop in `rust::usage` seemingly just goes past the end of the vector thus getting garbage which it tries to pass to malloc somewhere down the line.

In any case, using a fixed length vector seems to mitigate this.
2013-07-28 02:07:27 -07:00
Luqman Aden
7bd6a92a5a librust: Stop rust tool from crashing on macos. 2013-07-28 04:52:13 -04:00
James Miller
639819f3d9 Fix spelling errors 2013-07-28 20:45:23 +12:00
James Miller
5c7e016700 Add static initializers for atomics 2013-07-28 20:26:49 +12:00
James Miller
4a1a0fbed5 Add an atomic fence intrinsic 2013-07-28 20:26:49 +12:00
bors
20454da2db auto merge of #8069 : erickt/rust/maikklein, r=erickt
Good evening,

This is a superset of @MaikKlein's #7969 commit, that I've fixed up to compile. I had a couple commits I wanted to do on top of @MaikKlein's work that I didn't want to bitrot.
2013-07-28 00:19:21 -07:00
Erick Tryzelaar
b147d70b08 std: cleanup imports in result::tests 2013-07-27 23:42:53 -07:00
Erick Tryzelaar
3478589b99 std and rustc: cleanup uses of result methods 2013-07-27 23:42:53 -07:00
Erick Tryzelaar
ea106f72f7 core: correct the casing of result::{Ok,Err} in the docs 2013-07-27 23:42:53 -07:00
Erick Tryzelaar
796b3371f9 std: Put the option tests into a tests submodule 2013-07-27 23:42:53 -07:00
Erick Tryzelaar
03a16dbb8e std: fix the casing of option::{Some,None} in the docs 2013-07-27 23:41:10 -07:00
Erick Tryzelaar
2a68c719f4 to_either + fixes 2013-07-27 23:41:09 -07:00
Erick Tryzelaar
aad53cb6e2 cleanup .map and .map_err 2013-07-27 23:41:09 -07:00
maikklein
9dc1de4c9e cleanup .get and .get_err 2013-07-27 23:41:09 -07:00
maikklein
f6bcf5d5f1 cleanup .chain and .chain_err + fixing other files 2013-07-27 23:41:09 -07:00
Erick Tryzelaar
e308167a2f cleanup .unwrap and .unwrap_err fixing io tests 2013-07-27 23:41:09 -07:00
Erick Tryzelaar
4eb95f6d1c cleanup .iter and .iter_err 2013-07-27 23:41:09 -07:00
Erick Tryzelaar
225f1c760d cleanup get_ref 2013-07-27 23:41:09 -07:00
Steven Stewart-Gallus
39b3a0561f Fix nits. 2013-07-27 22:06:29 -07:00
Steven Stewart-Gallus
d0b7515aed Change concurrency primitives to standard naming conventions
To be more specific:

`UPPERCASETYPE` was changed to `UppercaseType`
`type_new` was changed to `Type::new`
`type_function(value)` was changed to `value.method()`
2013-07-27 22:06:29 -07:00
bors
3078e83c3f auto merge of #8076 : omasanori/rust/cleanup, r=huonw
A cleanup suggested on #7922.
2013-07-27 20:13:22 -07:00
bors
82b29ae5a5 auto merge of #7864 : brson/rust/start-on-main-thread, r=brson
Applications that need to use the GUI can override start and set up the runtime using
this function.
2013-07-27 18:25:24 -07:00
Brian Anderson
34a27db8bf std::rt: Add start_on_main_thread function
Applications that need to use the GUI can override start and set up the runtime using
this function.
2013-07-27 17:36:14 -07:00
bors
b027c5fce3 auto merge of #8074 : thestinger/rust/iterator, r=cmr
d7c9bb4 r=alexcrichton
7ae17e0 r=huonw
2013-07-27 16:37:27 -07:00
bors
098106870e auto merge of #8077 : graydon/rust/reorganize-driver, r=pcwalton
The purpose here is to get rid of compile_upto, which pretty much always requires the user to read the source to figure out what it does. It's replaced by a sequence of obviously-named functions:

  - phase_1_parse_input(sess, cfg, input);
  - phase_2_configure_and_expand(sess, cfg, crate);
  - phase_3_run_analysis_passes(sess, expanded_crate);
  - phase_4_translate_to_llvm(sess, expanded_crate, &analysis, outputs);
  - phase_5_run_llvm_passes(sess, &trans, outputs);
  - phase_6_link_output(sess, &trans, outputs); 

Each of which takes what it takes and returns what it returns, with as little variation as possible in behaviour: no "pairs of options" and "pairs of control flags". You can tell if you missed a phase because you will be missing a `phase_N` call to some `N` between 1 and 6.

It does mean that people invoking librustc from outside need to write more function calls. The benefit is that they can _figure out what they're doing_ much more easily, and stop at any point, rather than further overloading the tangled logic of `compile_upto`.
2013-07-27 14:49:28 -07:00
Daniel Micay
fe955e7b06 iterator: add an Extendable trait 2013-07-27 17:42:10 -04:00
Daniel Micay
ffe549daf5 vec: replace some as_mut_buf with to_mut_ptr 2013-07-27 17:30:29 -04:00
bors
32622cef99 auto merge of #8078 : luqmana/rust/gst, r=Aatch
Fixes #5917 by not trying to treat `&[T]` as a slice since it already is one.
2013-07-27 13:01:32 -07:00
blake2-ppc
7ae17e0964 Remove dummy type parameters from iterator adaptors
With the recent fixes to method resolution, we can now remove the
dummy type parameters used as crutches in the iterator module.

For example, the zip adaptor type is just ZipIterator<T, U> now.
2013-07-27 14:37:55 -04:00
Daniel Micay
d7c9bb4b68 vec: add mut_slice_{to,from}
Closes #8066
2013-07-27 14:36:52 -04:00
Daniel Micay
d6bc438bbc make RandomAccessIterator inherit from Iterator 2013-07-27 14:36:52 -04:00
bors
5157e05049 auto merge of #8036 : sfackler/rust/container-impls, r=msullivan
A couple of implementations of Container::is_empty weren't exactly
self.len() == 0 so I left them alone (e.g. Treemap).
2013-07-27 11:16:31 -07:00
bors
0522955d10 auto merge of #8070 : luqmana/rust/nom, r=alexcrichton
Fixes #5972.
2013-07-27 08:58:33 -07:00
bors
aa8f79d6cf auto merge of #8067 : alexcrichton/rust/issue-3636, r=huonw
Allow some common ones that are good for examples, however.

Closes #3636
2013-07-27 07:10:36 -07:00
bors
ed20fcc459 auto merge of #8060 : Blei/rust/fix-obsolete-extern-visibility-span, r=pcwalton 2013-07-27 05:25:34 -07:00
bors
e7211948a5 auto merge of #8045 : michaelwoerister/rust/destructuring, r=jdm
As the title says, valid debug info is now generated for any kind of pattern-based bindings like an example from the automated tests: 
```rust
let ((u, v), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue) =
    ((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33);  
```
(Not that you would necessarily want to do a thing like that :P )

Fixes #2533
2013-07-27 03:37:35 -07:00
bors
15310ba7c2 auto merge of #8040 : luqmana/rust/rtn, r=brson
Implements various missing tcp & udp methods.. Also fixes handling ipv4-mapped/compatible ipv6 addresses and addresses the XXX on `status_to_maybe_uv_error`.

r? @brson
2013-07-27 01:49:35 -07:00
Luqman Aden
68b61e8cc9 Add test for #5917. 2013-07-27 04:47:12 -04:00
Luqman Aden
4a85b08e08 librustc: Stop trying to make invalid slice with vec in static. 2013-07-27 04:47:12 -04:00
Graydon Hoare
413446c85b rustc: reorganize driver, replace compile_upto with multiple more-obvious functions. 2013-07-27 00:48:05 -07:00
OGINO Masanori
8d654fc41d Remove unnecessary #[path = "***/mod.rs"] lines.
Fixes #7922.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-07-27 15:53:30 +09:00
bors
c5194740a7 auto merge of #8001 : crnobog/rust/xfail-win32-7999, r=cmr 2013-07-26 23:52:33 -07:00
Luqman Aden
c32b26be10 librustc: Unify name mangling for functions and statics. 2013-07-27 01:50:20 -04:00
bors
300ba1cc5c auto merge of #8050 : msullivan/rust/cleanup, r=graydon
And a couple other things. Fix up some unused variable warnings, and improve the camel case lint message a little.
2013-07-26 21:43:38 -07:00
Michael Sullivan
07361802a2 Register snapshots. 2013-07-26 20:43:18 -07:00