Commit Graph

28194 Commits

Author SHA1 Message Date
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
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
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
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
Eduard Burtescu
9dc99c89d3 rustc: de-@ stats. 2014-04-22 19:20:12 +03:00
Eduard Burtescu
938eaaa304 rustc: de-@ adt::Repr. 2014-04-22 19:20:12 +03:00
Eduard Burtescu
344ce17036 rustc: de-@ debuginfo. 2014-04-22 19:20:12 +03:00
Eduard Burtescu
57aa0eb0aa rustc: de-@ middle::ty. 2014-04-22 19:20:12 +03:00
Eduard Burtescu
1e5a112922 rustc: remove ty::Impl. 2014-04-22 19:14:52 +03:00
Eduard Burtescu
8f3cfe064b rustc: de-@ ty::type_err. 2014-04-22 19:06:56 +03:00
Eduard Burtescu
3fbc57894a rustc: de-@ param_substs. 2014-04-22 19:06:56 +03:00
Eduard Burtescu
7b3d6afe0a rustc: de-@ mono_id. 2014-04-22 19:06:55 +03:00
Eduard Burtescu
5fa7be659c rustc: slightly optimize make_mono_id to not clone lots of vectors. 2014-04-22 19:06:55 +03:00
Eduard Burtescu
c709c1efc6 rustc: remove obsolete monomorphization modes. 2014-04-22 19:06:55 +03:00
Eduard Burtescu
811bbfc782 rustc: de-@ ty::ParamBounds. 2014-04-22 19:06:54 +03:00
Eduard Burtescu
1a76ac320c rustc: de-@ trans::_match. 2014-04-22 19:06:54 +03:00
Eduard Burtescu
075ab30650 rustc: de-@ metadata::cstore. 2014-04-22 19:06:54 +03:00
Eduard Burtescu
fa33012b71 rustc: de-@ mem_categorization. 2014-04-22 19:06:54 +03:00
Eduard Burtescu
d55deaeb21 rustc: de-@ borrowck. 2014-04-22 19:06:53 +03:00
Eduard Burtescu
3683f16e9e rustc: de-@ resolve. 2014-04-22 19:06:53 +03:00
Eduard Burtescu
2a4dd43e44 rustc: de-@ lint. 2014-04-22 19:06:53 +03:00
Eduard Burtescu
186ac7116c rustc: de-@ freevars. 2014-04-22 19:06:52 +03:00
Eduard Burtescu
1350fbdb24 rustc: de-@ some RefCell's. 2014-04-22 19:06:43 +03:00
bors
c03d658f7e auto merge of #13638 : alexcrichton/rust/fix-windows-tcp-timeout-bug, r=brson
When a uv_tcp_t is closed in libuv, it will still invoke the pending connect_cb,
and I thought that it would always call it with ECANCELED, but it turns out that
sometimes we'll get a different error code instead. Handle this case by checking
to see if the request's data is NULL and bail out if so (the timeout expired).
2014-04-22 08:41:32 -07:00
bors
92f6b925a9 auto merge of #13657 : edwardw/rust/ppaux-ice, r=alexcrichton
Closes #13599
2014-04-22 07:31:43 -07:00
Eduard Burtescu
f3f8a736c9 rustc: de-@ lang_items. 2014-04-22 17:18:21 +03:00
Eduard Burtescu
250ae7923f rustc: make MemCategorizationContext immutable. 2014-04-22 17:18:21 +03:00
Eduard Burtescu
45c8cb3597 rustc: remove unused errors_reported field from regionck. 2014-04-22 17:18:21 +03:00
Eduard Burtescu
acc5c971ba rustc: de-@ ty::AutoAdjustment. 2014-04-22 17:18:21 +03:00
Eduard Burtescu
c9bf84333d rustc: de-@ method and vtable maps. 2014-04-22 17:18:21 +03:00
Eduard Burtescu
158d7a19b3 rustc: move the method and vtable maps into ty::ctxt. 2014-04-22 17:18:20 +03:00
bors
77303101bb auto merge of #13583 : FlaPer87/rust/special-unsafe, r=nikomatsakis
This patch adds a special rule for `Unsafe<T>` and makes it `Share`
regardless of whether T is `Share`.

[breaking-change]

Closes #13125

cc @nikomatsakis
2014-04-22 06:21:33 -07:00
Flavio Percoco
5b4d54ee5b Specialize kinds inference for Unsafe<T>
This patch adds a special rule for `Unsafe<T>` and makes it `Share`
regardless of whether T is `Share`.

[breaking-change]

Closes #13125
2014-04-22 14:18:36 +02:00
bors
c46c7607a4 auto merge of #13653 : jbcrail/rust/fix-comment-mistakes, r=alexcrichton 2014-04-22 05:06:33 -07:00
bors
ef1b929b2f auto merge of #13646 : cgaebel/rust/hashmap-cleanup, r=alexcrichton
I went through the HashMap module, fixed spelling mistakes, minor inefficiencies, added tests, and other trivial changes. Hopefully this won't be a controversial PR.
2014-04-22 03:16:33 -07:00
bors
a5cd502e47 auto merge of #13630 : alexcrichton/rust/correct-green-bounds, r=brson
These were mistakenly not updated as part of the removal of the Send bound by
default on procedures.

cc #13629
2014-04-22 02:06:35 -07:00
Edward Wang
741142e3fa Fix ICE when reporting closure and proc mismatch
Closes #13599
2014-04-22 15:54:02 +08:00
bors
7d725a340f auto merge of #13618 : yuriks/rust/lru-cache, r=brson
Just a few space saving optimizations that end up making the code less cluttered too. I'd like to someone to review the last commit closely, I don't have much experience with writing unsafe code, I had someone walk me through how to use cast::forget in IRC.
2014-04-21 23:01:39 -07:00
bors
e6c8c7c9c6 auto merge of #13587 : adrientetar/rust/more-docs, r=brson
- Use Fira Sans for headlines, Heuristica for the body (Adobe Utopia derivative). Both are licensed under the SIL OFL license. (I didn't include BoldItalic because it is sparingly used.)
- Split TOC into 2 columns for the docs except manual (too tall, too wide to be readable).
- Some fixes to rustdoc, bring styles in coherency with eachother
- A few tweaks

Two examples: [modified tutorial](http://adrientetar.legtux.org/cached/rust-docs/tutorial.htm) and [modified manual](http://adrientetar.legtux.org/cached/rust-docs/manual.htm).

Rustdoc got some fixes, here is [modified `enum.FileType`](http://adrientetar.legtux.org/cached/rust-docs/enum.FileType.htm), [modified `std`](http://adrientetar.legtux.org/cached/rust-docs/std.htm) and [modified `std::io`](http://adrientetar.legtux.org/cached/rust-docs/io.htm).

#13484, #13485 follow-up.

cc @brson
2014-04-21 21:46:38 -07:00
Brendan McLoughlin
78cdec0951 Update the "Additional tutorials" link 2014-04-21 21:47:22 -04:00
bors
960bf8ce66 auto merge of #13435 : edwardw/rust/span, r=brson
When reporting "consider removing this semicolon" hint message, the
offending semicolon may come from macro call site instead of macro
itself. Using the more appropriate span makes the hint more helpful.

Closes #13428.
2014-04-21 18:41:35 -07:00
Clark Gaebel
65d56612bb Just some general cleanup in the HashMap module
I went through the HashMap module, fixed spelling mistakes, minor
inefficiencies, added tests, and other trivial changes.
2014-04-21 20:08:30 -04:00
bors
4401f88688 auto merge of #13631 : alexcrichton/rust/fix-mk-cross, r=brson
Instead of passing through CC which may have things like ccache and other
arguments (when using clang) this commit filters out the necessary arguments
from CC to pass the right linker to rustc.

Closes #13562
2014-04-21 16:06:32 -07:00
Guillaume Pinot
0a0e2c36af fix and improve shootout-chameneos-redux
* fix official shootout test (spacing)
* use libgreen to improve performances
* simplify and modernize code
* remove warnings
2014-04-21 23:12:58 +02:00
bors
829c00cb09 auto merge of #13656 : TeXitoi/rust/shootout-threadring-rewrite, r=alexcrichton
* simplify the code
* remove trace to satisfy official shootout test
* use libgreen to improve performances
2014-04-21 13:06:32 -07:00