Commit Graph

28282 Commits

Author SHA1 Message Date
Andrew Gallant
7269bc77e1 Ignore regex tests (regular, cfail and benchmark) on Windows (for now). 2014-04-25 01:37:27 -04:00
Andrew Gallant
09a8b38550 mk: Copy fewer libraries into the host artifacts 2014-04-25 00:31:29 -04:00
Andrew Gallant
b8b7484703 Add a regex crate to the Rust distribution.
Also adds a regex_macros crate, which provides natively compiled
regular expressions with a syntax extension.

Closes #3591.

RFC: 0007-regexps
2014-04-25 00:27:24 -04:00
bors
66486518d5 auto merge of #13723 : alexcrichton/rust/pipe-connect-timeout, r=brson
This adds support for connecting to a unix socket with a timeout (a named pipe
on windows), and accepting a connection with a timeout. The goal is to bring
unix pipes/named sockets back in line with TCP support for timeouts.

Similarly to the TCP sockets, all methods are marked #[experimental] due to
uncertainty about the type of the timeout argument.

This internally involved a good bit of refactoring to share as much code as
possible between TCP servers and pipe servers, but the core implementation did
not change drastically as part of this commit.

cc #13523
2014-04-24 19:36:14 -07:00
bors
07598fc8cc auto merge of #13711 : alexcrichton/rust/snapshots, r=brson
These are the first successful snapshots after the LLVM upgrade, built with LLVM
that requires C++11
2014-04-24 18:26:15 -07:00
bors
5ea0509685 auto merge of #13671 : dcrewi/rust/lint-directives-on-use-items, r=alexcrichton
Fixes #10534
2014-04-24 17:16:14 -07:00
Alex Crichton
6328f7c199 std: Add timeouts to unix connect/accept
This adds support for connecting to a unix socket with a timeout (a named pipe
on windows), and accepting a connection with a timeout. The goal is to bring
unix pipes/named sockets back in line with TCP support for timeouts.

Similarly to the TCP sockets, all methods are marked #[experimental] due to
uncertainty about the type of the timeout argument.

This internally involved a good bit of refactoring to share as much code as
possible between TCP servers and pipe servers, but the core implementation did
not change drastically as part of this commit.

cc #13523
2014-04-24 16:24:09 -07:00
Alex Crichton
67ee480936 native: Remove unused and untested UnixDatagram 2014-04-24 16:23:03 -07:00
bors
b55394415a auto merge of #13729 : chris-morgan/rust/fix-vim-indent, r=alexcrichton
The change in #13600 was incorrect, containing a bad regular expression;
inside an indent function, errors are silently ignored (and the ``~=``
operation will return 0), so it just always failed, causing the cases
that were supposed to be caught to not be caught and making things like
the ``match`` example shown above or struct field definitions regress.

I have fixed the regular expression to what it should have been. This is
still imperfect, of course, not handling cases like where the first
argument to a function is a function call (``foo(bar(),``), but it'll do
for now.

----

I have a general request to make of reviewers about any changes made to `src/etc/vim`: **please tell me**. As a general rule I want to review them. (I’ll make an exception for changes the prelude; it needs fixing from time to time when some people don’t update the syntax file, anyway.)

cc @brandonw
2014-04-24 15:01:19 -07:00
bors
7d70434a1e auto merge of #13720 : aturon/rust/walk_dir-perf, r=alexcrichton
The `walk_dir` iterator was simulating a queue using a vector (in particular, using `shift`),
leading to O(n^2) performance. Since the order was not well-specified (see issue #13411),
the simplest fix is to use the vector as a stack (and thus yield a depth-first traversal).
This patch does exactly that, and adds a test checking for depth-first behavior.

Note that the underlying `readdir` function does not specify any particular order, nor
does the system call it uses.

Closes #13411.
2014-04-24 13:51:19 -07:00
bors
3485d90728 auto merge of #13706 : alexcrichton/rust/test-nocapture, r=brson
A new flag to the test runner, --nocapture, can be passed to instruct that the
output of tests should not be captured by default. The behavior can also be
triggered via a RUST_TEST_NOCAPTURE environment variable being set.

Closes #13374
2014-04-24 11:31:22 -07:00
Aaron Turon
b536d2bb76 fix O(n^2) perf bug for std::io::fs::walk_dir
The `walk_dir` iterator was simulating a queue using a vector (in particular, using `shift`),
leading to O(n^2) performance. Since the order was not well-specified (see issue #13411),
the simplest fix is to use the vector as a stack (and thus yield a depth-first traversal).
This patch does exactly that.  It leaves the order as originally specified -- "some top-down
order" -- and adds a test to ensure a top-down traversal.

Note that the underlying `readdir` function does not specify any particular order, nor
does the system call it uses.

Closes #13411.
2014-04-24 10:34:13 -07:00
bors
22e4e6adaf auto merge of #13619 : alexcrichton/rust/update-libuv, r=brson
This update brings a few months of changes, but primarily a fix for the
following situation.

When creating a handle to stdin, libuv used to set the stdin handle to
nonblocking mode. This would end up affect this stdin handle across all
processes that shared it, which mean that stdin become nonblocking for everyone
using the same stdin. On linux, this also affected *stdout* because stdin/stdout
roughly point at the same thing.

This problem became apparent when running the test suite manually on a local
computer. The stdtest suite (running with libgreen) would set stdout to
nonblocking mode (as described above), and then the next test suite would always
fail for a printing failure (because stdout was returning EAGAIN).

This has been fixed upstream, joyent/libuv@342e8c, and this update pulls in this
fix. This also brings us in line with a recently upstreamed libuv patch.

Closes #12827
Closes #13336
Closes #13355
2014-04-24 10:21:22 -07:00
Alex Crichton
65f68dcf70 test: Add an option to not capture output
A new flag to the test runner, --nocapture, can be passed to instruct that the
output of tests should not be captured by default. The behavior can also be
triggered via a RUST_TEST_NOCAPTURE environment variable being set.

Closes #13374
2014-04-24 09:53:16 -07:00
Alex Crichton
58a51120a7 Update libuv
This update brings a few months of changes, but primarily a fix for the
following situation.

When creating a handle to stdin, libuv used to set the stdin handle to
nonblocking mode. This would end up affect this stdin handle across all
processes that shared it, which mean that stdin become nonblocking for everyone
using the same stdin. On linux, this also affected *stdout* because stdin/stdout
roughly point at the same thing.

This problem became apparent when running the test suite manually on a local
computer. The stdtest suite (running with libgreen) would set stdout to
nonblocking mode (as described above), and then the next test suite would always
fail for a printing failure (because stdout was returning EAGAIN).

This has been fixed upstream, joyent/libuv@342e8c, and this update pulls in this
fix. This also brings us in line with a recently upstreamed libuv patch.

Closes #13336
Closes #13355
2014-04-24 09:08:07 -07:00
bors
3157c3e95b auto merge of #13715 : nick29581/rust/unsized-assign2, r=nikomatsakis
Closes #13376.
2014-04-24 08:16:24 -07:00
bors
70647ccc6d auto merge of #13713 : edwardw/rust/methodcall-span, r=alexcrichton
Specifically, the method parameter cardinality mismatch or missing
method error message span now gets method itself exactly. It was the
whole expression.

Closes #9390
Closes #13684
Closes #13709
2014-04-24 07:06:26 -07:00
Chris Morgan
7266587f3e Fix Vim indent regressions from #13600.
The change in #13600 was incorrect, containing a bad regular expression;
inside an indent function, errors are silently ignored (and the ``~=``
operation will return 0), so it just always failed, causing the cases
that were supposed to be caught to not be caught and making things like
the ``match`` example shown above or struct field definitions regress.

I have fixed the regular expression to what it should have been. This is
still imperfect, of course, not handling cases like where the first
argument to a function is a function call (``foo(bar(),``), but it'll do
for now.
2014-04-24 23:33:28 +10:00
bors
f5a5d7c32c auto merge of #13559 : FlaPer87/rust/remove-special-root, r=nikomatsakis
This patch removes the special auto-rooting for `@` from the borrow checker. With `@` moving into a library, it doesn't make sense to keep this code around anymore. It also simplifies `trans` by removing root checking from there 

@nikomatsakis

Closes: #11586
2014-04-24 05:51:28 -07:00
bors
e01e78fd00 auto merge of #13710 : aturon/rust/float-constants, r=brson
Some of the constant values in std::f32 were incorrectly copied from
std::f64.  More broadly, both modules defined their constants redundantly
in two places, which is what led to the bug.  Moreover, the specs for
some of the constants were incorrect, even when the values were correct.

Closes #13297.  Closes #11537.
2014-04-24 03:21:28 -07:00
Niko Matsakis
6fa1f48237 rustdoc: fix de-@rooting fallout 2014-04-24 11:58:54 +02:00
bors
c0a5e3498c auto merge of #13531 : alexcrichton/rust/fix-some-ices, r=brson
See the commits for the affected issues.
2014-04-24 01:26:29 -07:00
bors
867898977d auto merge of #12812 : sfackler/rust/attr-arm, r=alexcrichton
This is really only useful for #[cfg()]. For example:

```rust
enum Foo {
    Bar,
    Baz,
    #[cfg(blob)]
    Blob
}

fn match_foos(f: &Foo) {
    match *f {
        Bar => {}
        Baz => {}
        #[cfg(blob)]
        Blob => {}
    }
}
```

This is a kind of weird place to allow attributes, so it should probably
be discussed before merging.
2014-04-23 23:51:30 -07:00
Steven Fackler
1452c9c04a Allow attributes on match arms
RFC: 0008-match-arm-attributes
2014-04-23 21:48:22 -07:00
bors
4e1a09844e auto merge of #13704 : edwardw/rust/doc-hidden, r=alexcrichton
Closes #13698
2014-04-23 21:46:34 -07:00
bors
0e750adefc auto merge of #13675 : sfackler/rust/taskbuilder-new, r=alexcrichton
The constructor for `TaskBuilder` is being changed to an associated
function called `new` for consistency with the rest of the standard
library.

Closes #13666

[breaking-change]
2014-04-23 20:31:36 -07:00
Steven Fackler
adeeadf49f Move task::task() to TaskBuilder::new()
The constructor for `TaskBuilder` is being changed to an associated
function called `new` for consistency with the rest of the standard
library.

Closes #13666

[breaking-change]
2014-04-23 20:02:02 -07:00
bors
3d05e7f9cd auto merge of #13688 : alexcrichton/rust/accept-timeout, r=brson
This adds experimental support for timeouts when accepting sockets through
`TcpAcceptor::accept`. This does not add a separate `accept_timeout` function,
but rather it adds a `set_timeout` function instead. This second function is
intended to be used as a hard deadline after which all accepts will never block
and fail immediately.

This idea was derived from Go's SetDeadline() methods. We do not currently have
a robust time abstraction in the standard library, so I opted to have the
argument be a relative time in millseconds into the future. I believe a more
appropriate argument type is an absolute time, but this concept does not exist
yet (this is also why the function is marked #[experimental]).

The native support is built on select(), similarly to connect_timeout(), and the
green support is based on channel select and a timer.

cc #13523
2014-04-23 19:21:33 -07:00
Alex Crichton
e5d3e5180f std: Add support for an accept() timeout
This adds experimental support for timeouts when accepting sockets through
`TcpAcceptor::accept`. This does not add a separate `accept_timeout` function,
but rather it adds a `set_timeout` function instead. This second function is
intended to be used as a hard deadline after which all accepts will never block
and fail immediately.

This idea was derived from Go's SetDeadline() methods. We do not currently have
a robust time abstraction in the standard library, so I opted to have the
argument be a relative time in millseconds into the future. I believe a more
appropriate argument type is an absolute time, but this concept does not exist
yet (this is also why the function is marked #[experimental]).

The native support is built on select(), similarly to connect_timeout(), and the
green support is based on channel select and a timer.

cc #13523
2014-04-23 19:07:31 -07:00
Nick Cameron
a08198ba6f Prevent unsized types being stored in variables
Closes #13376.
2014-04-24 11:57:22 +12:00
Edward Wang
899f222386 Calibrate span for method call error messages
Specifically, the method parameter cardinality mismatch or missing
method error message span now gets method itself exactly. It was the
whole expression.

Closes #9390
Closes #13684
Closes #13709
2014-04-24 06:16:46 +08:00
Alex Crichton
568736182b Register new snapshots
These are the first successful snapshots after the LLVM upgrade, built with LLVM
that requires C++11
2014-04-23 14:58:50 -07:00
bors
d910330172 auto merge of #13705 : edwardw/rust/rcboxptr-doc, r=alexcrichton
It is for internal use only and should not appear in docs.
2014-04-23 14:48:54 -07:00
Aaron Turon
266812ec5a fix std::f32 and std::f64 constants
Some of the constant values in std::f32 were incorrectly copied from
std::f64.  More broadly, both modules defined their constants redundantly
in two places, which is what led to the bug.  Moreover, the specs for
some of the constants were incorrent, even when the values were correct.

Closes #13297.  Closes #11537.
2014-04-23 13:15:32 -07:00
bors
07aef98a32 auto merge of #13584 : rcxdude/rust/cross-syntax-ext, r=alexcrichton
This allows the use of syntax extensions when cross-compiling (fixing #12102). It does this by encoding the target triple in the crate metadata and checking it when searching for files. Currently the crate triple must match the host triple when there is a macro_registrar_fn, it must match the target triple when linking, and can match either when only macro_rules! macros are used.

due to carelessness, this is pretty much a duplicate of https://github.com/mozilla/rust/pull/13450.
2014-04-23 13:11:37 -07:00
Douglas Young
4ac89cd276 Enable use of syntax extensions when cross compiling.
This adds the target triple to the crate metadata.
When searching for a crate the phase (link, syntax) is taken into account.
During link phase only crates matching the target triple are considered.
During syntax phase, either the target or host triple will be accepted, unless
the crate defines a macro_registrar, in which case only the host triple will
match.
2014-04-23 20:33:54 +01:00
bors
6beb376b5c auto merge of #13686 : alexcrichton/rust/issue-12224, r=nikomatsakis
This alters the borrow checker's requirements on invoking closures from
requiring an immutable borrow to requiring a unique immutable borrow. This means 
that it is illegal to invoke a closure through a `&` pointer because there is no 
guarantee that is not aliased. This does not mean that a closure is required to
be in a mutable location, but rather a location which can be proven to be
unique (often through a mutable pointer).
                                                                                 
For example, the following code is unsound and is no longer allowed:             
                                                                                 
    type Fn<'a> = ||:'a;                                                         
                                                                                 
    fn call(f: |Fn|) {                                                           
        f(|| {                                                                   
            f(|| {})                                                             
        });                                                                      
    }                                                                            
                                                                                 
    fn main() {                                                                  
        call(|a| {                                                               
            a();                                                                 
        });                                                                      
    }                                                                            
                                                                                 
There is no replacement for this pattern. For all closures which are stored in
structures, it was previously allowed to invoke the closure through `&self` but
it now requires invocation through `&mut self`.

The standard library has a good number of violations of this new rule, but the
fixes will be separated into multiple breaking change commits.
                                                                                 
Closes #12224
2014-04-23 12:01:53 -07:00
Alex Crichton
b0d85e30b7 rustc: Don't die when a crate id can't be inferred
The filestem of the desired output isn't necessarily a valid crate id, and
calling unwrap() will trigger an ICE in rustc. This tries a little harder to
infer a "valid crate id" from a crate, with an eventual fallback to a generic
crate id if alll else fails.

Closes #11107
2014-04-23 10:04:29 -07:00
Alex Crichton
c62daa6ed3 rustc: Give a friendlier error when writing deps
When an error is encountered when writing dependencies, this presents a nicer
error rather than an ICE.

Closes #13517
2014-04-23 10:04:29 -07:00
Alex Crichton
de7845ac72 rustc: Fix passing errors from LLVM to rustc
Many of the instances of setting a global error variable ended up leaving a
dangling pointer into free'd memory. This changes the method of error
transmission to strdup any error and "relinquish ownership" to rustc when it
gets an error. The corresponding Rust code will then free the error as
necessary.

Closes #12865
2014-04-23 10:04:29 -07:00
Alex Crichton
823c7eee6a Fix other bugs with new closure borrowing
This fixes various issues throughout the standard distribution and tests.
2014-04-23 10:03:43 -07:00
Alex Crichton
b4ecbe9340 std: Change Finally to take &mut self
As with the previous commits, the Finally trait is primarily implemented for
closures, so the trait was modified from `&self` to `&mut self`. This will
require that any closure variable invoked with `finally` to be stored in a
mutable slot.

[breaking-change]
2014-04-23 10:03:43 -07:00
Alex Crichton
2b2d1e14c9 std: Change CharEq to take &mut self
This is similar to the previous commits to allow invocation of a closure through
a `&mut self` pointer because `&self` is disallowed. One of the primary
implementors of the CharEq trait is a closure type, which would not work if the
method continued to have `&self`.

In addition to changing mutability of the `matches` method, this modifies the
following methods from &CharEq to take a type which implements CharEq by value.

* trim_chars
* trim_left_chars
* trim_right_chars

Where these methods were previously invoked via

    s.trim_chars(&'a')

it would now be invoked through

    s.trim_chars('a')

[breaking-change]
2014-04-23 10:03:43 -07:00
Alex Crichton
f4083a2245 std: Change RandomAccessIterator to use &mut self
Many iterators go through a closure when dealing with the `idx` method, which
are invalid after the previous change (closures cannot be invoked through a `&`
pointer). This commit alters the `fn idx` method on the RandomAccessIterator
to take `&mut self` rather than `&self`.

[breaking-change]
2014-04-23 10:03:43 -07:00
Alex Crichton
159a10da4c rustc: Tweak the borrow on closure invocations
This alters the borrow checker's requirements on invoking closures from
requiring an immutable borrow to requiring a unique immutable borrow. This means
that it is illegal to invoke a closure through a `&` pointer because there is no
guarantee that is not aliased. This does not mean that a closure is required to
be in a mutable location, but rather a location which can be proven to be
unique (often through a mutable pointer).

For example, the following code is unsound and is no longer allowed:

    type Fn<'a> = ||:'a;

    fn call(f: |Fn|) {
        f(|| {
            f(|| {})
        });
    }

    fn main() {
        call(|a| {
            a();
        });
    }

There is no replacement for this pattern. For all closures which are stored in
structures, it was previously allowed to invoke the closure through `&self` but
it now requires invocation through `&mut self`.

The standard library has a good number of violations of this new rule, but the
fixes will be separated into multiple breaking change commits.

Closes #12224

[breaking-change]
2014-04-23 10:03:43 -07:00
bors
b5dd3f05fe auto merge of #13689 : alexcrichton/rust/ignore-tcp-connect-freebsd, r=brson
The BSD builders are failing with a different error that is not a timeout error
(Connection reset by peer), so this test isn't really all that useful on
freebsd. Due to a lack of a better idea of how to test a connect timeout, this
test is going to just be ignored for now.
2014-04-23 09:56:38 -07:00
Flavio Percoco
2e358672f8 rustc: fix de-@rooting fallout 2014-04-23 18:22:11 +02:00
Flavio Percoco
6e53cfa61e syntax: fix de-@rooting fallout 2014-04-23 18:22:09 +02:00
Flavio Percoco
aff620de1e rustc: Remove moved_variables_set 2014-04-23 18:22:05 +02:00
Flavio Percoco
d10735e384 Treat @T like ~T in borrowck
`@` pointers used to have special rooting and regions management. With `@`
moving to standalone library, we don't need to keep that special
treatment around. This patch modifies the way `@` pointers are treated by
treating them as if they were `~` pointers

Region checker and borrow checker were modified in this patch.

Closes #11586

[breaking-change]
2014-04-23 18:19:44 +02:00