Commit Graph

28391 Commits

Author SHA1 Message Date
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
Flavio Percoco
e80089576e rustc: Remove obsolete error_out_of_root_scope variant 2014-04-23 18:19:40 +02:00
Flavio Percoco
fa43f6a7a6 Update tests and move other tests around 2014-04-23 18:19:36 +02:00
Flavio Percoco
bea94993d2 rustc: Remove root_map entirely 2014-04-23 18:19:33 +02:00
Flavio Percoco
4871a16c27 rustc: Remove root_map usage from lifetime 2014-04-23 18:19:30 +02:00
Flavio Percoco
3c1b1a31b0 rustc: Remove root_map usage from _match 2014-04-23 18:19:26 +02:00
Flavio Percoco
13c8edfa2e rustc: remove usage of root_map from astencode 2014-04-23 18:19:19 +02:00
Flavio Percoco
71f054ddd0 Remove special rooting code from trans
[breaking-change]

cc #11586
2014-04-23 18:19:05 +02:00
Alex Crichton
aa849fb6ca 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.
2014-04-23 08:40:41 -07:00
Edward Wang
6fa4036c12 Hide trait rc::RcBoxPtr from docs
It is for internal use only and should not appear in docs.
2014-04-23 23:35:45 +08:00
Edward Wang
2cf1e4b0ce Honor hidden doc attribute of derivable trait methods
Closes #13698
2014-04-23 22:43:45 +08:00
bors
bb580f1a56 auto merge of #13694 : jacob-hegna/rust/master, r=brson
... and uint_macros.rs
2014-04-23 05:51:30 -07:00
bors
e049a7003b 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.
2014-04-23 04:36:32 -07:00
bors
1ce0b98c7b 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.
2014-04-23 03:21:32 -07:00
bors
49b216539f 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.
2014-04-23 02:11:32 -07:00
bors
34ff34d11a auto merge of #13687 : exscape/mut-vector-Show/master, r=alexcrichton
Removes the need for hacks to println! mutable slices, among other things.
2014-04-23 00:31:33 -07:00
bors
30fe55066a 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.
2014-04-22 22:01:32 -07:00
bors
696f16ec2e 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).
2014-04-22 20:51:31 -07:00
Nick Cameron
5729d9b413 Review changes 2014-04-23 15:44:24 +12:00
bors
bcc3e8c0d4 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
2014-04-22 19:31:35 -07:00
David Creswick
e72d49a806 Apply lint attrs to individual "use" declarations
Fixes #10534
2014-04-22 21:25:27 -05:00
Vadim Chugunov
f686e5ebff Fixed Win64 build 2014-04-22 18:08:06 -07:00
Jacob Hegna
a14c34d670 Removed trailing whitespace in on line 242 in int_macros.rs and on line 156 in uint_macros.rs 2014-04-22 19:47:57 -05:00
Daniel Micay
dc7d7d2698 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
2014-04-22 20:47:28 -04:00
Jacob Hegna
f197e695ca Added examples for parse_bytes(buf: &[u8], radix: uint) in int_macros.rs and uint_macros.rs 2014-04-22 19:38:27 -05:00
Nick Cameron
0540a59382 Check for unsized types in enums.
And allow the last field of a struct or variant to be unsized.
2014-04-23 12:30:58 +12:00
Nick Cameron
f78add10cd Support unsized types with the type keyword 2014-04-23 12:30:58 +12:00
Nick Cameron
c3b2f2b0c6 Add a span to ast::TyParam 2014-04-23 12:30:58 +12:00
bors
3ec3c092ee auto merge of #13683 : aochagavia/rust/pr, r=alexcrichton
Replaced "len" by "length", to match the given code example.
2014-04-22 17:26:33 -07:00
Daniel Micay
b2724727d5 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.
2014-04-22 20:15:55 -04:00
Vadim Chugunov
6619134d49 Upgrade compiler-rt 2014-04-22 15:50:51 -07:00
Vadim Chugunov
7995528dae There are no 64-bit Windows snapshots yet, so we'll use 32-bit ones instead. 2014-04-22 15:50:50 -07:00
bors
09bfb92fdc auto merge of #13674 : pcwalton/rust/more-str-inlines, r=alexcrichton
Was killing performance of selector matching in Servo.

r? @alexcrichton (or anyone)
2014-04-22 15:31:33 -07:00
bors
1e3358903d 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.
2014-04-22 14:21:35 -07:00
Alex Crichton
f1fb57a5cc 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.
2014-04-22 13:24:12 -07:00
bors
16a5b3127a auto merge of #13670 : eddyb/rust/more-de-at, r=pcwalton 2014-04-22 13:11:36 -07:00
bors
6c82eb5d4d 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
2014-04-22 12:01:34 -07:00
bors
0966ee5285 auto merge of #13651 : ryantm/rust/master, r=brson 2014-04-22 10:46:32 -07:00
Thomas Backman
aa4bc89b17 Implement Show for &mut [T] 2014-04-22 19:41:02 +02:00
Eduard Burtescu
70f3409875 rustc: de-@ llvm. 2014-04-22 19:20:13 +03:00
Eduard Burtescu
637addde1f rustc: de-@ trans::tydesc_info. 2014-04-22 19:20:13 +03:00
Eduard Burtescu
3508891b0c rustc: remove typeck::isr_alist. 2014-04-22 19:20:13 +03:00