Commit Graph

32212 Commits

Author SHA1 Message Date
Patrick Walton
3ca53d3a10 librustc: Make sure lifetimes in for loop heads outlive the for loop
itself.

This breaks code like:

    for &x in my_vector.iter() {
        my_vector[2] = "wibble";
        ...
    }

Change this code to not invalidate iterators. For example:

    for i in range(0, my_vector.len()) {
        my_vector[2] = "wibble";
        ...
    }

The `for-loop-does-not-borrow-iterators` test for #8372 was incorrect
and has been removed.

Closes #16820.

[breaking-change]
2014-09-08 10:50:34 -07:00
bors
0c73e5fc5f auto merge of #12809 : eddyb/rust/ty-arena, r=cmr
This was inspired by seeing a LLVM flatline of **~600MB** when running rustc with jemalloc (each type's `t_box_` is allocated on the heap, creating a lot of fragmentation, which jemalloc can deal with, unlike glibc).
2014-09-08 15:36:13 +00:00
Björn Steinbrink
cdfa637dad Update LLVM to fix a crash in the MergeFunc pass 2014-09-08 17:07:03 +02:00
bors
6f34760e41 auto merge of #16903 : mahkoh/rust/move_items_unwrap, r=aturon
Closes #16879
2014-09-08 13:46:15 +00:00
Eduard Burtescu
8bfbcddf53 rustdoc: fix fallout from the addition of a 'tcx lifetime on tcx. 2014-09-08 15:28:25 +03:00
Eduard Burtescu
f7a997be05 rustc: fix fallout from the addition of a 'tcx lifetime on trans::Block. 2014-09-08 15:28:24 +03:00
Eduard Burtescu
28be695b2c rustc: fix fallout from the addition of a 'tcx lifetime on tcx. 2014-09-08 15:28:23 +03:00
Eduard Burtescu
22f8b8462e rustc: use a TypedArena to allocate types in the type context. 2014-09-08 15:14:10 +03:00
bors
5c3987985e auto merge of #17053 : thestinger/rust/large_address_aware, r=sfackler,cmr
By default, 32-bit Windows executables are restricted to 2GiB of address
space even when running on 64-bit Windows when 4GiB is available.

Closes #17043
2014-09-08 11:56:12 +00:00
bors
ab7b1c896d auto merge of #17063 : huonw/rust/snap, r=alexcrichton
Closes #16880.
2014-09-08 10:06:15 +00:00
Huon Wilson
cc6a4877a4 rand: inform the optimiser that indexing is never out-of-bounds.
This uses a bitwise mask to ensure that there's no bounds checking for
the array accesses when generating the next random number. This isn't
costless, but the single instruction is nothing compared to the branch.

A `debug_assert` for "bounds check" is preserved to ensure that
refactoring doesn't accidentally break it (i.e. create values of `cnt`
that are out of bounds with the masking causing it to silently wrap-
around).

Before:

    test test::rand_isaac   ... bench: 990 ns/iter (+/- 24) = 808 MB/s
    test test::rand_isaac64 ... bench: 614 ns/iter (+/- 25) = 1302 MB/s

After:

    test test::rand_isaac   ... bench: 877 ns/iter (+/- 134) = 912 MB/s
    test test::rand_isaac64 ... bench: 470 ns/iter (+/- 30) = 1702 MB/s

(It also removes the unsafe code in Isaac64Rng.next_u64, with a *gain*
in performance; today is a good day.)
2014-09-08 19:33:37 +10:00
bors
a39f69f91d auto merge of #17036 : pczarn/rust/issue-15913-ICE-with-call-trans, r=alexcrichton
A match in callee.rs was recognizing some foreign fns as named tuple constructors. A reproducible test case for this is nearly impossible since it depends on the way NodeIds happen to be assigned in different crates.

Fixes #15913
2014-09-08 08:06:18 +00:00
Guillaume Pinot
13013d8f91 Relicense shootout-chameneos-redux.rs to the shootout license.
Everyone agreed. fix #17076
2014-09-08 08:47:26 +02:00
Nathan Typanski
a1d9010f51 Add ICE regression test with unboxed closures
This code used to produce the following ICE:

   error: internal compiler error: get_unique_type_id_of_type() -
   unexpected type: closure,
   ty_unboxed_closure(syntax::ast::DefId{krate: 0u32, node: 66u32},
   ReScope(63u32))

This is a regression test for issue #17021.
2014-09-07 23:45:27 -04:00
bors
dd626b48c4 auto merge of #16933 : nick29581/rust/dst-rvalue, r=nikomatsakis
Closes #16813 

r? @nikomatsakis I feel like I should be checking more things in check_rvalues, but not sure what - I don't properly understand expr_use_visitor
2014-09-08 02:36:15 +00:00
NODA, Kai
52e99cbcaa libnative/io: generic retry() for Unix 64 bit read/write().
Win32/WinSock APIs never call WSASetLastError() with WSAEINTR
unless a programmer specifically cancels the ongoing blocking call by
a deprecated WinSock1 API WSACancelBlockingCall().
So the errno check was simply removed and retry() became an id function
on Windows.
Note: Windows' equivalent of SIGINT is always handled in a separate thread:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682541%28v=vs.85%29.aspx
"CTRL+C and CTRL+BREAK Signals"

Also, incidentally rename a type parameter and clean up some module imports.
2014-09-08 08:17:13 +08:00
Alex Crichton
6c5c1ee34f rustdoc: Don't strip #-lines if notrust
Other languages may not want to have a leading #-line get stripped.
2014-09-07 17:01:16 -07:00
bors
aaf141d399 auto merge of #16942 : alexcrichton/rust/remove-net-assert, r=brson
This assert was likely inherited from some point, but it's not quite valid as a
no-timeout read may enter this loop, but data could be stolen by any other read
after the socket is deemed readable.

I saw this fail in a recent bors run where the assertion was tripped.
2014-09-07 23:01:34 +00:00
Dan Albert
8c3db5bc53 Allow Rust to be built with LLVM trunk (3.6). 2014-09-07 14:42:48 -07:00
Nick Cameron
742f49c961 Forbid unsized rvalues
Closes #16813
2014-09-08 09:32:52 +12:00
bors
19dc574890 auto merge of #17035 : huonw/rust/moar-jquery, r=alexcrichton
Sometimes (e.g. on Rust CI) the "expand description" text of the
collapse toggle was displayed by default, when a page is first
loaded (even though the description is expanded), because some
Content-Security-Policy settings disable inline CSS.

Setting it the style with the `.css` method allows the output to be used
in more places.
2014-09-07 21:06:29 +00:00
Jakub Wieczorek
c98a80e472 Fix casts in constant expressions
Fixes #17074.
2014-09-07 21:24:18 +02:00
bors
86730e43c0 auto merge of #16904 : inrustwetrust/rust/link-path-order, r=alexcrichton
Issue can be reproduced by the following:
```
$ cat main.rs
fn main() {}
$ rustc -Z print-link-args -Lfoo -Lbar main.rs
```
Run the rustc command a few times and observe that the order of the '-L' 'foo' '-L' 'bar' options randomly changes.

Actually hit this issue in practice on Windows when specifying two -L directories to rustc, one with rust-sdl2 in it and one with the C SDL2.dll. Since Windows file systems aren't case-sensitive, gcc randomly attempted to link against the rust sdl2.dll instead of SDL2.dll if that -L directory happened to come first.

The randomness was due to addl_lib_search_paths being a HashSet. Changed it to a Vec instead which maintains the ordering.
Unsure how to test this though since it is random by nature; suggestions very welcome.
2014-09-07 19:06:28 +00:00
Daniel Micay
1ee099da36 enable jemalloc debugging in unoptimized builds
The performance hit from these checks is significant, but unoptimized
builds are already incredibly slow. Enabling these checks results in
better test coverage since there are bots doing unoptimized builds, and
the cost is relatively small in the context of an unoptimized build.
This also allows using `JEMALLOC_FLAGS` to override the default
configure flags.
2014-09-07 14:23:48 -04:00
Jonas Hietala
248319a52e Flip arguments to std::iter::iterate.
Breaks `iterate(f, seed)`, use `iterate(seed, f)` instead.
The convention is to have the closure last.

Closes #17066.

[breaking-change]
2014-09-07 19:44:30 +02:00
Guillaume Pinot
4894c21759 Relicense shootout-nbody.rs to the shootout license
Everyone agreed. fix #17073
2014-09-07 19:16:55 +02:00
bors
d7502ac2d6 auto merge of #17015 : seb-m/rust/fix-extern-crate-as, r=sfackler
Its arguments were inverted.

For instance it displayed this message:

```
warning: this extern crate syntax is deprecated. Use: extern create "foobar" as foo;
```

Instead of:

```
warning: this extern crate syntax is deprecated. Use: extern create "foo" as foobar;
```
2014-09-07 16:21:29 +00:00
Guillaume Pinot
0b2e6f8087 Relicense shootout-reverse-complement.rs to the shootout license.
Everyone agreed.  Fix #17065
2014-09-07 18:09:01 +02:00
Sebastien Martini
8baff54128 Fix deprecate warning "extern crate ... as ..."
Its arguments were inverted.
2014-09-07 17:58:33 +02:00
bors
4067252def auto merge of #17034 : retep998/rust/glob-fix, r=alexcrichton
Fixes #15279
Based on #13338
2014-09-07 14:31:24 +00:00
bors
1242772cce auto merge of #17005 : bjz/rust/bit-count, r=thestinger
Fixes rust-lang/rfcs#224
2014-09-07 12:41:25 +00:00
Huon Wilson
524e1b20af Register snapshots.
Closes #16880.
2014-09-07 20:42:14 +10:00
inrustwetrust
e7a000e717 Added test for link path ordering 2014-09-07 11:42:02 +02:00
inrustwetrust
61414a9850 Changed addl_lib_search_paths from HashSet to Vec
This makes the extra library paths given to the gcc linker come in
the same order as the -L options on the rustc command line.
2014-09-07 11:42:02 +02:00
Steve Klabnik
a021330b1d Fix vector/array/slice terminology in manual.
Fixes #16015.
2014-09-07 05:28:59 -04:00
bors
ee72e46638 auto merge of #17032 : jamesluke/rust/master, r=alexcrichton
"extern create" -> "extern crate"
2014-09-07 09:26:27 +00:00
Nathan Typanski
fda2319068 Add regression test for issue #10766
This test verifies that casting from the same lifetime on a value
to the same lifetime on a trait succeeds. Closes #10766.
2014-09-07 03:59:02 -04:00
Nathan Typanski
d80729a8e4 Add ICE regression test for issue #16218.
This code used to produce an ICE on the definition of trait Bar
with the following message:

Type parameter out of range when substituting in region 'a (root
type=fn(Self) -> 'astr) (space=FnSpace, index=0)

Closes #16218.
2014-09-07 03:58:35 -04:00
bors
57781c3c30 auto merge of #17019 : steveklabnik/rust/remove_compromise, r=thestinger
@dherman doesn't like it 😄
2014-09-07 07:16:27 +00:00
bors
c964cb229b auto merge of #17018 : steveklabnik/rust/fix_projects_in_guide, r=huonw
Thanks @dherman.
2014-09-07 05:31:25 +00:00
bors
d52d0c8364 auto merge of #17016 : steveklabnik/rust/fix_diagnostic_codes, r=huonw
Fixes #16449.
2014-09-07 03:36:27 +00:00
bors
09cebc25a3 auto merge of #16999 : brson/rust/fannkuch, r=alexcrichton
From the discussion on reddit:
http://www.reddit.com/r/rust/comments/2fenlg/benchmark_improvement_fannkuchredux/

This adds two variants: the primary, that uses an unsafe block, and a secondary
that is completely safe.

The one with the unsafe block matches clang's performance and beats gcc's.
2014-09-07 00:31:28 +00:00
Daniel Micay
c6633fde53 mark win32 binaries as large address aware
By default, 32-bit Windows executables are restricted to 2GiB of address
space even when running on 64-bit Windows when 4GiB is available.

Closes #17043
2014-09-06 17:54:52 -04:00
bors
38eb0e5514 auto merge of #17012 : thestinger/rust/sized, r=nikomatsakis 2014-09-06 21:46:25 +00:00
Daniel Micay
c76e3caf10 fix sized deallocation for TypedArena<T> 2014-09-06 13:58:34 -04:00
Daniel Micay
2fdad65a05 fix sized deallocation for OwnedSlice 2014-09-06 13:58:34 -04:00
Daniel Micay
d1bd139251 fix sized deallocation for Box<[T]> 2014-09-06 13:58:30 -04:00
bors
d8a26184dc auto merge of #17011 : nodakai/rust/rustdoc-stronger-crate, r=alexcrichton
If you browse to, say, http://doc.rust-lang.org/libc/types/os/common/posix01/struct.timeval.html , you will see the "location" window showing `libc::types::os::common::posix01`.  The first element points to a crate and others point modules.  This patch adds the bold attribute to the first (ie. crate) element so that it stands out more.
2014-09-06 17:51:24 +00:00
Daniel Micay
5aa2da0133 fix sized deallocation for proc 2014-09-06 13:50:58 -04:00
Daniel Micay
395e453c06 fix a sized deallocation issue in the glue code 2014-09-06 13:50:58 -04:00