]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #13113 : pnkfelix/rust/correct-static-kind-doc, r=huonw
bors [Mon, 24 Mar 2014 17:01:57 +0000 (10:01 -0700)]
auto merge of #13113 : pnkfelix/rust/correct-static-kind-doc, r=huonw

While double-checking my understanding of the meaning of `'static`, I made the following test program:

```rust
fn foo<X:'static>(_x: X) { }

#[cfg(not(acceptable))]
fn bar() {
    let a = 3;
    let b = &a;
    foo(b);
}

#[cfg(acceptable)]
fn bar() {
    static c : int = 4;;
    let d : &'static int = &c;
    foo(d);
}

fn main() {
    bar();
}
```

Transcript of compiling above program, illustrating that the `--cfg acceptable` variant of `bar` compiles successfully, showing that the`'static` kind bound only disallows non-`static` references, not *all* references:

```
% rustc --version
/Users/fklock/opt/rust-dbg/bin/rustc 0.10-pre (caf17fe 2014-03-21 02:21:50 -0700)
host: x86_64-apple-darwin
% rustc /tmp/s.rs
/tmp/s.rs:7:5: 7:8 error: instantiating a type parameter with an incompatible type `&int`, which does not fulfill `'static`
/tmp/s.rs:7     foo(b);
                ^~~
error: aborting due to previous error
% rustc --cfg acceptable /tmp/s.rs
% ./s
%
```

(Note that the explicit type annotation on `let d : &'static int` is necessary; it did not suffice for me to just write `let d = &'static c;`. That might be a latent bug, I am not sure yet.)

Anyway, a fix to the documentation seemed prudent.

10 years agoauto merge of #12998 : huonw/rust/log_syntax, r=alexcrichton
bors [Mon, 24 Mar 2014 14:11:59 +0000 (07:11 -0700)]
auto merge of #12998 : huonw/rust/log_syntax, r=alexcrichton

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 `()`.

10 years agoCorrect overly broad definition of `'static` kind bound.
Felix S. Klock II [Mon, 24 Mar 2014 12:03:43 +0000 (13:03 +0100)]
Correct overly broad definition of `'static` kind bound.

While double-checking my understanding of the meaning of `'static`,
I made the following test program:

```rust
fn foo<X:'static>(_x: X) { }

#[cfg(not(acceptable))]
fn bar() {
    let a = 3;
    let b = &a;
    foo(b);
}

#[cfg(acceptable)]
fn bar() {
    static c : int = 4;;
    let d : &'static int = &c;
    foo(d);
}

fn main() {
    bar();
}
```

Transcript of compiling above program, illustrating that the `--cfg
acceptable` variant of `bar` compiles successfully, showing that the
`'static` kind bound only disallows non-`static` references, not *all*
references:

```
% rustc --version
/Users/fklock/opt/rust-dbg/bin/rustc 0.10-pre (caf17fe 2014-03-21 02:21:50 -0700)
host: x86_64-apple-darwin
% rustc /tmp/s.rs
/tmp/s.rs:7:5: 7:8 error: instantiating a type parameter with an incompatible type `&int`, which does not fulfill `'static`
/tmp/s.rs:7     foo(b);
                ^~~
error: aborting due to previous error
% rustc --cfg acceptable /tmp/s.rs
% ./s
%
```

(Note that the explicit type annotation on `let d : &'static int` is
necessary; it did not suffice for me to just write `let d = &'static
c;`.  That might be a latent bug, I am not sure yet.)

Anyway, a fix to the documentation seemed prudent.

10 years agoauto merge of #12948 : olleolleolle/rust/master, r=huonw
bors [Mon, 24 Mar 2014 11:41:53 +0000 (04:41 -0700)]
auto merge of #12948 : olleolleolle/rust/master, r=huonw

Rust doc sprint: adding doc strings to the Terminfo library.

This is my very first Rust repository PR, so please do not hold back any formatting, nit-picky commentary. I need it.

10 years agoDocumentation sprint: Terminfo
Olle Jonsson [Sun, 16 Mar 2014 22:15:55 +0000 (23:15 +0100)]
Documentation sprint: Terminfo

10 years agoauto merge of #13096 : sstewartgallus/rust/cleanup-test-warnings, r=huonw
bors [Sun, 23 Mar 2014 23:31:52 +0000 (16:31 -0700)]
auto merge of #13096 : sstewartgallus/rust/cleanup-test-warnings, r=huonw

10 years agoauto merge of #13095 : alexcrichton/rust/serialize-tuple, r=huonw
bors [Sun, 23 Mar 2014 22:16:48 +0000 (15:16 -0700)]
auto merge of #13095 : alexcrichton/rust/serialize-tuple, r=huonw

This commit moves from {read,emit}_seq for tuples to {read,emit}_tuple, as well
as providing a generalized macro for generating these implementations from one
invocation.

Closes #13086

10 years agoThis commit cleans up a few test warnings
Steven Stewart-Gallus [Sun, 23 Mar 2014 05:20:27 +0000 (22:20 -0700)]
This commit cleans up a few test warnings

10 years agoauto merge of #13074 : pczarn/rust/build-rlib, r=alexcrichton
bors [Sun, 23 Mar 2014 21:01:52 +0000 (14:01 -0700)]
auto merge of #13074 : pczarn/rust/build-rlib, r=alexcrichton

Fixes #12992

I tried to increase the number of deflate's probes. Reduction of 0.5% or 2% is not enough.

10 years agoauto merge of #13103 : mozilla-servo/rust/url-totaleq, r=alexcrichton
bors [Sun, 23 Mar 2014 18:56:54 +0000 (11:56 -0700)]
auto merge of #13103 : mozilla-servo/rust/url-totaleq, r=alexcrichton

10 years agoserialize: Read/emit tuples with {read,emit}_tuple
Alex Crichton [Sun, 23 Mar 2014 04:58:51 +0000 (21:58 -0700)]
serialize: Read/emit tuples with {read,emit}_tuple

This commit moves from {read,emit}_seq for tuples to {read,emit}_tuple, as well
as providing a generalized macro for generating these implementations from one
invocation.

Closes #13086

10 years agoauto merge of #13102 : huonw/rust/totaleq-deriving, r=thestinger
bors [Sun, 23 Mar 2014 15:36:51 +0000 (08:36 -0700)]
auto merge of #13102 : huonw/rust/totaleq-deriving, r=thestinger

std: remove the `equals` method from `TotalEq`.

`TotalEq` is now just an assertion about the `Eq` impl of a
type (i.e. `==` is a total equality if a type implements `TotalEq`) so
the extra method is just confusing.

Also, a new method magically appeared as a hack to allow deriving to
assert that the contents of a struct/enum are also TotalEq, because the
deriving infrastructure makes it very hard to do anything but create a
trait method. (You didn't hear about this horrible work-around from me
:(.)

10 years agoMake url::Url derive TotalEq.
Ms2ger [Sun, 23 Mar 2014 14:32:18 +0000 (15:32 +0100)]
Make url::Url derive TotalEq.

10 years agoauto merge of #13099 : FlaPer87/rust/master, r=huonw
bors [Sun, 23 Mar 2014 14:21:55 +0000 (07:21 -0700)]
auto merge of #13099 : FlaPer87/rust/master, r=huonw

10 years agoauto merge of #13093 : Havvy/rust/master, r=sfackler
bors [Sun, 23 Mar 2014 13:06:54 +0000 (06:06 -0700)]
auto merge of #13093 : Havvy/rust/master, r=sfackler

This will make the types more readable in the documentation, since the letters correspond with what you should either be sending or expecting to receive.

10 years agostd: remove the `equals` method from `TotalEq`.
Huon Wilson [Sun, 23 Mar 2014 11:54:42 +0000 (22:54 +1100)]
std: remove the `equals` method from `TotalEq`.

`TotalEq` is now just an assertion about the `Eq` impl of a
type (i.e. `==` is a total equality if a type implements `TotalEq`) so
the extra method is just confusing.

Also, a new method magically appeared as a hack to allow deriving to
assert that the contents of a struct/enum are also TotalEq, because the
deriving infrastructure makes it very hard to do anything but create a
trait method. (You didn't hear about this horrible work-around from me
:(.)

10 years agorustc: Change the filename of compressed bitcode
Piotr Czarnecki [Sun, 23 Mar 2014 07:59:18 +0000 (08:59 +0100)]
rustc: Change the filename of compressed bitcode

Fixes #12992
Store compressed bitcode files in rlibs with a different extension. Compression doesn't interfere with --emit=bc.
Regression test compares outputs.

10 years agoauto merge of #13092 : sfackler/rust/buffer-vec, r=thestinger
bors [Sun, 23 Mar 2014 11:01:59 +0000 (04:01 -0700)]
auto merge of #13092 : sfackler/rust/buffer-vec, r=thestinger

`Vec` is now used for the internal buffer instead of `~[]`. Some module
level documentation somehow ended up attached to `BufferedReader` so I
fixed that as well.

10 years agoRegister new snapshots
Flavio Percoco [Sun, 23 Mar 2014 10:37:31 +0000 (11:37 +0100)]
Register new snapshots

10 years agoauto merge of #13090 : thestinger/rust/iter, r=Aatch
bors [Sun, 23 Mar 2014 09:41:53 +0000 (02:41 -0700)]
auto merge of #13090 : thestinger/rust/iter, r=Aatch

This has been rendered obsolete by partial type hints. Since the `~[T]`
type is in the process of being removed, it needs to go away.

10 years agoiter: remove `to_owned_vec`
Daniel Micay [Sat, 22 Mar 2014 23:18:37 +0000 (19:18 -0400)]
iter: remove `to_owned_vec`

This needs to be removed as part of removing `~[T]`. Partial type hints
are now allowed, and will remove the need to add a version of this
method for `Vec<T>`. For now, this involves a few workarounds for
partial type hints not completely working.

10 years agoauto merge of #13088 : thestinger/rust/hashmap, r=cmr
bors [Sun, 23 Mar 2014 06:46:58 +0000 (23:46 -0700)]
auto merge of #13088 : thestinger/rust/hashmap, r=cmr

Closes #5283

10 years agouse TotalEq for HashMap
Daniel Micay [Sat, 22 Mar 2014 20:30:45 +0000 (16:30 -0400)]
use TotalEq for HashMap

Closes #5283

10 years agoauto merge of #13089 : thestinger/rust/managed, r=Aatch
bors [Sun, 23 Mar 2014 03:11:55 +0000 (20:11 -0700)]
auto merge of #13089 : thestinger/rust/managed, r=Aatch

This removes two tests built on `managed::refcount`, but these issues
are well-covered elsewhere for non-managed types.

10 years agomake std::managed private
Daniel Micay [Sat, 22 Mar 2014 22:45:47 +0000 (18:45 -0400)]
make std::managed private

This removes two tests built on `managed::refcount`, but these issues
are well-covered elsewhere for non-managed types.

10 years agoChange types T,U to R (recv), S (sender) in libsync/comm.rs
Ryan Scheel (Havvy) [Sun, 23 Mar 2014 00:50:59 +0000 (17:50 -0700)]
Change types T,U to R (recv), S (sender) in libsync/comm.rs

10 years agoSome cleanup in std::io::buffered
Steven Fackler [Sun, 23 Mar 2014 00:18:27 +0000 (17:18 -0700)]
Some cleanup in std::io::buffered

`Vec` is now used for the internal buffer instead of `~[]`. Some module
level documentation somehow ended up attached to `BufferedReader` so I
fixed that as well.

10 years agoauto merge of #13087 : eddyb/rust/fix-autoderef, r=cmr
bors [Sun, 23 Mar 2014 00:21:51 +0000 (17:21 -0700)]
auto merge of #13087 : eddyb/rust/fix-autoderef, r=cmr

Implements vtable support for generic Deref impls with trait bounds.
Also fixes cross-crate inlining when using autoderef.

10 years agoImplement cross-crate support for autoderef.
Eduard Burtescu [Sat, 22 Mar 2014 23:11:39 +0000 (01:11 +0200)]
Implement cross-crate support for autoderef.
Closes #13044.

10 years agoauto merge of #13085 : edwardw/rust/saddest-cell, r=cmr
bors [Sat, 22 Mar 2014 23:06:51 +0000 (16:06 -0700)]
auto merge of #13085 : edwardw/rust/saddest-cell, r=cmr

10 years agoImplement vtable support for autoderef.
Eduard Burtescu [Sat, 22 Mar 2014 19:44:16 +0000 (21:44 +0200)]
Implement vtable support for autoderef.
Closes #13042.

10 years agoauto merge of #13084 : Havvy/rust/master, r=alexcrichton
bors [Sat, 22 Mar 2014 21:16:50 +0000 (14:16 -0700)]
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.

10 years agoauto merge of #13076 : FlaPer87/rust/remove-freeze, r=alexcrichton
bors [Sat, 22 Mar 2014 20:01:52 +0000 (13:01 -0700)]
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?

10 years agoUnindent stringifier() in tasks guide
Ryan Scheel (Havvy) [Sat, 22 Mar 2014 18:54:19 +0000 (11:54 -0700)]
Unindent stringifier() in tasks guide

10 years agoGet rid of @Cell
Edward Wang [Sat, 22 Mar 2014 18:53:35 +0000 (02:53 +0800)]
Get rid of @Cell

10 years agoauto merge of #12995 : Kroisse/rust/vec_ng_mut_slices, r=alexcrichton
bors [Sat, 22 Mar 2014 18:06:46 +0000 (11:06 -0700)]
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.

10 years agoAdd Vec::mut_slice_from(), mut_slice_to(), and mut_split_at()
Eunchong Yu [Tue, 18 Mar 2014 03:52:06 +0000 (12:52 +0900)]
Add Vec::mut_slice_from(), mut_slice_to(), and mut_split_at()

10 years agoauto merge of #13053 : alexcrichton/rust/removing-ref-cell-get, r=huonw
bors [Sat, 22 Mar 2014 16:51:49 +0000 (09:51 -0700)]
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

10 years agorustuv: Remove usage of get()
Alex Crichton [Sat, 22 Mar 2014 15:56:21 +0000 (08:56 -0700)]
rustuv: Remove usage of get()

10 years agorustc: Remove all usage of manual deref()
Alex Crichton [Fri, 21 Mar 2014 05:10:44 +0000 (22:10 -0700)]
rustc: Remove all usage of manual deref()

Favor using '*' instead

10 years agotest: Fix fallout of removing get()
Alex Crichton [Fri, 21 Mar 2014 05:06:51 +0000 (22:06 -0700)]
test: Fix fallout of removing get()

10 years agorustdoc: Fix fallout of removing get()
Alex Crichton [Fri, 21 Mar 2014 04:52:59 +0000 (21:52 -0700)]
rustdoc: Fix fallout of removing get()

10 years agorustc: Fix fallout of removing get()
Alex Crichton [Fri, 21 Mar 2014 02:49:20 +0000 (19:49 -0700)]
rustc: Fix fallout of removing get()

10 years agoarena: Fix fallout of removing get()
Alex Crichton [Thu, 20 Mar 2014 22:05:56 +0000 (15:05 -0700)]
arena: Fix fallout of removing get()

10 years agosyntax: Fix fallout of removing get()
Alex Crichton [Thu, 20 Mar 2014 22:05:37 +0000 (15:05 -0700)]
syntax: Fix fallout of removing get()

10 years agostd: Remove the get() method from RefCell wrappers
Alex Crichton [Thu, 20 Mar 2014 22:04:55 +0000 (15:04 -0700)]
std: Remove the get() method from RefCell wrappers

This method has been entirely obsoleted by autoderef, so there's no reason for
its existence.

10 years agoauto merge of #13078 : klutzy/rust/issue-13075, r=alexcrichton
bors [Sat, 22 Mar 2014 15:36:50 +0000 (08:36 -0700)]
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

10 years agostd::os: Handle FormatMessage failure
klutzy [Sat, 22 Mar 2014 14:13:40 +0000 (23:13 +0900)]
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

10 years agodoc: Remove Freeze / NoFreeze from docs
Flavio Percoco [Sat, 22 Mar 2014 13:42:32 +0000 (14:42 +0100)]
doc: Remove Freeze / NoFreeze from docs

10 years agotest: Remove Freeze / NoFreeze from tests
Flavio Percoco [Fri, 21 Mar 2014 23:44:26 +0000 (00:44 +0100)]
test: Remove Freeze / NoFreeze from tests

10 years agostd: Remove the Freeze kind and the NoFreeze marker
Flavio Percoco [Fri, 21 Mar 2014 22:49:19 +0000 (23:49 +0100)]
std: Remove the Freeze kind and the NoFreeze marker

10 years agocell: Remove Freeze / NoFreeze
Flavio Percoco [Fri, 21 Mar 2014 22:48:39 +0000 (23:48 +0100)]
cell: Remove Freeze / NoFreeze

10 years agostd::comm: Remove Freeze / NoFreeze
Flavio Percoco [Fri, 21 Mar 2014 22:48:24 +0000 (23:48 +0100)]
std::comm: Remove Freeze / NoFreeze

10 years agosync: Remove Freeze / NoFreeze
Flavio Percoco [Fri, 21 Mar 2014 22:48:06 +0000 (23:48 +0100)]
sync: Remove Freeze / NoFreeze

10 years agoarena: Remove Freeze / NoFreeze
Flavio Percoco [Fri, 21 Mar 2014 22:47:55 +0000 (23:47 +0100)]
arena: Remove Freeze / NoFreeze

10 years agorustc: Remove special treatment for Freeze and NoFreeze
Flavio Percoco [Fri, 21 Mar 2014 23:16:56 +0000 (00:16 +0100)]
rustc: Remove special treatment for Freeze and NoFreeze

Fixes #12577

10 years agoauto merge of #13062 : mbrubeck/rust/doc-edit, r=alexcrichton
bors [Sat, 22 Mar 2014 14:21:44 +0000 (07:21 -0700)]
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?

10 years agoauto merge of #13052 : sfackler/rust/clean-refcell, r=alexcrichton
bors [Sat, 22 Mar 2014 11:56:49 +0000 (04:56 -0700)]
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.

10 years agoauto merge of #12907 : alexcrichton/rust/issue-12892, r=brson
bors [Sat, 22 Mar 2014 07:56:47 +0000 (00:56 -0700)]
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

10 years agoauto merge of #13051 : alexcrichton/rust/issue-13047, r=thestinger
bors [Sat, 22 Mar 2014 05:41:42 +0000 (22:41 -0700)]
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

10 years agoauto merge of #13036 : alexcrichton/rust/atomics, r=alexcrichton
bors [Sat, 22 Mar 2014 04:31:42 +0000 (21:31 -0700)]
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.

10 years agoauto merge of #13016 : huonw/rust/new-opt-vec, r=cmr
bors [Sat, 22 Mar 2014 03:06:44 +0000 (20:06 -0700)]
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.)

10 years agoauto merge of #12833 : alexcrichton/rust/libnative, r=brson
bors [Sat, 22 Mar 2014 01:51:51 +0000 (18:51 -0700)]
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

10 years agoauto merge of #13043 : alexcrichton/rust/fix-rustdoc-windows, r=brson
bors [Fri, 21 Mar 2014 23:41:48 +0000 (16:41 -0700)]
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.

10 years agoMigrate all users of opt_vec to owned_slice, delete opt_vec.
Huon Wilson [Wed, 19 Mar 2014 14:52:37 +0000 (01:52 +1100)]
Migrate all users of opt_vec to owned_slice, delete opt_vec.

syntax::opt_vec is now entirely unused, and so can go.

10 years agoCopy-edit a sentence about borrowing references
Matt Brubeck [Fri, 21 Mar 2014 21:36:06 +0000 (14:36 -0700)]
Copy-edit a sentence about borrowing references

10 years agoauto merge of #13024 : brson/rust/issue-12799, r=thestinger
bors [Fri, 21 Mar 2014 20:51:47 +0000 (13:51 -0700)]
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

10 years agorand: Fix a bug acquiring a context on windows
Alex Crichton [Fri, 21 Mar 2014 18:51:11 +0000 (11:51 -0700)]
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.

10 years agorand: Rewrite OsRng in Rust for windows
Alex Crichton [Thu, 20 Mar 2014 00:53:57 +0000 (17:53 -0700)]
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).

10 years agorustc: Switch defaults from libgreen to libnative
Alex Crichton [Tue, 11 Mar 2014 20:38:36 +0000 (13:38 -0700)]
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

10 years agorustdoc: Fix file locking on windows
Alex Crichton [Thu, 20 Mar 2014 20:59:07 +0000 (13:59 -0700)]
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.

10 years agoauto merge of #13056 : huonw/rust/devecing-tests, r=pnkfelix
bors [Fri, 21 Mar 2014 15:21:51 +0000 (08:21 -0700)]
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

10 years agosyntax: add the OwnedSlice vector wrapper.
Huon Wilson [Wed, 19 Mar 2014 14:51:08 +0000 (01:51 +1100)]
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.

10 years agosyntax: allow `trace_macros!` and `log_syntax!` in item position.
Huon Wilson [Tue, 18 Mar 2014 12:14:08 +0000 (23:14 +1100)]
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 `()`.

10 years agoAdd #[deny(deprecated_owned_vector)] to several modules.
Huon Wilson [Fri, 21 Mar 2014 12:34:12 +0000 (23:34 +1100)]
Add #[deny(deprecated_owned_vector)] to several modules.

10 years agogetopts: remove all uses of `~[]`.
Huon Wilson [Fri, 21 Mar 2014 12:25:16 +0000 (23:25 +1100)]
getopts: remove all uses of `~[]`.

And stop regressions with the lint.

10 years agoRemove nearly all uses of `~[]` from libtest.
Huon Wilson [Fri, 21 Mar 2014 12:17:33 +0000 (23:17 +1100)]
Remove nearly all uses of `~[]` from libtest.

Deny further uses, with explicit allows on a few specific functions.

10 years agoRemove outdated and unnecessary std::vec_ng::Vec imports.
Huon Wilson [Fri, 21 Mar 2014 11:37:41 +0000 (22:37 +1100)]
Remove outdated and unnecessary std::vec_ng::Vec imports.

(And fix some tests.)

10 years agoauto merge of #12654 : edwardw/rust/rc-arc, r=huonw
bors [Fri, 21 Mar 2014 14:06:49 +0000 (07:06 -0700)]
auto merge of #12654 : edwardw/rust/rc-arc, r=huonw

Since `Arc` has been using `Atomic`, this closes 12625.

Closes #12625.

10 years agoRewrite rc::Rc using cell::Cell
Edward Wang [Fri, 21 Mar 2014 07:16:07 +0000 (15:16 +0800)]
Rewrite rc::Rc using cell::Cell

Since `Arc` has been using `Atomic`, this closes 12625.

Closes #12625.

10 years agotest: Make manual changes to deal with the fallout from removal of
Patrick Walton [Wed, 5 Mar 2014 23:28:08 +0000 (15:28 -0800)]
test: Make manual changes to deal with the fallout from removal of
`~[T]` in test, libgetopts, compiletest, librustdoc, and libnum.

10 years agotest: Automatically remove all `~[T]` from tests.
Patrick Walton [Wed, 5 Mar 2014 22:02:44 +0000 (14:02 -0800)]
test: Automatically remove all `~[T]` from tests.

10 years agolibstd: Add some methods to `Vec<T>`.
Patrick Walton [Thu, 6 Mar 2014 18:22:21 +0000 (10:22 -0800)]
libstd: Add some methods to `Vec<T>`.

10 years agoauto merge of #13029 : FlaPer87/rust/master, r=alexcrichton
bors [Fri, 21 Mar 2014 09:21:50 +0000 (02:21 -0700)]
auto merge of #13029 : FlaPer87/rust/master, r=alexcrichton

This should prevent lot of doc errors in Rust's buildbot and it shouldn't take long to run on travis. We could probably limit it to `std` but I preferred to just check all docs in this phase too.

@alexcrichton r?

10 years agoauto merge of #13037 : alexcrichton/rust/attr-syntax, r=brson
bors [Fri, 21 Mar 2014 04:11:47 +0000 (21:11 -0700)]
auto merge of #13037 : alexcrichton/rust/attr-syntax, r=brson

This will require a snapshot to finish, but these commits update the parser to parse attributes of the form `#![...]`

Thanks to @TheHydroImpulse for all the initial work!

cc #2569

10 years agoClean up marker types and Unsafe initialization
Steven Fackler [Fri, 21 Mar 2014 03:24:31 +0000 (20:24 -0700)]
Clean up marker types and Unsafe initialization

10 years agostd: Implement Clone/TotalEq for ProcessExit
Alex Crichton [Fri, 21 Mar 2014 01:59:50 +0000 (18:59 -0700)]
std: Implement Clone/TotalEq for ProcessExit

It's useful for structures which use deriving(Clone, TotalEq), even though it's
implicitly copyable.

Closes #13047

10 years agoRemove RefCell::{with, with_mut}
Steven Fackler [Fri, 21 Mar 2014 02:55:52 +0000 (19:55 -0700)]
Remove RefCell::{with, with_mut}

These are superfluous now that we have fixed rvalue lifetimes and Deref.

10 years agostd: Rename {push,read}_bytes to {push,read}_exact
Alex Crichton [Sat, 15 Mar 2014 05:42:24 +0000 (22:42 -0700)]
std: Rename {push,read}_bytes to {push,read}_exact

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

10 years agosyntax: Tidy up parsing the new attribute syntax
Alex Crichton [Thu, 20 Mar 2014 18:21:17 +0000 (11:21 -0700)]
syntax: Tidy up parsing the new attribute syntax

10 years agoAdded new attribute syntax with backward compatibility.
Daniel Fagnan [Tue, 25 Feb 2014 02:42:40 +0000 (19:42 -0700)]
Added new attribute syntax with backward compatibility.

Signed-off-by: Daniel Fagnan <dnfagnan@gmail.com>
10 years agosyntax: make OptVec immutable.
Huon Wilson [Wed, 19 Mar 2014 12:16:56 +0000 (23:16 +1100)]
syntax: make OptVec immutable.

This is the first step to replacing OptVec with a new representation:
remove all mutability. Any mutations have to go via `Vec` and then make
to `OptVec`.

Many of the uses of OptVec are unnecessary now that Vec has no-alloc
emptiness (and have been converted to Vec): the only ones that really
need it are the AST and sty's (and so on) where there are a *lot* of
instances of them, and they're (mostly) immutable.

10 years agostd: Update atomic documentation to remove 'mut'
Alex Crichton [Thu, 20 Mar 2014 22:06:34 +0000 (15:06 -0700)]
std: Update atomic documentation to remove 'mut'

It's all no longer necessary

10 years agoauto merge of #13023 : thestinger/rust/deep_clone, r=alexcrichton
bors [Thu, 20 Mar 2014 22:01:47 +0000 (15:01 -0700)]
auto merge of #13023 : thestinger/rust/deep_clone, r=alexcrichton

10 years agostd: Remove AtomicU64
Brian Anderson [Tue, 25 Feb 2014 02:23:01 +0000 (18:23 -0800)]
std: Remove AtomicU64

Support for this is less universal than for word-size things;
it has no users; i'd rather play it safe.

10 years agostd: Make the generic atomics in `sync::atomics` private
Brian Anderson [Tue, 25 Feb 2014 02:22:09 +0000 (18:22 -0800)]
std: Make the generic atomics in `sync::atomics` private

I'm not comfortable exposing public functions that purport to do
atomic operations on arbitrary T.

10 years agostd: Make the generic atomics take unsafe pointers
Brian Anderson [Tue, 25 Feb 2014 02:20:52 +0000 (18:20 -0800)]
std: Make the generic atomics take unsafe pointers

These mutate values behind references that are Freeze, which is not
allowed.

10 years agoauto merge of #13026 : alexcrichton/rust/snapshots, r=huonw
bors [Thu, 20 Mar 2014 18:06:42 +0000 (11:06 -0700)]
auto merge of #13026 : alexcrichton/rust/snapshots, r=huonw

10 years agoRegister new snapshots
Alex Crichton [Thu, 20 Mar 2014 06:04:25 +0000 (23:04 -0700)]
Register new snapshots

10 years agoauto merge of #13020 : alexcrichton/rust/vec, r=brson
bors [Thu, 20 Mar 2014 16:51:44 +0000 (09:51 -0700)]
auto merge of #13020 : alexcrichton/rust/vec, r=brson

The commits have the details.