]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoMove some #[no_std] info to stable book.
Steve Klabnik [Thu, 14 Jan 2016 15:45:40 +0000 (10:45 -0500)]
Move some #[no_std] info to stable book.

This feature is partially stabilized, so describe each part in the appropriate place.

8 years agoAuto merge of #30883 - Manishearth:rollup, r=Manishearth
bors [Thu, 14 Jan 2016 06:45:26 +0000 (06:45 +0000)]
Auto merge of #30883 - Manishearth:rollup, r=Manishearth

- Successful merges: #30626, #30662, #30770, #30801, #30818, #30823, #30828, #30835, #30837, #30839, #30845, #30848, #30850, #30851, #30863
- Failed merges:

8 years agoRollup merge of #30863 - jseyfried:no_rc, r=eddyb
Manish Goregaokar [Wed, 13 Jan 2016 22:52:20 +0000 (04:22 +0530)]
Rollup merge of #30863 - jseyfried:no_rc, r=eddyb

Use arena allocation instead of reference counting for `Module`s to fix memory leaks from `Rc` cycles.

A module references its module children and its import resolutions, and an import resolution references the module defining the imported name, so there is a cycle whenever a module imports something from an ancestor module.

For example,
```rust
mod foo { // `foo` references `bar`.
    fn baz() {}
    mod bar { // `bar` references the import.
        use foo::baz; // The import references `foo`.
    }
}
```

8 years agoRollup merge of #30851 - jonas-schievink:unneeded-dropflags, r=pnkfelix
Manish Goregaokar [Wed, 13 Jan 2016 22:52:20 +0000 (04:22 +0530)]
Rollup merge of #30851 - jonas-schievink:unneeded-dropflags, r=pnkfelix

Apparently we allocate and maintain non-working dropflag hints since June... In anticipation of a working implementation of on-stack drop flag hints, let's not spend even more time on types that don't even need to be dropped.

```rust
fn main() {
    let (i,j,k,l) = (0,0,0,0);
}
```
used to translate to (unoptimized only, of course):
```llvm
define internal void @_ZN4main20ha8deb085c47920d8eaaE() unnamed_addr #0 {
entry-block:
  %dropflag_hint_10 = alloca i8
  %dropflag_hint_11 = alloca i8
  %dropflag_hint_12 = alloca i8
  %dropflag_hint_13 = alloca i8
  %const = alloca { i32, i32, i32, i32 }
  %i = alloca i32
  %j = alloca i32
  %k = alloca i32
  %l = alloca i32
  store i8 61, i8* %dropflag_hint_10
  store i8 61, i8* %dropflag_hint_11
  store i8 61, i8* %dropflag_hint_12
  store i8 61, i8* %dropflag_hint_13
  %0 = bitcast { i32, i32, i32, i32 }* %const to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ({ i32, i32, i32, i32 }* @const2752 to i8*), i64 16, i32 4, i1 false)
  %1 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 0
  %2 = load i32, i32* %1, align 4
  store i32 %2, i32* %i, align 4
  %3 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 1
  %4 = load i32, i32* %3, align 4
  store i32 %4, i32* %j, align 4
  %5 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 2
  %6 = load i32, i32* %5, align 4
  store i32 %6, i32* %k, align 4
  %7 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 3
  %8 = load i32, i32* %7, align 4
  store i32 %8, i32* %l, align 4
  ret void
}
```

Now it gives:
```llvm
define internal void @_ZN4main20ha8deb085c47920d8eaaE() unnamed_addr #0 {
entry-block:
  %const = alloca { i32, i32, i32, i32 }
  %i = alloca i32
  %j = alloca i32
  %k = alloca i32
  %l = alloca i32
  %0 = bitcast { i32, i32, i32, i32 }* %const to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast ({ i32, i32, i32, i32 }* @const2748 to i8*), i64 16, i32 4, i1 false)
  %1 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 0
  %2 = load i32, i32* %1, align 4
  store i32 %2, i32* %i, align 4
  %3 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 1
  %4 = load i32, i32* %3, align 4
  store i32 %4, i32* %j, align 4
  %5 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 2
  %6 = load i32, i32* %5, align 4
  store i32 %6, i32* %k, align 4
  %7 = getelementptr inbounds { i32, i32, i32, i32 }, { i32, i32, i32, i32 }* %const, i32 0, i32 3
  %8 = load i32, i32* %7, align 4
  store i32 %8, i32* %l, align 4
  ret void
}
```

Let's hope I didn't break anything!

8 years agoRollup merge of #30850 - ranma42:cleanup-io, r=alexcrichton
Manish Goregaokar [Wed, 13 Jan 2016 22:52:20 +0000 (04:22 +0530)]
Rollup merge of #30850 - ranma42:cleanup-io, r=alexcrichton

In 8d90d3f36871a00023cc1f313f91e351c287ca15 `BufStream`, the only
consumer of `InternalBufWriter`, was removed. As implied by the name,
this type is private, hence it is currently dead code.

8 years agoRollup merge of #30839 - tomaka:debug-phantomdata, r=nikomatsakis
Manish Goregaokar [Wed, 13 Jan 2016 22:52:20 +0000 (04:22 +0530)]
Rollup merge of #30839 - tomaka:debug-phantomdata, r=nikomatsakis

All the trait implementations of `PhantomData` use `impl<T: ?Sized>` except for `Debug`
https://doc.rust-lang.org/nightly/std/marker/struct.PhantomData.html#implementations

This PR fixes this.

8 years agoRollup merge of #30837 - semarie:openbsd-libc, r=alexcrichton
Manish Goregaokar [Wed, 13 Jan 2016 22:52:19 +0000 (04:22 +0530)]
Rollup merge of #30837 - semarie:openbsd-libc, r=alexcrichton

The following PR updates libc version to latest commits for correctly support openbsd.
It corrects several points in rustc to be compatible with libc changes.

r? @alexcrichton

8 years agoRollup merge of #30835 - kraai:show-span, r=sanxiyn
Manish Goregaokar [Wed, 13 Jan 2016 22:52:19 +0000 (04:22 +0530)]
Rollup merge of #30835 - kraai:show-span, r=sanxiyn

I think this will fix #30656.

8 years agoRollup merge of #30828 - wheals:fix-dead-links, r=steveklabnik
Manish Goregaokar [Wed, 13 Jan 2016 22:52:19 +0000 (04:22 +0530)]
Rollup merge of #30828 - wheals:fix-dead-links, r=steveklabnik

See [the intrinsics page](https://doc.rust-lang.org/nightly/core/intrinsics/index.html) for example.

8 years agoRollup merge of #30823 - pnkfelix:put-back-alloca-zeroing-for-issue-30530, r=dotdash
Manish Goregaokar [Wed, 13 Jan 2016 22:52:19 +0000 (04:22 +0530)]
Rollup merge of #30823 - pnkfelix:put-back-alloca-zeroing-for-issue-30530, r=dotdash

Put back alloca zeroing for issues #29092, #30018, #30530; inject zeroing for #30822.

----

Background context: `fn alloca_zeroed` was removed in PR #22969, so we haven't been "zero'ing" (\*) the alloca's since at least that point, but the logic behind that PR seems sound, so its not entirely obvious how *long* the underlying bug has actually been present.  In other words, I have not yet done a survey to see when the new `alloc_ty` and `lvalue_scratch_datum` calls were introduced that should have had "zero'ing" the alloca's.

----

I first fixed #30018, then decided to do a survey of `alloc_ty` calls to see if they needed similar treatment, which quickly led to a rediscovery of #30530.

While making the regression test for the latter, I discovered #30822, which is a slightly different bug (in terms of where the "zero'ing" needs to go), but still relevant.

I haven't finished the aforementioned survey of `fn alloc_ty` calls, but I decided I wanted to get this up for review in its current state (namely to see if my attempt to force developers to include a justification for passing `Uninit` can possibly fly, or if I should abandon that path of action).

----

(*): I am putting quotation marks around "zero'ing" because we no longer use zero as our "dropped" marker value.

Fix #29092
Fix #30018
Fix #30530
Fix #30822

8 years agoRollup merge of #30818 - sfackler:duration-hash, r=alexcrichton
Manish Goregaokar [Wed, 13 Jan 2016 22:52:19 +0000 (04:22 +0530)]
Rollup merge of #30818 - sfackler:duration-hash, r=alexcrichton

tikue pointed out in IRC that this was missing.

8 years agoRollup merge of #30801 - Amanieu:oom_print, r=alexcrichton
Manish Goregaokar [Wed, 13 Jan 2016 22:52:18 +0000 (04:22 +0530)]
Rollup merge of #30801 - Amanieu:oom_print, r=alexcrichton

This adds the ability to override the default OOM behavior by setting a handler function. This is used by libstd to print a message when running out of memory instead of crashing with an obscure "illegal hardware instruction" error (at least on Linux).

Fixes #14674

8 years agoRollup merge of #30770 - steveklabnik:gh30345, r=brson
Manish Goregaokar [Wed, 13 Jan 2016 22:52:18 +0000 (04:22 +0530)]
Rollup merge of #30770 - steveklabnik:gh30345, r=brson

Fixes #30345

I'm not sure if there's anything else that belongs here. Thoughts?

8 years agoRollup merge of #30626 - steveklabnik:gh30618, r=luqmana
Manish Goregaokar [Wed, 13 Jan 2016 22:52:18 +0000 (04:22 +0530)]
Rollup merge of #30626 - steveklabnik:gh30618, r=luqmana

Fixes #30618

8 years agoAuto merge of #30662 - simartin:issue_30592, r=alexcrichton
bors [Thu, 14 Jan 2016 03:17:51 +0000 (03:17 +0000)]
Auto merge of #30662 - simartin:issue_30592, r=alexcrichton

Fixes https://github.com/rust-lang/rust/issues/30592, a fallout of https://github.com/rust-lang/rust/commit/cd1848a1a60f40f25019e455b1050efd69707604

8 years agoAuto merge of #30466 - alexcrichton:move-wrapping-and-fill-out, r=aturon
bors [Thu, 14 Jan 2016 01:26:54 +0000 (01:26 +0000)]
Auto merge of #30466 - alexcrichton:move-wrapping-and-fill-out, r=aturon

This commit migrates all of the methods on `num::wrapping::OverflowingOps` onto
inherent methods of the integer types. This also fills out some missing gaps in
the saturating and checked departments such as:

* `saturating_mul`
* `checked_{neg,rem,shl,shr}`

This is done in preparation for stabilization,

cc #27755

8 years agoAuto merge of #30870 - Eljay:issue-30477, r=alexcrichton
bors [Wed, 13 Jan 2016 22:27:46 +0000 (22:27 +0000)]
Auto merge of #30870 - Eljay:issue-30477, r=alexcrichton

Fixes #30477, #30213.

The loop over reexports used to be a closure before #30043 but it's an iterator now so it should just continue instead of exiting the loop and skipping stuff.

r? @brson

8 years agoAdd missing newline character to callers of dumb_print
Amanieu d'Antras [Sat, 9 Jan 2016 19:19:56 +0000 (19:19 +0000)]
Add missing newline character to callers of dumb_print

8 years agoAuto merge of #30813 - fhahn:fix-ice-semicolon-in-lifetime, r=nrc
bors [Wed, 13 Jan 2016 20:38:12 +0000 (20:38 +0000)]
Auto merge of #30813 - fhahn:fix-ice-semicolon-in-lifetime, r=nrc

This PR fixes an ICE due to an DiagnosticsBuilder not being canceld or emitted.

Ideally it would use `Handler::cancel`, but I did not manage to get a `&mut` reference to the diagnostics handler.

8 years agoIssue #30592: Restore build in --disable-jemalloc mode.
Simon Martin [Thu, 31 Dec 2015 17:13:39 +0000 (18:13 +0100)]
Issue #30592: Restore build in --disable-jemalloc mode.

8 years agoAuto merge of #30509 - michaelsproul:string-box-error, r=alexcrichton
bors [Wed, 13 Jan 2016 18:46:29 +0000 (18:46 +0000)]
Auto merge of #30509 - michaelsproul:string-box-error, r=alexcrichton

Closes #30156.

8 years agoAuto merge of #30794 - joerg-krause:fix-arm-unknown-linux-gnueabi-float-abi, r=alexcr...
bors [Wed, 13 Jan 2016 16:57:01 +0000 (16:57 +0000)]
Auto merge of #30794 - joerg-krause:fix-arm-unknown-linux-gnueabi-float-abi, r=alexcrichton

gnueabi indicates soft whereas gnueabihf indicates hard floating-point ABI.

8 years agoAuto merge of #30779 - michaelwoerister:closure-mir-in-metadata, r=nikomatsakis
bors [Wed, 13 Jan 2016 15:08:07 +0000 (15:08 +0000)]
Auto merge of #30779 - michaelwoerister:closure-mir-in-metadata, r=nikomatsakis

8 years agoadd doc for new `fn alloc_ty_init`.
Felix S. Klock II [Tue, 12 Jan 2016 16:24:00 +0000 (17:24 +0100)]
add doc for new `fn alloc_ty_init`.

(Note that it might be a good idea to replace *all* calls of
`alloc_ty` with calls to `alloc_ty_init`, to encourage programmers to
consider the appropriate value for the `init` flag when creating
temporary values.)

8 years agorevise lifetime handling for alloca's that are initialized as "dropped."
Felix S. Klock II [Tue, 12 Jan 2016 16:21:11 +0000 (17:21 +0100)]
revise lifetime handling for alloca's that are initialized as "dropped."

(This can/should be revisited when drop flags are stored out of band.)

8 years agoFactored out private routine for emitting LLVM lifetime intrinsic calls.
Felix S. Klock II [Tue, 12 Jan 2016 16:17:50 +0000 (17:17 +0100)]
Factored out private routine for emitting LLVM lifetime intrinsic calls.

(The reason this is not factored as far as possible because a
subsequent commit is going to need to do construction without having
access to a `cx`.)

8 years agoUnit/regression tests for issues #29092, #30018, #30530, #30822.
Felix S. Klock II [Mon, 11 Jan 2016 17:32:28 +0000 (18:32 +0100)]
Unit/regression tests for issues #29092, #30018, #30530, #30822.

Note that the test for #30822 is folded into the test for #30530 (but
the file name mentions only 30530).

8 years agobug fixes for issues 30018 and 30822.
Felix S. Klock II [Mon, 11 Jan 2016 17:23:22 +0000 (18:23 +0100)]
bug fixes for issues 30018 and 30822.

includes bugfixes pointed out during review:

 * Only `call_lifetime_start` for an alloca if the function entry does
   not itself initialize it to "dropped."

 * Remove `schedule_lifetime_end` after writing an *element* into a
   borrowed slice. (As explained by [dotdash][irc], "the lifetime end
   that is being removed was for an element in the slice, which is not
   an alloca of its own and has no lifetime start of its own")

[irc]: https://botbot.me/mozilla/rust-internals/2016-01-13/?msg=57844504&page=3

8 years agoFix rustdoc reexports.
Lee Jeffery [Wed, 13 Jan 2016 13:01:14 +0000 (13:01 +0000)]
Fix rustdoc reexports.

8 years agoAuto merge of #30684 - tshepang:rustfmt-lexer-part2, r=nrc
bors [Wed, 13 Jan 2016 12:22:51 +0000 (12:22 +0000)]
Auto merge of #30684 - tshepang:rustfmt-lexer-part2, r=nrc

8 years agoAuto merge of #29498 - wthrowe:replace-pattern, r=alexcrichton
bors [Wed, 13 Jan 2016 08:15:45 +0000 (08:15 +0000)]
Auto merge of #29498 - wthrowe:replace-pattern, r=alexcrichton

It appears this was left out of RFC rust-lang/rfcs#528 because it might be useful to
also generalize the second argument in some way.  That doesn't seem to
prevent generalizing the first argument now, however.

This is a [breaking-change] because it could cause type-inference to
fail where it previously succeeded.

Also update docs for a few other methods that still referred to `&str` instead of patterns.

8 years agoAuto merge of #30639 - rkruppe:dec2flt-fastpath-tables, r=alexcrichton
bors [Wed, 13 Jan 2016 02:05:02 +0000 (02:05 +0000)]
Auto merge of #30639 - rkruppe:dec2flt-fastpath-tables, r=alexcrichton

Add tables of small powers of ten used in the fast path. The tables are redundant: We could also use the big, more accurate table and round the value to the correct type (in fact we did just that before this commit). However, the rounding is extra work and slows down the fast path.

Because only very small exponents enter the fast path, the table and thus the space overhead is negligible. Speed-wise, this is a clear win on a [benchmark] comparing the fast path to a naive, hand-optimized, inaccurate algorithm. Specifically, this change narrows the gap from a roughly 5x difference to a roughly 3.4x difference.

[benchmark]: https://gist.github.com/Veedrac/dbb0c07994bc7882098e

8 years agoresolve: use arena allocation instead of reference counting for `Module`s to fix...
Jeffrey Seyfried [Mon, 11 Jan 2016 21:19:29 +0000 (21:19 +0000)]
resolve: use arena allocation instead of reference counting for `Module`s to fix memory leaks from Rc cycles

8 years agoAdd an impl for Box<Error> from &str.
Michael Sproul [Tue, 12 Jan 2016 23:38:25 +0000 (10:38 +1100)]
Add an impl for Box<Error> from &str.

8 years agoAuto merge of #30601 - tamird:delegate-libc, r=alexcrichton
bors [Tue, 12 Jan 2016 22:49:02 +0000 (22:49 +0000)]
Auto merge of #30601 - tamird:delegate-libc, r=alexcrichton

See: http://developer.android.com/ndk/downloads/revision_history.html

Also, use `libc`'s `posix_memalign`.

8 years agoSpeed up dec2flt fast path with additional tables.
Robin Kruppe [Wed, 30 Dec 2015 13:01:42 +0000 (14:01 +0100)]
Speed up dec2flt fast path with additional tables.

Add tables of small powers of ten used in the fast path. The tables are redundant: We could also use the big, more accurate table and round the value to the correct type (in fact we did just that before this commit). However, the rounding is extra work and slows down the fast path.

Because only very small exponents enter the fast path, the table and thus the space overhead is negligible. Speed-wise, this is a clear win on a [benchmark] comparing the fast path to a naive, hand-optimized, inaccurate algorithm. Specifically, this change narrows the gap from a roughly 5x difference to a roughly 3.4x difference.

[benchmark]: https://gist.github.com/Veedrac/dbb0c07994bc7882098e

8 years agoandroid has `posix_memalign` for API 16+ since NDK r10d
Tamir Duberstein [Tue, 29 Dec 2015 01:04:20 +0000 (20:04 -0500)]
android has `posix_memalign` for API 16+ since NDK r10d

See: http://developer.android.com/ndk/downloads/revision_history.html

Also, use `libc`'s `posix_memalign`.

8 years agoAdd some examples to std::string
Steve Klabnik [Thu, 7 Jan 2016 19:54:17 +0000 (14:54 -0500)]
Add some examples to std::string

Fixes #30345

8 years agore-instate comment that was mysteriously disappeared
Tshepang Lekhonkhobe [Tue, 12 Jan 2016 18:52:22 +0000 (20:52 +0200)]
re-instate comment that was mysteriously disappeared

8 years agoRemove dead `InternalBufWriter` implementation
Andrea Canciani [Tue, 12 Jan 2016 10:58:52 +0000 (11:58 +0100)]
Remove dead `InternalBufWriter` implementation

In 8d90d3f36871a00023cc1f313f91e351c287ca15 `BufStream`, the only
consumer of `InternalBufWriter`, was removed. As implied by the name,
this type is private, hence it is currently dead code.

8 years agoDon't use dropflag hints when the type is dropless
Jonas Schievink [Tue, 12 Jan 2016 17:04:21 +0000 (18:04 +0100)]
Don't use dropflag hints when the type is dropless

8 years agoAuto merge of #30719 - pyfisch:fix30657, r=alexcrichton
bors [Tue, 12 Jan 2016 16:30:20 +0000 (16:30 +0000)]
Auto merge of #30719 - pyfisch:fix30657, r=alexcrichton

8 years agodebug instrumentation (can remove)
Felix S. Klock II [Fri, 8 Jan 2016 19:40:13 +0000 (20:40 +0100)]
debug instrumentation (can remove)

8 years agoIssue 30530: initialize allocas for `Datum::to_lvalue_datum_in_scope`.
Felix S. Klock II [Fri, 8 Jan 2016 19:40:52 +0000 (20:40 +0100)]
Issue 30530: initialize allocas for `Datum::to_lvalue_datum_in_scope`.

In particular, bring back the `zero` flag for `lvalue_scratch_datum`,
which controls whether the alloca's created immediately at function
start are uninitialized at that point or have their embedded
drop-flags initialized to "dropped".

Then made `to_lvalue_datum_in_scope` pass "dropped" as `zero` flag.

8 years agoFix the Debug impl of PhantomData requiring Sized on T
Pierre Krieger [Tue, 12 Jan 2016 10:23:18 +0000 (11:23 +0100)]
Fix the Debug impl of PhantomData requiring Sized on T

8 years agoAuto merge of #30695 - ranma42:cleanup-unicode, r=alexcrichton
bors [Tue, 12 Jan 2016 10:18:53 +0000 (10:18 +0000)]
Auto merge of #30695 - ranma42:cleanup-unicode, r=alexcrichton

and the associated update of tables.rs

The last commit is related to my comment to #29734.

8 years agoAuto merge of #30678 - Amanieu:no_elf_tls, r=alexcrichton
bors [Tue, 12 Jan 2016 08:30:56 +0000 (08:30 +0000)]
Auto merge of #30678 - Amanieu:no_elf_tls, r=alexcrichton

I also re-enabled the use of `#[thread_local]` on AArch64. It was originally disabled in the PR that introduced AArch64 (#19790), but the reasons for this were not explained. `#[thread_local]` seems to work fine in my tests on AArch64, so I don't think this should be an issue.

cc @alexcrichton @akiss77

8 years agoopenbsd has dirent d_namlen field now
Sébastien Marie [Wed, 23 Dec 2015 17:56:42 +0000 (18:56 +0100)]
openbsd has dirent d_namlen field now

8 years agomake siginfo_si_addr() returns a usize
Sébastien Marie [Wed, 23 Dec 2015 10:32:02 +0000 (11:32 +0100)]
make siginfo_si_addr() returns a usize

`siginfo_si_addr()` function is used once, and the returned value is
casted to `usize`. So make the function returns a `usize`.

it simplifies OpenBSD case, where the return type wouldn't be a `*mut
libc::c_void` but a `*mut libc::c_char`.

8 years agoHW_AVAILCPU is unavailable under openbsd
Sébastien Marie [Wed, 23 Dec 2015 10:28:24 +0000 (11:28 +0100)]
HW_AVAILCPU is unavailable under openbsd

define `num_cpus()` function for openbsd that use `HW_NCPU` for grabbing
the current number of cpus that could be used.

8 years agoswitch from syscall(2) to getentropy(2)
Sébastien Marie [Wed, 23 Dec 2015 10:24:11 +0000 (11:24 +0100)]
switch from syscall(2) to getentropy(2)

use the `getentropy()` function instead of `syscall()` and
syscall-numbers.

8 years agostd: Move overflowing ops to inherent methods
Alex Crichton [Fri, 18 Dec 2015 18:24:06 +0000 (10:24 -0800)]
std: Move overflowing ops to inherent methods

This commit migrates all of the methods on `num::wrapping::OverflowingOps` onto
inherent methods of the integer types. This also fills out some missing gaps in
the saturating and checked departments such as:

* `saturating_mul`
* `checked_{neg,rem,shl,shr}`

This is done in preparation for stabilization,

cc #27755

8 years agoAuto merge of #30635 - nagisa:mir-rid-unit-temp, r=nikomatsakis
bors [Tue, 12 Jan 2016 05:20:23 +0000 (05:20 +0000)]
Auto merge of #30635 - nagisa:mir-rid-unit-temp, r=nikomatsakis

Get rid of that nasty unit_ty temporary variable created just because it might be handy to have one around, when in reality it isn’t really that useful at all.

r? @nikomatsakis

Fixes https://github.com/rust-lang/rust/issues/30637

8 years agoReplace --show-span with -Z show-span
Matt Kraai [Tue, 12 Jan 2016 04:44:24 +0000 (20:44 -0800)]
Replace --show-span with -Z show-span

8 years agoAuto merge of #30599 - brson:extra, r=alexcrichton
bors [Tue, 12 Jan 2016 03:00:00 +0000 (03:00 +0000)]
Auto merge of #30599 - brson:extra, r=alexcrichton

This mixes in additional information into the hash that is
passed to -C extra-filename. It can be used to further distinguish
the standard libraries if they must be installed next to each
other.

Closes #29559

Frankly, I'm not sure if this solves a real problem. It's meant to help with side-by-side and overlapping installations where there are two sets of libs in /usr, but there are other potential issues there as well, including that some of our artifacts don't use this extra-filename munging, and it's not something our installers can support at all.

cc @jauhien Do you still think this helps the Gentoo case?

8 years agoAdd set_oom_handler and use it print a message when out of memory
Amanieu d'Antras [Sat, 9 Jan 2016 18:20:33 +0000 (18:20 +0000)]
Add set_oom_handler and use it print a message when out of memory

8 years agoAuto merge of #30826 - nagisa:rollup, r=nagisa
bors [Mon, 11 Jan 2016 20:59:15 +0000 (20:59 +0000)]
Auto merge of #30826 - nagisa:rollup, r=nagisa

- Successful merges: #30538, #30687, #30694, #30737, #30761, #30768, #30774, #30798, #30808, #30812, #30814
- Failed merges:

8 years agorustdoc: remove dead link from issue-less unstable entries.
Shmuale Mark [Mon, 11 Jan 2016 19:38:40 +0000 (14:38 -0500)]
rustdoc: remove dead link from issue-less unstable entries.

8 years agoRollup merge of #30814 - brson:docidx, r=steveklabnik
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:54 +0000 (21:17 +0200)]
Rollup merge of #30814 - brson:docidx, r=steveklabnik

These are the same descriptions as on the website.

re https://www.reddit.com/r/rust/comments/409nlo/i_just_noticed_the_docs_nightly_all_docs_got_more/cytc4ab

r? @steveklabnik

8 years agoRollup merge of #30812 - D101101:patch-2, r=steveklabnik
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30812 - D101101:patch-2, r=steveklabnik

r? @steveklabnik

8 years agoRollup merge of #30808 - GuillaumeGomez:remove_lang_iter, r=alexcrichton
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30808 - GuillaumeGomez:remove_lang_iter, r=alexcrichton

Fixes #30803

r? @nagisa

8 years agoRollup merge of #30798 - erickt:fix-doc, r=apasel422
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30798 - erickt:fix-doc, r=apasel422

8 years agoRollup merge of #30774 - nagisa:mir-fix-constval-adts, r=arielb1
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30774 - nagisa:mir-fix-constval-adts, r=arielb1

Fixes #30772

We used to have a untested special case which didn’t really work anyway, because of lacking casts. This PR removes the case in question.

8 years agoRollup merge of #30768 - steveklabnik:gh28953, r=alexcrichton
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:53 +0000 (21:17 +0200)]
Rollup merge of #30768 - steveklabnik:gh28953, r=alexcrichton

Fixes #28953

8 years agoRollup merge of #30761 - nagisa:mir-fix-destination, r=michaelwoerister
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30761 - nagisa:mir-fix-destination, r=michaelwoerister

Previously it was returning a clone, mostly for the two reasons:

* Cloning Lvalue is very cheap most of the time (i.e. when Lvalue is not a Projection);
* There’s users who want &mut lvalue and there’s users who want &lvalue. Returning a value allows
  to make either one easier when pattern matching (i.e. Some(ref dest) or Some(ref mut dest)).

However, I’m now convinced this is an invalid approach. Namely the users which want a mutable
reference may modify the Lvalue in-place, but the changes won’t be reflected in the final MIR,
since the Lvalue modified is merely a clone.

Instead, we have two accessors `destination` and `destination_mut` which return a reference to the
destination in desired mode.

r? @nikomatsakis

8 years agoRollup merge of #30737 - Ms2ger:MutateMode, r=sanxiyn
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30737 - Ms2ger:MutateMode, r=sanxiyn

8 years agoRollup merge of #30694 - pnkfelix:issue-25658-real-first-follow, r=nrc
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30694 - pnkfelix:issue-25658-real-first-follow, r=nrc

Proper first and follow sets for macro_rules future proofing

implements first stage of RFC amendment 1384; see #30450

8 years agoRollup merge of #30687 - mmcco:lbt, r=eddyb
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30687 - mmcco:lbt, r=eddyb

These should probably be submitted upstream. They're inevitably going to
complicate merges, and because they're non-functional changes this just
isn't worth our time.

8 years agoRollup merge of #30538 - oli-obk:kill_unsigned_unary_negation, r=pnkfelix
Simonas Kazlauskas [Mon, 11 Jan 2016 19:17:52 +0000 (21:17 +0200)]
Rollup merge of #30538 - oli-obk:kill_unsigned_unary_negation, r=pnkfelix

fixes  #29645

8 years agoAuto merge of #30534 - bluss:binary-heap-fast-pop, r=Gankro
bors [Mon, 11 Jan 2016 19:03:18 +0000 (19:03 +0000)]
Auto merge of #30534 - bluss:binary-heap-fast-pop, r=Gankro

BinaryHeap: Use full sift down in .pop()

.sift_down can either choose to compare the element on the way down (and
place it during descent), or to sift down an element fully, then sift
back up to place it.

A previous PR changed .sift_down() to the former behavior, which is much
faster for relatively small heaps and for elements that are cheap to
compare.

A benchmarking run suggested that BinaryHeap::pop() suffers
improportionally from this, and that it should use the second strategy
instead. It's logical since .pop() brings last element from the
heapified vector into index 0, it's very likely that this element will
end up at the bottom again.

Closes #29969
Previous PR #29811

8 years agoAuto merge of #30800 - steveklabnik:rollup, r=steveklabnik
bors [Mon, 11 Jan 2016 17:15:27 +0000 (17:15 +0000)]
Auto merge of #30800 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #30766, #30771, #30789
- Failed merges:

8 years agoAuto merge of #30676 - nikomatsakis:issue-29857, r=arielb1
bors [Mon, 11 Jan 2016 15:26:57 +0000 (15:26 +0000)]
Auto merge of #30676 - nikomatsakis:issue-29857, r=arielb1

This is an alternative to https://github.com/rust-lang/rust/pull/29954 for fixing #29857 that seems to me to be more inline with the general strategy around `TyError`. It also includes the fix for #30589 -- in fact, just the minimal change of making `ty_is_local` tolerate `TyError` avoids the ICE, but you get a lot of duplicate error reports, so in the case where the impl's trait reference already includes `TyError`, we just ignore the impl altogether.

cc @arielb1 @sanxiyn

Fixes #29857.
Fixes #30589.

8 years agoAuto merge of #30753 - pnkfelix:downgrade-29383-struct-warnings-to-errors, r=nikomatsakis
bors [Mon, 11 Jan 2016 13:39:06 +0000 (13:39 +0000)]
Auto merge of #30753 - pnkfelix:downgrade-29383-struct-warnings-to-errors, r=nikomatsakis

Downgrade unit struct match via S(..) warnings to errors

The error signalling was introduced in #29383

It was noted as a warning-cycle-less regression in #30379

Fix #30379

8 years ago[breaking-change] remove negate_unsigned feature gate
Oliver Schneider [Mon, 11 Jan 2016 11:31:46 +0000 (12:31 +0100)]
[breaking-change] remove negate_unsigned feature gate

8 years agoReplace no_elf_tls with target_thread_local
Amanieu d'Antras [Sat, 2 Jan 2016 22:50:50 +0000 (22:50 +0000)]
Replace no_elf_tls with target_thread_local

8 years agoAuto merge of #30490 - ipetkov:unix-spawn, r=alexcrichton
bors [Mon, 11 Jan 2016 10:19:44 +0000 (10:19 +0000)]
Auto merge of #30490 - ipetkov:unix-spawn, r=alexcrichton

* If the requested descriptors to inherit are stdio descriptors there
  are situations where they will not be set correctly
* Example: parent's stdout --> child's stderr
           parent's stderr --> child's stdout
* Solution: if the requested descriptors for the child are stdio
  descriptors, `dup` them before overwriting the child's stdio

Example of a program which exhibits the bug:
```rust
// stdio.rs
use std::io::Write;
use std::io::{stdout, stderr};
use std::process::{Command, Stdio};
use std::os::unix::io::FromRawFd;

fn main() {
    stdout().write_all("parent stdout\n".as_bytes()).unwrap();
    stderr().write_all("parent stderr\n".as_bytes()).unwrap();

    Command::new("sh")
        .arg("-c")
        .arg("echo 'child stdout'; echo 'child stderr' 1>&2")
        .stdin(Stdio::inherit())
        .stdout(unsafe { FromRawFd::from_raw_fd(2) })
        .stderr(unsafe { FromRawFd::from_raw_fd(1) })
        .status()
        .unwrap_or_else(|e| { panic!("failed to execute process: {}", e) });
}
```

Before:
```
$ rustc --version
rustc 1.7.0-nightly (8ad12c3e2 2015-12-19)
$ rustc stdio.rs && ./stdio >out 2>err
$ cat out
parent stdout
$ cat err
parent stderr
child stdout
child stderr
```

After (expected):
```
$ rustc --version
rustc 1.7.0-dev (712eccee2 2015-12-19)
$ rustc stdio.rs && ./stdio >out 2>err
$ cat out
parent stdout
child stderr
$ cat err
parent stderr
child stdout
```

8 years agoAuto merge of #27807 - pczarn:arena-internals, r=bluss
bors [Mon, 11 Jan 2016 08:32:46 +0000 (08:32 +0000)]
Auto merge of #27807 - pczarn:arena-internals, r=bluss

Fixes #18037 "TypedArena cannot handle zero-sized types".
Closes #17931 "improve chunk allocation scheme used by Arena / TypedArena".
Closes #22847 "TypedArena should implement Send". - N.B. Arena cannot implement Send, since it may contain non-Send values.
Closes #18471 "`Arena::alloc_copy_inner` (at least) should be renamed and made public." - Added `Arena::alloc_bytes`.
Closes #18261 "support clearing TypedArena with the chunks preserved". - Only the largest chunk is preserved.

8 years agoAuto merge of #30295 - jseyfried:fix_extern_crate_duplicate, r=nrc
bors [Mon, 11 Jan 2016 06:40:58 +0000 (06:40 +0000)]
Auto merge of #30295 - jseyfried:fix_extern_crate_duplicate, r=nrc

Fix a bug allowing an item and an external crate to collide so long as the external crate is declared after the item. For example,
```rust
mod core { pub fn f() {} } // This would be an error if it followed the `extern crate`
extern crate core; // This declaration is shadowed by the preceding module

fn main() { core::f(); }
```
This is a [breaking-change], but it looks unlikely to cause breakage in practice, and any breakage can be fixed by removing colliding `extern crate` declarations, which are shadowed and hence unused.

8 years agoDerive Hash for Duration
Steven Fackler [Mon, 11 Jan 2016 04:01:07 +0000 (20:01 -0800)]
Derive Hash for Duration

8 years agodoc: Add descriptions to links in the index
Brian Anderson [Sun, 10 Jan 2016 22:30:09 +0000 (22:30 +0000)]
doc: Add descriptions to links in the index

These are the same descriptions as on the website.

8 years agoCancel parse_ty error in Parser::parse_generic_values_after_lt
Florian Hahn [Sun, 10 Jan 2016 21:59:23 +0000 (22:59 +0100)]
Cancel parse_ty error in Parser::parse_generic_values_after_lt

8 years agoFix link in getting-started.md
Sergey Veselkov [Sun, 10 Jan 2016 21:13:54 +0000 (00:13 +0300)]
Fix link in getting-started.md

8 years agoRemove unneeded #[lang = "iterator"]
Guillaume Gomez [Sun, 10 Jan 2016 15:54:04 +0000 (16:54 +0100)]
Remove unneeded #[lang = "iterator"]

8 years agoRollup merge of #30789 - D101101:patch-1, r=steveklabnik
Steve Klabnik [Sat, 9 Jan 2016 19:04:20 +0000 (14:04 -0500)]
Rollup merge of #30789 - D101101:patch-1, r=steveklabnik

8 years agoRollup merge of #30771 - tsion:mir-text-terminator-fix, r=eddyb
Steve Klabnik [Sat, 9 Jan 2016 19:04:20 +0000 (14:04 -0500)]
Rollup merge of #30771 - tsion:mir-text-terminator-fix, r=eddyb

This just removes the `Some()` that appeared around terminators in MIR text output after https://github.com/rust-lang/rust/pull/30481 (cc @nagisa). The graphviz is already fixed.

r? @eddyb

8 years agoRollup merge of #30766 - steveklabnik:gh28810, r=steveklabnik
Steve Klabnik [Sat, 9 Jan 2016 19:04:20 +0000 (14:04 -0500)]
Rollup merge of #30766 - steveklabnik:gh28810, r=steveklabnik

Doing so is considered weaker writing. Thanks @Charlotteis!

Fixes #28810

8 years agoRemove many instances of 'just'
Steve Klabnik [Thu, 7 Jan 2016 19:05:00 +0000 (14:05 -0500)]
Remove many instances of 'just'

Doing so is considered weaker writing. Thanks @Charlotteis!

Fixes #28810

8 years agoFix a typo in rustc_mir::build::scope's documentation
Erick Tryzelaar [Sat, 9 Jan 2016 18:31:50 +0000 (10:31 -0800)]
Fix a typo in rustc_mir::build::scope's documentation

8 years agoFix arm-unknown-linux-gnueabi floating-point ABI
Jörg Krause [Sat, 9 Jan 2016 13:24:55 +0000 (14:24 +0100)]
Fix arm-unknown-linux-gnueabi floating-point ABI

gnueabi indicates soft whereas gnueabihf indicates hard floating-point ABI.

8 years agoRemove unused link from enums.md
Sergey Veselkov [Sat, 9 Jan 2016 09:17:44 +0000 (12:17 +0300)]
Remove unused link from enums.md

8 years agoMinor rebase corrections
Niko Matsakis [Sat, 9 Jan 2016 02:00:24 +0000 (21:00 -0500)]
Minor rebase corrections

8 years agopermit coercions if `[error]` is found in either type
Niko Matsakis [Sat, 9 Jan 2016 01:16:30 +0000 (20:16 -0500)]
permit coercions if `[error]` is found in either type

8 years agoimprove cast handling - this fixes test failures
Ariel Ben-Yehuda [Wed, 25 Nov 2015 16:17:16 +0000 (18:17 +0200)]
improve cast handling - this fixes test failures

the problem is that now "type_is_known_to_be_sized" now returns
false when called on a type with ty_err inside - this prevents
spurious errors (we may want to move the check to check::cast
anyway - see #12894).

8 years agoChange error scheme so that if projection fails we generate `A::B` instead of `TyError`
Niko Matsakis [Thu, 7 Jan 2016 18:51:16 +0000 (13:51 -0500)]
Change error scheme so that if projection fails we generate `A::B` instead of `TyError`

8 years agoRemove ErrorCandidate in favor of just generating an ambiguous result
Niko Matsakis [Thu, 7 Jan 2016 21:48:48 +0000 (16:48 -0500)]
Remove ErrorCandidate in favor of just generating an ambiguous result

8 years agoMake coherence more tolerant of error types.
Niko Matsakis [Sat, 2 Jan 2016 09:57:55 +0000 (04:57 -0500)]
Make coherence more tolerant of error types.

Fixes #29857.
Fixes #30589.

8 years agoAuto merge of #30782 - steveklabnik:rollup, r=steveklabnik
bors [Fri, 8 Jan 2016 22:42:10 +0000 (22:42 +0000)]
Auto merge of #30782 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #30584, #30747, #30755, #30758, #30760, #30769
- Failed merges: #30766

8 years agoRollup merge of #30769 - steveklabnik:gh30069, r=apasel422
Steve Klabnik [Fri, 8 Jan 2016 18:02:31 +0000 (13:02 -0500)]
Rollup merge of #30769 - steveklabnik:gh30069, r=apasel422

Fixes #30069

8 years agoRollup merge of #30760 - jonastepe:nomicon_vec_insert_remove_len, r=apasel422
Steve Klabnik [Fri, 8 Jan 2016 18:02:31 +0000 (13:02 -0500)]
Rollup merge of #30760 - jonastepe:nomicon_vec_insert_remove_len, r=apasel422

len needs to be prefixed by self for this to work. That is something which trips me up all the time. It's reassuring to see that happening to seasoned Rust programmers.

8 years agoRollup merge of #30758 - birkenfeld:fix-30743, r=steveklabnik
Steve Klabnik [Fri, 8 Jan 2016 18:02:31 +0000 (13:02 -0500)]
Rollup merge of #30758 - birkenfeld:fix-30743, r=steveklabnik

 (fixes #30743)

Not sure if the "Note" should be kept.