]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #13735 : aturon/rust/float-consts-take-2, r=brson
bors [Fri, 25 Apr 2014 19:01:27 +0000 (12:01 -0700)]
auto merge of #13735 : aturon/rust/float-consts-take-2, r=brson

Follow-up on issue #13297 and PR #13710.  Instead of following the (confusing) C/C++ approach
of using `MIN_VALUE` for the smallest *positive* number, we introduce `MIN_POS_VALUE` (and
in the Float trait, `min_pos_value`) to represent this number.

This patch also removes a few remaining redundantly-defined constants that were missed last
time around.

10 years agoauto merge of #13741 : klutzy/rust/test-reachable, r=alexcrichton
bors [Fri, 25 Apr 2014 17:51:24 +0000 (10:51 -0700)]
auto merge of #13741 : klutzy/rust/test-reachable, r=alexcrichton

It didn't work because it tried to call itself but symbols are not
exported as default in executables.

Note that `fun5` is not internal anymore since it is in library.

Second commit removes/updates some old tests.

10 years agoauto merge of #13747 : michaelfairley/rust/patch-1, r=alexcrichton
bors [Fri, 25 Apr 2014 16:21:20 +0000 (09:21 -0700)]
auto merge of #13747 : michaelfairley/rust/patch-1, r=alexcrichton

10 years agoFix variable name in prose to match code it's describing
Michael Fairley [Fri, 25 Apr 2014 15:15:47 +0000 (10:15 -0500)]
Fix variable name in prose to match code it's describing

10 years agotest: Remove/update some old ignored tests
klutzy [Fri, 25 Apr 2014 05:29:30 +0000 (14:29 +0900)]
test: Remove/update some old ignored tests

10 years agotest: Enable extern-fn-reachable test
klutzy [Fri, 25 Apr 2014 04:57:54 +0000 (13:57 +0900)]
test: Enable extern-fn-reachable test

It didn't work because it tried to call itself but symbols are not
exported as default in executables.

Note that `fun5` is not internal anymore since it is in library.

10 years agoauto merge of #13700 : BurntSushi/rust/regexp, r=alexcrichton
bors [Fri, 25 Apr 2014 06:41:15 +0000 (23:41 -0700)]
auto merge of #13700 : BurntSushi/rust/regexp, r=alexcrichton

Implements [RFC 7](https://github.com/rust-lang/rfcs/blob/master/active/0007-regexps.md) and will hopefully resolve #3591. The crate is marked as experimental. It includes a syntax extension for compiling regexps to native Rust code.

Embeds and passes the `basic`, `nullsubexpr` and `repetition` tests from [Glenn Fowler's (slightly modified by Russ Cox for leftmost-first semantics) testregex test suite](http://www2.research.att.com/~astopen/testregex/testregex.html). I've also hand written a plethora of other tests that exercise Unicode support, the parser, public API, etc. Also includes a `regex-dna` benchmark for the shootout.

I know the addition looks huge at first, but consider these things:

1. More than half the number of lines is dedicated to Unicode character classes.
2. Of the ~4,500 lines remaining, 1,225 of them are comments.
3. Another ~800 are tests.
4. That leaves 2500 lines for the meat. The parser is ~850 of them. The public API, compiler, dynamic VM and code generator (for `regexp!`) make up the rest.

10 years agoIgnore regex tests (regular, cfail and benchmark) on Windows (for now).
Andrew Gallant [Fri, 25 Apr 2014 05:37:27 +0000 (01:37 -0400)]
Ignore regex tests (regular, cfail and benchmark) on Windows (for now).

10 years agoauto merge of #13697 : pongad/rust/consts, r=alexcrichton
bors [Fri, 25 Apr 2014 05:31:16 +0000 (22:31 -0700)]
auto merge of #13697 : pongad/rust/consts, r=alexcrichton

I decided to put architecture constants in another mod. They are not used, so a part of me is thinking of just getting rid of them altogether. The rest should be similar to what @brson wants.
Fixes #13536

10 years agoCleaned up os::consts. The module only exposes constants for the target OS and arch.
Michael Darakananda [Wed, 23 Apr 2014 05:01:31 +0000 (01:01 -0400)]
Cleaned up os::consts. The module only exposes constants for the target OS and arch.

Constants for other OS's and arch's must be defined manually.
[breaking-change]

10 years agomk: Copy fewer libraries into the host artifacts
Andrew Gallant [Fri, 25 Apr 2014 04:31:29 +0000 (00:31 -0400)]
mk: Copy fewer libraries into the host artifacts

10 years agoAdd a regex crate to the Rust distribution.
Andrew Gallant [Fri, 25 Apr 2014 04:27:24 +0000 (00:27 -0400)]
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

10 years agoauto merge of #13723 : alexcrichton/rust/pipe-connect-timeout, r=brson
bors [Fri, 25 Apr 2014 02:36:14 +0000 (19:36 -0700)]
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

10 years agoauto merge of #13711 : alexcrichton/rust/snapshots, r=brson
bors [Fri, 25 Apr 2014 01:26:15 +0000 (18:26 -0700)]
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

10 years agoauto merge of #13671 : dcrewi/rust/lint-directives-on-use-items, r=alexcrichton
bors [Fri, 25 Apr 2014 00:16:14 +0000 (17:16 -0700)]
auto merge of #13671 : dcrewi/rust/lint-directives-on-use-items, r=alexcrichton

Fixes #10534

10 years agoadd min_pos_value constant for floats
Aaron Turon [Fri, 25 Apr 2014 00:09:58 +0000 (17:09 -0700)]
add min_pos_value constant for floats

Follow-up on issue #13297 and PR #13710.  Instead of following the (confusing) C/C++ approach
of using `MIN_VALUE` for the smallest *positive* number, we introduce `MIN_POS_VALUE` (and
in the Float trait, `min_pos_value`) to represent this number.

This patch also removes a few remaining redundantly-defined constants that were missed last
time around.

10 years agostd: Add timeouts to unix connect/accept
Alex Crichton [Wed, 23 Apr 2014 01:38:59 +0000 (18:38 -0700)]
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

10 years agonative: Remove unused and untested UnixDatagram
Alex Crichton [Tue, 22 Apr 2014 23:23:19 +0000 (16:23 -0700)]
native: Remove unused and untested UnixDatagram

10 years agoauto merge of #13729 : chris-morgan/rust/fix-vim-indent, r=alexcrichton
bors [Thu, 24 Apr 2014 22:01:19 +0000 (15:01 -0700)]
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

10 years agoauto merge of #13720 : aturon/rust/walk_dir-perf, r=alexcrichton
bors [Thu, 24 Apr 2014 20:51:19 +0000 (13:51 -0700)]
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.

10 years agoauto merge of #13706 : alexcrichton/rust/test-nocapture, r=brson
bors [Thu, 24 Apr 2014 18:31:22 +0000 (11:31 -0700)]
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

10 years agofix O(n^2) perf bug for std::io::fs::walk_dir
Aaron Turon [Thu, 24 Apr 2014 00:09:58 +0000 (17:09 -0700)]
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.

10 years agoauto merge of #13619 : alexcrichton/rust/update-libuv, r=brson
bors [Thu, 24 Apr 2014 17:21:22 +0000 (10:21 -0700)]
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

10 years agotest: Add an option to not capture output
Alex Crichton [Wed, 23 Apr 2014 16:38:46 +0000 (09:38 -0700)]
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

10 years agoUpdate libuv
Alex Crichton [Sat, 19 Apr 2014 02:09:31 +0000 (19:09 -0700)]
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

10 years agoauto merge of #13715 : nick29581/rust/unsized-assign2, r=nikomatsakis
bors [Thu, 24 Apr 2014 15:16:24 +0000 (08:16 -0700)]
auto merge of #13715 : nick29581/rust/unsized-assign2, r=nikomatsakis

Closes #13376.

10 years agoauto merge of #13713 : edwardw/rust/methodcall-span, r=alexcrichton
bors [Thu, 24 Apr 2014 14:06:26 +0000 (07:06 -0700)]
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

10 years agoFix Vim indent regressions from #13600.
Chris Morgan [Thu, 24 Apr 2014 13:33:28 +0000 (23:33 +1000)]
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.

10 years agoauto merge of #13559 : FlaPer87/rust/remove-special-root, r=nikomatsakis
bors [Thu, 24 Apr 2014 12:51:28 +0000 (05:51 -0700)]
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
10 years agoauto merge of #13710 : aturon/rust/float-constants, r=brson
bors [Thu, 24 Apr 2014 10:21:28 +0000 (03:21 -0700)]
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.

10 years agorustdoc: fix de-@rooting fallout
Niko Matsakis [Thu, 24 Apr 2014 03:29:38 +0000 (23:29 -0400)]
rustdoc: fix de-@rooting fallout

10 years agoauto merge of #13531 : alexcrichton/rust/fix-some-ices, r=brson
bors [Thu, 24 Apr 2014 08:26:29 +0000 (01:26 -0700)]
auto merge of #13531 : alexcrichton/rust/fix-some-ices, r=brson

See the commits for the affected issues.

10 years agoauto merge of #12812 : sfackler/rust/attr-arm, r=alexcrichton
bors [Thu, 24 Apr 2014 06:51:30 +0000 (23:51 -0700)]
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.

10 years agoAllow attributes on match arms
Steven Fackler [Wed, 23 Apr 2014 04:54:48 +0000 (21:54 -0700)]
Allow attributes on match arms

RFC: 0008-match-arm-attributes

10 years agoauto merge of #13704 : edwardw/rust/doc-hidden, r=alexcrichton
bors [Thu, 24 Apr 2014 04:46:34 +0000 (21:46 -0700)]
auto merge of #13704 : edwardw/rust/doc-hidden, r=alexcrichton

Closes #13698

10 years agoauto merge of #13675 : sfackler/rust/taskbuilder-new, r=alexcrichton
bors [Thu, 24 Apr 2014 03:31:36 +0000 (20:31 -0700)]
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]

10 years agoMove task::task() to TaskBuilder::new()
Steven Fackler [Tue, 22 Apr 2014 04:19:59 +0000 (21:19 -0700)]
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]

10 years agoauto merge of #13688 : alexcrichton/rust/accept-timeout, r=brson
bors [Thu, 24 Apr 2014 02:21:33 +0000 (19:21 -0700)]
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

10 years agostd: Add support for an accept() timeout
Alex Crichton [Tue, 22 Apr 2014 03:30:07 +0000 (20:30 -0700)]
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

10 years agoPrevent unsized types being stored in variables
Nick Cameron [Wed, 23 Apr 2014 23:57:22 +0000 (11:57 +1200)]
Prevent unsized types being stored in variables

Closes #13376.

10 years agoCalibrate span for method call error messages
Edward Wang [Wed, 23 Apr 2014 21:19:23 +0000 (05:19 +0800)]
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

10 years agoRegister new snapshots
Alex Crichton [Wed, 23 Apr 2014 21:58:50 +0000 (14:58 -0700)]
Register new snapshots

These are the first successful snapshots after the LLVM upgrade, built with LLVM
that requires C++11

10 years agoauto merge of #13705 : edwardw/rust/rcboxptr-doc, r=alexcrichton
bors [Wed, 23 Apr 2014 21:48:54 +0000 (14:48 -0700)]
auto merge of #13705 : edwardw/rust/rcboxptr-doc, r=alexcrichton

It is for internal use only and should not appear in docs.

10 years agofix std::f32 and std::f64 constants
Aaron Turon [Wed, 23 Apr 2014 19:04:34 +0000 (12:04 -0700)]
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.

10 years agoauto merge of #13584 : rcxdude/rust/cross-syntax-ext, r=alexcrichton
bors [Wed, 23 Apr 2014 20:11:37 +0000 (13:11 -0700)]
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.

10 years agoEnable use of syntax extensions when cross compiling.
Douglas Young [Thu, 17 Apr 2014 15:52:25 +0000 (16:52 +0100)]
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.

10 years agoauto merge of #13686 : alexcrichton/rust/issue-12224, r=nikomatsakis
bors [Wed, 23 Apr 2014 19:01:53 +0000 (12:01 -0700)]
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

10 years agorustc: Don't die when a crate id can't be inferred
Alex Crichton [Tue, 15 Apr 2014 14:47:26 +0000 (07:47 -0700)]
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

10 years agorustc: Give a friendlier error when writing deps
Alex Crichton [Tue, 15 Apr 2014 14:35:17 +0000 (07:35 -0700)]
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

10 years agorustc: Fix passing errors from LLVM to rustc
Alex Crichton [Tue, 15 Apr 2014 14:25:22 +0000 (07:25 -0700)]
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

10 years agoFix other bugs with new closure borrowing
Alex Crichton [Tue, 22 Apr 2014 06:25:18 +0000 (23:25 -0700)]
Fix other bugs with new closure borrowing

This fixes various issues throughout the standard distribution and tests.

10 years agostd: Change Finally to take `&mut self`
Alex Crichton [Tue, 22 Apr 2014 05:28:21 +0000 (22:28 -0700)]
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]

10 years agostd: Change CharEq to take `&mut self`
Alex Crichton [Tue, 22 Apr 2014 05:21:37 +0000 (22:21 -0700)]
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]

10 years agostd: Change RandomAccessIterator to use `&mut self`
Alex Crichton [Tue, 22 Apr 2014 05:15:42 +0000 (22:15 -0700)]
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]

10 years agorustc: Tweak the borrow on closure invocations
Alex Crichton [Tue, 22 Apr 2014 05:02:19 +0000 (22:02 -0700)]
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]

10 years agoauto merge of #13689 : alexcrichton/rust/ignore-tcp-connect-freebsd, r=brson
bors [Wed, 23 Apr 2014 16:56:38 +0000 (09:56 -0700)]
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.

10 years agorustc: fix de-@rooting fallout
Flavio Percoco [Wed, 23 Apr 2014 16:16:23 +0000 (18:16 +0200)]
rustc: fix de-@rooting fallout

10 years agosyntax: fix de-@rooting fallout
Flavio Percoco [Wed, 23 Apr 2014 16:16:06 +0000 (18:16 +0200)]
syntax: fix de-@rooting fallout

10 years agorustc: Remove moved_variables_set
Flavio Percoco [Tue, 22 Apr 2014 22:59:42 +0000 (00:59 +0200)]
rustc: Remove moved_variables_set

10 years agoTreat @T like ~T in borrowck
Flavio Percoco [Wed, 16 Apr 2014 23:03:14 +0000 (01:03 +0200)]
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]

10 years agorustc: Remove obsolete error_out_of_root_scope variant
Flavio Percoco [Wed, 16 Apr 2014 23:00:00 +0000 (01:00 +0200)]
rustc: Remove obsolete error_out_of_root_scope variant

10 years agoUpdate tests and move other tests around
Flavio Percoco [Wed, 16 Apr 2014 22:58:55 +0000 (00:58 +0200)]
Update tests and move other tests around

10 years agorustc: Remove root_map entirely
Flavio Percoco [Wed, 16 Apr 2014 21:33:38 +0000 (23:33 +0200)]
rustc: Remove root_map entirely

10 years agorustc: Remove root_map usage from lifetime
Flavio Percoco [Tue, 15 Apr 2014 21:33:37 +0000 (23:33 +0200)]
rustc: Remove root_map usage from lifetime

10 years agorustc: Remove root_map usage from _match
Flavio Percoco [Tue, 15 Apr 2014 20:47:37 +0000 (22:47 +0200)]
rustc: Remove root_map usage from _match

10 years agorustc: remove usage of root_map from astencode
Flavio Percoco [Tue, 15 Apr 2014 20:43:24 +0000 (22:43 +0200)]
rustc: remove usage of root_map from astencode

10 years agoRemove special rooting code from trans
Flavio Percoco [Tue, 15 Apr 2014 20:05:37 +0000 (22:05 +0200)]
Remove special rooting code from trans

[breaking-change]

cc #11586

10 years agotest: Ignore tcp-connect-timeout on freebsd
Alex Crichton [Tue, 22 Apr 2014 20:03:54 +0000 (13:03 -0700)]
test: Ignore tcp-connect-timeout on freebsd

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.

10 years agoHide trait rc::RcBoxPtr from docs
Edward Wang [Wed, 23 Apr 2014 15:35:45 +0000 (23:35 +0800)]
Hide trait rc::RcBoxPtr from docs

It is for internal use only and should not appear in docs.

10 years agoHonor hidden doc attribute of derivable trait methods
Edward Wang [Wed, 23 Apr 2014 14:43:45 +0000 (22:43 +0800)]
Honor hidden doc attribute of derivable trait methods

Closes #13698

10 years agoauto merge of #13694 : jacob-hegna/rust/master, r=brson
bors [Wed, 23 Apr 2014 12:51:30 +0000 (05:51 -0700)]
auto merge of #13694 : jacob-hegna/rust/master, r=brson

... and uint_macros.rs

10 years agoauto merge of #13693 : thestinger/rust/mem, r=alexcrichton
bors [Wed, 23 Apr 2014 11:36:32 +0000 (04:36 -0700)]
auto merge of #13693 : thestinger/rust/mem, r=alexcrichton

This exposes volatile versions of the memset/memmove/memcpy intrinsics.

The volatile parameter must be constant, so this can't simply be a
parameter to our intrinsics.

10 years agoauto merge of #13692 : vadimcn/rust/Win64-pre, r=alexcrichton
bors [Wed, 23 Apr 2014 10:21:32 +0000 (03:21 -0700)]
auto merge of #13692 : vadimcn/rust/Win64-pre, r=alexcrichton

Stack unwinding doesn't work yet, so this won't pass a lot of tests.

10 years agoauto merge of #13690 : alexcrichton/rust/unlink-unix-pipe, r=brson
bors [Wed, 23 Apr 2014 09:11:32 +0000 (02:11 -0700)]
auto merge of #13690 : alexcrichton/rust/unlink-unix-pipe, r=brson

This prevents unix sockets from remaining on the system all over the place, and
more closely mirrors the behavior of libuv and windows pipes.

10 years agoauto merge of #13687 : exscape/mut-vector-Show/master, r=alexcrichton
bors [Wed, 23 Apr 2014 07:31:33 +0000 (00:31 -0700)]
auto merge of #13687 : exscape/mut-vector-Show/master, r=alexcrichton

Removes the need for hacks to println! mutable slices, among other things.

10 years agoauto merge of #13597 : bjz/rust/float-api, r=brson
bors [Wed, 23 Apr 2014 05:01:32 +0000 (22:01 -0700)]
auto merge of #13597 : bjz/rust/float-api, r=brson

This pull request:

- Merges the `Round` trait into the `Float` trait, continuing issue #10387.
- Has floating point functions take their parameters by value.
- Cleans up the formatting and organisation in the definition and implementations of the `Float` trait.

More information on the breaking changes can be found in the commit messages.

10 years agoauto merge of #13398 : nick29581/rust/unsized-enum, r=nikomatsakis
bors [Wed, 23 Apr 2014 03:51:31 +0000 (20:51 -0700)]
auto merge of #13398 : nick29581/rust/unsized-enum, r=nikomatsakis

Now with proper checking of enums and allows unsized fields as the last field in a struct or variant. This PR only checks passing of unsized types and distinguishing them from sized ones. To be safe we also need to control storage.

Closes issues #12969 and #13121, supersedes #13375 (all the discussion there is valid here too).

10 years agoReview changes
Nick Cameron [Sun, 20 Apr 2014 06:53:37 +0000 (18:53 +1200)]
Review changes

10 years agoauto merge of #13415 : thestinger/rust/f128, r=alexcrichton
bors [Wed, 23 Apr 2014 02:31:35 +0000 (19:31 -0700)]
auto merge of #13415 : thestinger/rust/f128, r=alexcrichton

This currently requires linking against a library like libquadmath (or
libgcc), because compiler-rt barely has any support for this and most
hardware does not yet have 128-bit precision floating point. For this
reason, it's currently hidden behind a feature gate.

When compiler-rt is updated to trunk, some tests can be added for
constant evaluation since there will be support for the comparison
operators.

Closes #13381

10 years agoApply lint attrs to individual "use" declarations
David Creswick [Wed, 23 Apr 2014 01:09:21 +0000 (20:09 -0500)]
Apply lint attrs to individual "use" declarations

Fixes #10534

10 years agoFixed Win64 build
Vadim Chugunov [Wed, 19 Mar 2014 07:42:02 +0000 (00:42 -0700)]
Fixed Win64 build

10 years agoRemoved trailing whitespace in on line 242 in int_macros.rs and on line 156 in uint_m...
Jacob Hegna [Wed, 23 Apr 2014 00:47:57 +0000 (19:47 -0500)]
Removed trailing whitespace in on line 242 in int_macros.rs and on line 156 in uint_macros.rs

10 years agoadd support for quadruple precision floating point
Daniel Micay [Tue, 8 Apr 2014 22:08:08 +0000 (18:08 -0400)]
add support for quadruple precision floating point

This currently requires linking against a library like libquadmath (or
libgcc), because compiler-rt barely has any support for this and most
hardware does not yet have 128-bit precision floating point. For this
reason, it's currently hidden behind a feature gate.

When compiler-rt is updated to trunk, some tests can be added for
constant evaluation since there will be support for the comparison
operators.

Closes #13381

10 years agoAdded examples for parse_bytes(buf: &[u8], radix: uint) in int_macros.rs and uint_mac...
Jacob Hegna [Wed, 23 Apr 2014 00:38:27 +0000 (19:38 -0500)]
Added examples for parse_bytes(buf: &[u8], radix: uint) in int_macros.rs and uint_macros.rs

10 years agoCheck for unsized types in enums.
Nick Cameron [Tue, 8 Apr 2014 09:00:20 +0000 (21:00 +1200)]
Check for unsized types in enums.

And allow the last field of a struct or variant to be unsized.

10 years agoSupport unsized types with the `type` keyword
Nick Cameron [Thu, 3 Apr 2014 00:38:45 +0000 (13:38 +1300)]
Support unsized types with the `type` keyword

10 years agoAdd a span to ast::TyParam
Nick Cameron [Thu, 3 Apr 2014 00:53:57 +0000 (13:53 +1300)]
Add a span to ast::TyParam

10 years agoauto merge of #13683 : aochagavia/rust/pr, r=alexcrichton
bors [Wed, 23 Apr 2014 00:26:33 +0000 (17:26 -0700)]
auto merge of #13683 : aochagavia/rust/pr, r=alexcrichton

Replaced "len" by "length", to match the given code example.

10 years agoadd volatile copy/copy_nonoverlapping/set
Daniel Micay [Tue, 22 Apr 2014 23:51:14 +0000 (19:51 -0400)]
add volatile copy/copy_nonoverlapping/set

This exposes volatile versions of the memset/memmove/memcpy intrinsics.

The volatile parameter must be constant, so this can't simply be a
parameter to our intrinsics.

10 years agoUpgrade compiler-rt
Vadim Chugunov [Tue, 22 Apr 2014 01:43:19 +0000 (18:43 -0700)]
Upgrade compiler-rt

10 years agoThere are no 64-bit Windows snapshots yet, so we'll use 32-bit ones instead.
Vadim Chugunov [Tue, 22 Apr 2014 22:48:51 +0000 (15:48 -0700)]
There are no 64-bit Windows snapshots yet, so we'll use 32-bit ones instead.

10 years agoauto merge of #13674 : pcwalton/rust/more-str-inlines, r=alexcrichton
bors [Tue, 22 Apr 2014 22:31:33 +0000 (15:31 -0700)]
auto merge of #13674 : pcwalton/rust/more-str-inlines, r=alexcrichton

Was killing performance of selector matching in Servo.

r? @alexcrichton (or anyone)

10 years agoauto merge of #13673 : bmac/rust/utorial-fix, r=alexcrichton
bors [Tue, 22 Apr 2014 21:21:35 +0000 (14:21 -0700)]
auto merge of #13673 : bmac/rust/utorial-fix, r=alexcrichton

This pr updates the "Additional tutorials" link in the scope section to match the "What next?" link in the table of contents.

10 years agonative: Unlink unix socket paths on drop
Alex Crichton [Tue, 22 Apr 2014 20:21:30 +0000 (13:21 -0700)]
native: Unlink unix socket paths on drop

This prevents unix sockets from remaining on the system all over the place, and
more closely mirrors the behavior of libuv and windows pipes.

10 years agoauto merge of #13670 : eddyb/rust/more-de-at, r=pcwalton
bors [Tue, 22 Apr 2014 20:11:36 +0000 (13:11 -0700)]
auto merge of #13670 : eddyb/rust/more-de-at, r=pcwalton

10 years agoauto merge of #13667 : TeXitoi/rust/shootout-chameneos-redux-fix, r=alexcrichton
bors [Tue, 22 Apr 2014 19:01:34 +0000 (12:01 -0700)]
auto merge of #13667 : TeXitoi/rust/shootout-chameneos-redux-fix, r=alexcrichton

* fix official shootout test (spacing)
* use libgreen to improve performances
* simplify and modernize code
* remove warnings

10 years agoauto merge of #13651 : ryantm/rust/master, r=brson
bors [Tue, 22 Apr 2014 17:46:32 +0000 (10:46 -0700)]
auto merge of #13651 : ryantm/rust/master, r=brson

10 years agoImplement Show for &mut [T]
Thomas Backman [Tue, 22 Apr 2014 17:41:02 +0000 (19:41 +0200)]
Implement Show for &mut [T]

10 years agorustc: de-@ llvm.
Eduard Burtescu [Tue, 22 Apr 2014 00:53:51 +0000 (03:53 +0300)]
rustc: de-@ llvm.

10 years agorustc: de-@ trans::tydesc_info.
Eduard Burtescu [Tue, 22 Apr 2014 00:45:16 +0000 (03:45 +0300)]
rustc: de-@ trans::tydesc_info.