Commit Graph

27570 Commits

Author SHA1 Message Date
bors
6f430c4426 auto merge of #13084 : Havvy/rust/master, r=alexcrichton
The indentation looks off in the guide because the main() function is not shown, so I'm dedenting the visible function.
2014-03-22 14:16:50 -07:00
bors
7e7a5e3d3e auto merge of #13076 : FlaPer87/rust/remove-freeze, r=alexcrichton
This PR removes the `Freeze` kind and the `NoFreeze` marker completely.

Fixes #12577

cc @nikomatsakis r?
2014-03-22 13:01:52 -07:00
Ryan Scheel (Havvy)
a73d2c70d4 Unindent stringifier() in tasks guide 2014-03-22 11:54:19 -07:00
Edward Wang
7c3ed86e5a Get rid of @Cell 2014-03-23 02:53:35 +08:00
bors
0e6f90eb89 auto merge of #12995 : Kroisse/rust/vec_ng_mut_slices, r=alexcrichton
These functions are implemented for &mut [T], but std::vec_ng::Vec has not yet.
2014-03-22 11:06:46 -07:00
Eunchong Yu
5b03050f66 Add Vec::mut_slice_from(), mut_slice_to(), and mut_split_at() 2014-03-23 02:26:25 +09:00
bors
403e869571 auto merge of #13053 : alexcrichton/rust/removing-ref-cell-get, r=huonw
This commit removes the `get()` method from `Ref` and `RefMut` in favor of the `*` operator, and removes all usage of the `deref()` function manually from rustc, favoring using `*` instead.

Some of the code is a little wacky, but that's due to either #13044 or #13042
2014-03-22 09:51:49 -07:00
Alex Crichton
02dab5a3e7 rand: Use fill() instead of read()
It's possible for a reader to have a short read, and there's no reason the task
should fail in this scenario. By using fill(), this has a stronger guarantee
that the buffer will get filled with data.
2014-03-22 08:57:58 -07:00
Alex Crichton
5560383071 std: Add an I/O reader method to fill a buffer
I've found a common use case being to fill a slice (not an owned vector)
completely with bytes. It's posible for short reads to happen, and if you're
trying to get an exact number of bytes then this helper will be useful.
2014-03-22 08:57:58 -07:00
Alex Crichton
9dc357b8ed rustuv: Remove usage of get() 2014-03-22 08:56:21 -07:00
Alex Crichton
3fb1ed0e04 rustc: Remove all usage of manual deref()
Favor using '*' instead
2014-03-22 08:48:34 -07:00
Alex Crichton
76f0b1ad1f test: Fix fallout of removing get() 2014-03-22 08:48:20 -07:00
Alex Crichton
6a7fd8cfa5 rustdoc: Fix fallout of removing get() 2014-03-22 08:48:20 -07:00
Alex Crichton
0dbb909bf7 rustc: Fix fallout of removing get() 2014-03-22 08:48:20 -07:00
Alex Crichton
9a37416dbe arena: Fix fallout of removing get() 2014-03-22 08:48:20 -07:00
Alex Crichton
f3682b5639 syntax: Fix fallout of removing get() 2014-03-22 08:48:20 -07:00
Alex Crichton
cd510b3382 std: Remove the get() method from RefCell wrappers
This method has been entirely obsoleted by autoderef, so there's no reason for
its existence.
2014-03-22 08:48:20 -07:00
bors
5e8e1b515a auto merge of #13078 : klutzy/rust/issue-13075, r=alexcrichton
`FormatMessageW()` is called by `std::os::last_os_error()` to convert
errno into string, but the function may fail on non-english locale.
I don't know why it fails, but anyway it's better to return errno
than to `fail!()` in the case.

Fixes #13075
Fixes #13073
2014-03-22 08:36:50 -07:00
klutzy
cffe9e041d std::os: Handle FormatMessage failure
`FormatMessageW()` is called by `std::os::last_os_error()` to convert
errno into string, but the function may fail on non-english locale.
I don't know why it fails, but anyway it's better to return errno
than to `fail!()` in the case.

Fixes #13075
Fixes #13073
2014-03-22 23:57:13 +09:00
Flavio Percoco
a1cb2f5d8c doc: Remove Freeze / NoFreeze from docs 2014-03-22 15:47:34 +01:00
Flavio Percoco
90e9d8ee62 test: Remove Freeze / NoFreeze from tests 2014-03-22 15:47:34 +01:00
Flavio Percoco
b4ddee6327 std: Remove the Freeze kind and the NoFreeze marker 2014-03-22 15:47:34 +01:00
Flavio Percoco
034e1382af cell: Remove Freeze / NoFreeze 2014-03-22 15:47:34 +01:00
Flavio Percoco
16e07602f9 std::comm: Remove Freeze / NoFreeze 2014-03-22 15:47:34 +01:00
Flavio Percoco
0169abd91d sync: Remove Freeze / NoFreeze 2014-03-22 15:47:33 +01:00
Flavio Percoco
392348f347 arena: Remove Freeze / NoFreeze 2014-03-22 15:47:33 +01:00
Flavio Percoco
aa7519400e rustc: Remove special treatment for Freeze and NoFreeze
Fixes #12577
2014-03-22 15:44:13 +01:00
bors
e233a43f5a auto merge of #13062 : mbrubeck/rust/doc-edit, r=alexcrichton
This is a very minor edit to the tutorial section on references.

Reading this section for the first time, I stumbled on the phrase "a reference can be borrowed to any object."  Its meaning was clear enough once I got it, but I had to re-read it a couple of times to parse it correctly.  Something about the passive voice plus the way "reference to any object" is split up by the verb phrase.  How about this instead?
2014-03-22 07:21:44 -07:00
bors
30165e059c auto merge of #13052 : sfackler/rust/clean-refcell, r=alexcrichton
These are superfluous now that we have fixed rvalue lifetimes and Deref.

I'd also like to kill off `get` and `set`, but that'll be a large change so I want to make sure that we actually want to do that first.
2014-03-22 04:56:49 -07:00
Alex Crichton
4fdff3e44e native: Fix a possible deadlock in spawn
The OSX bots have been deadlocking recently in the rustdoc tests. I have only
been able to rarely reproduce the deadlock on my local setup. When reproduced,
it looks like the child process is spinning on the malloc mutex, which I
presume is locked with no other threads to unlock it.

I'm not convinced that this is what's happening, because OSX should protect
against this with pthread_atfork by default. Regardless, running as little code
as possible in the child after fork() is normally a good idea anyway, so this
commit moves all allocation to the parent process to run before the child
executes.

After running 6k iterations of rustdoc tests, this deadlocked twice before, and
after 20k iterations afterwards, it never deadlocked. I draw the conclusion that
this is either sweeping the bug under the rug, or it did indeed fix the
underlying problem.
2014-03-22 01:09:23 -07:00
bors
092afdba3c auto merge of #12907 : alexcrichton/rust/issue-12892, r=brson
These methods can be mistaken for general "read some bytes" utilities when
they're actually only meant for reading an exact number of bytes. By renaming
them it's much clearer about what they're doing without having to read the
documentation.

Closes #12892
2014-03-22 00:56:47 -07:00
bors
993dee4f14 auto merge of #13051 : alexcrichton/rust/issue-13047, r=thestinger
It's useful for structures which use deriving(Clone), even though it's
implicitly copyable.

Closes #13047
2014-03-21 22:41:42 -07:00
bors
069cede305 auto merge of #13036 : alexcrichton/rust/atomics, r=alexcrichton
Closes #11583, rebasing of #12430 now that we've got `Share` and better analysis with statics.
2014-03-21 21:31:42 -07:00
bors
f5357cf3ce auto merge of #13016 : huonw/rust/new-opt-vec, r=cmr
Replace syntax::opt_vec with syntax::owned_slice

The `owned_slice::OwnedSlice` is  `(*T, uint)` (i.e. a direct equivalent to DSTs `~[T]`).

This shaves two words off the old OptVec type; and also makes substituting in other implementations easy, by removing all the mutation methods. (And also everything that's very rarely/never used.)
2014-03-21 20:06:44 -07:00
bors
bbf8cdc43f auto merge of #12833 : alexcrichton/rust/libnative, r=brson
The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonably with a native default rather than a
green default.

With this commit come a number of bugfixes:

* The main native task is now named `<main>`
* The main native task has the stack bounds set up properly
* #[no_uv] was renamed to #[no_start]
* The core-run-destroy test was rewritten for both libnative and libgreen and
  one of the tests was modified to be more robust.
* The process-detach test was locked to libgreen because it uses signal handling
2014-03-21 18:51:51 -07:00
bors
3e3a3cf712 auto merge of #13043 : alexcrichton/rust/fix-rustdoc-windows, r=brson
If the dwShareMode parameter is 0 on windows, it "prevents other processes from
opening a file or device if they request delete, read, or write access", which
is the opposite of what we want! This changes the 0 parameter to something which
will allow multiple processes to open the file and then lock it.
2014-03-21 16:41:48 -07:00
Huon Wilson
e33676b793 Migrate all users of opt_vec to owned_slice, delete opt_vec.
syntax::opt_vec is now entirely unused, and so can go.
2014-03-22 09:54:18 +11:00
Matt Brubeck
8da5ed2026 Copy-edit a sentence about borrowing references 2014-03-21 14:36:06 -07:00
bors
cff012dc90 auto merge of #13024 : brson/rust/issue-12799, r=thestinger
The only stage that can be installed from is 2 everywhere but windows,
3 on windows.

Lightly tested. Not actually tested on Windows, but I did confirm that a *similar* change fixed the problem on Windows.

Closes #12799
2014-03-21 13:51:47 -07:00
Alex Crichton
e7c4fb692b rand: Fix a bug acquiring a context on windows
The details can be found in the comment I wrote on the block in question, but
the gist of it is that our usage of the TIB for a stack limit was causing
CryptAcquireContext to fail, so we temporarily get around it by setting the
stack limit to 0.
2014-03-21 12:03:13 -07:00
Alex Crichton
d2e99a0b33 rand: Rewrite OsRng in Rust for windows
This removes even more rust_builtin.c code, and allows us to more gracefully
handle errors (not a process panic, but a task failure).
2014-03-21 12:03:13 -07:00
Alex Crichton
ab1dd09d73 rustc: Switch defaults from libgreen to libnative
The compiler will no longer inject libgreen as the default runtime for rust
programs, this commit switches it over to libnative by default. Now that
libnative has baked for some time, it is ready enough to start getting more
serious usage as the default runtime for rustc generated binaries.

We've found that there isn't really a correct decision in choosing a 1:1 or M:N
runtime as a default for all applications, but it seems that a larger number of
programs today would work more reasonable with a native default rather than a
green default.

With this commit come a number of bugfixes:

* The main native task is now named "<main>"
* The main native task has the stack bounds set up properly
* #[no_uv] was renamed to #[no_start]
* The core-run-destroy test was rewritten for both libnative and libgreen and
  one of the tests was modified to be more robust.
* The process-detach test was locked to libgreen because it uses signal handling
2014-03-21 12:03:13 -07:00
Alex Crichton
988664ac8a rustdoc: Fix file locking on windows
If the dwShareMode parameter is 0 on windows, it "prevents other processes from
opening a file or device if they request delete, read, or write access", which
is the opposite of what we want! This changes the 0 parameter to something which
will allow multiple processes to open the file and then lock it.
2014-03-21 09:26:34 -07:00
bors
7b957a879b auto merge of #13056 : huonw/rust/devecing-tests, r=pnkfelix
test: Remove all `~[T]` from tests, libgetopts, compiletest, librustdoc, and libnum

And most from libtest, libflate, and adds `deny(deprecated_owned_vector)`s to the smaller modules with that have zero (or nearly zero) uses of `~[T]`.

Revival of #12837
2014-03-21 08:21:51 -07:00
Huon Wilson
0384952a65 syntax: add the OwnedSlice vector wrapper.
This is a stand-in until we have a saner `~[T]` type (i.e. a proper
owned slice). It's a library version of what `~[T]` will be, i.e. an
owned pointer and a length.
2014-03-22 01:36:46 +11:00
Huon Wilson
cda33346d0 syntax: allow trace_macros! and log_syntax! in item position.
Previously

    trace_macros!(true)
    fn main() {}

would complain about `trace_macros` being an expression macro in item
position. This is a pointless limitation, because the macro is purely
compile-time, with no runtime effect. (And similarly for log_syntax.)

This also changes the behaviour of `trace_macros!` very slightly, it
used to be equivalent to

    macro_rules! trace_macros {
        (true $($_x: tt)*) => { true };
        (false $($_x: tt)*) => { false }
    }

I.e. you could invoke it with arbitrary trailing arguments, which were
ignored. It is changed to accept only exactly `true` or `false` (with no
trailing arguments) and expands to `()`.
2014-03-22 01:27:23 +11:00
Huon Wilson
40a52c0f0a Add #[deny(deprecated_owned_vector)] to several modules. 2014-03-22 01:08:57 +11:00
Huon Wilson
d50f5bd722 getopts: remove all uses of ~[].
And stop regressions with the lint.
2014-03-22 01:08:57 +11:00
Huon Wilson
bc3a10b9f9 Remove nearly all uses of ~[] from libtest.
Deny further uses, with explicit allows on a few specific functions.
2014-03-22 01:08:57 +11:00
Huon Wilson
6d778ff610 Remove outdated and unnecessary std::vec_ng::Vec imports.
(And fix some tests.)
2014-03-22 01:08:57 +11:00