]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoFixing typo in prelude documentation
Kenneth Koski [Mon, 8 Feb 2016 18:04:23 +0000 (12:04 -0600)]
Fixing typo in prelude documentation

8 years agoRemove old #[allow(trivial_casts)] annotations
Alex Crichton [Mon, 8 Feb 2016 17:35:09 +0000 (09:35 -0800)]
Remove old #[allow(trivial_casts)] annotations

These were added a long time ago but we long since switched the lint back to
allow-by-default, so these annotations shouldn't be necessary.

8 years agoAuto merge of #31462 - thepowersgang:fix_29946, r=dotdash
bors [Mon, 8 Feb 2016 17:05:21 +0000 (17:05 +0000)]
Auto merge of #31462 - thepowersgang:fix_29946, r=dotdash

Generates drop calls at the end of the Fn/FnMut -> FnOnce closure shim

Fix #29946

8 years agoAuto merge of #31442 - pnkfelix:issue-30438-sidestep-dummy-node-during-expand-givens...
bors [Mon, 8 Feb 2016 14:56:24 +0000 (14:56 +0000)]
Auto merge of #31442 - pnkfelix:issue-30438-sidestep-dummy-node-during-expand-givens-dfs, r=nikomatsakis

Split dummy-idx node to fix expand_givens DFS

(Much more detail in commit comments.)

Fix #30438.

8 years agostd: `_lock` -> `_guard` in Mutex example
Benjamin Herr [Mon, 8 Feb 2016 13:48:12 +0000 (14:48 +0100)]
std: `_lock` -> `_guard` in Mutex example

The comment in the next line was already talking about `_guard`, and the
scope guard a couple lines further down is also called `guard`, so I
assume that was just a typo.

8 years agoregression tests for issue #30438.
Felix S. Klock II [Sat, 6 Feb 2016 03:37:21 +0000 (04:37 +0100)]
regression tests for issue #30438.

Fix #30438.

8 years agoSplit dummy in region inference graph into distinct source and sink nodes.
Felix S. Klock II [Sat, 6 Feb 2016 03:28:20 +0000 (04:28 +0100)]
Split dummy in region inference graph into distinct source and sink nodes.

Why do this: The RegionGraph representation previously conflated all
of the non-variable regions (i.e. the concrete regions such as
lifetime parameters to the current function) into a single dummy node.

A single dummy node leads DFS on a graph `'a -> '_#1 -> '_#0 -> 'b` to
claim that `'_#1` is reachable from `'_#0` (due to `'a` and `'b` being
conflated in the graph representation), which is incorrect (and can
lead to soundness bugs later on in compilation, see #30438).

Splitting the dummy node ensures that DFS will never introduce new
ancestor relationships between nodes for variable regions in the
graph.

8 years agoRefactor storage of `LandingPad`s
Piotr Czarnecki [Mon, 8 Feb 2016 10:53:06 +0000 (11:53 +0100)]
Refactor storage of `LandingPad`s

8 years agoRefactor the MIR translator to use LLVM Builder directly
Piotr Czarnecki [Mon, 1 Feb 2016 10:04:46 +0000 (11:04 +0100)]
Refactor the MIR translator to use LLVM Builder directly

8 years agoImplement OwnedBuilder and BlockAndBuilder
Piotr Czarnecki [Mon, 1 Feb 2016 10:04:49 +0000 (11:04 +0100)]
Implement OwnedBuilder and BlockAndBuilder

8 years agoAuto merge of #31468 - pitdicker:fs_tests_cleanup, r=alexcrichton
bors [Mon, 8 Feb 2016 07:38:11 +0000 (07:38 +0000)]
Auto merge of #31468 - pitdicker:fs_tests_cleanup, r=alexcrichton

See #29412

8 years agoReallow methods from traits that are shadowed by non-import items
Jeffrey Seyfried [Sat, 6 Feb 2016 23:43:04 +0000 (23:43 +0000)]
Reallow methods from traits that are shadowed by non-import items

8 years agoRefactor away add_export and cleanup the end of resolve_single_import
Jeffrey Seyfried [Sun, 7 Feb 2016 23:06:10 +0000 (23:06 +0000)]
Refactor away add_export and cleanup the end of resolve_single_import

8 years agoReplace children and import_resolutions with a single NameResolution-valued map.
Jeffrey Seyfried [Sun, 7 Feb 2016 23:58:14 +0000 (23:58 +0000)]
Replace children and import_resolutions with a single NameResolution-valued map.

Refactor away resolve_name_in_module in resolve_imports.rs

Rewrite and improve the core name resolution procedure in NameResolution::result and Module::resolve_name

Refactor the duplicate checking code into NameResolution::try_define

8 years agoChange try_define_child to return a Result instead of an Option
Jeffrey Seyfried [Mon, 8 Feb 2016 00:54:31 +0000 (00:54 +0000)]
Change try_define_child to return a Result instead of an Option

8 years agoWrite and use increment_outstanding_references_for and decrement_outstanding_referenc...
Jeffrey Seyfried [Sun, 7 Feb 2016 22:40:23 +0000 (22:40 +0000)]
Write and use increment_outstanding_references_for and decrement_outstanding_references_for

8 years agoRefactor away the fields id and is_public of ImportResolution and rename ImportResolu...
Jeffrey Seyfried [Sun, 7 Feb 2016 22:28:54 +0000 (22:28 +0000)]
Refactor away the fields id and is_public of ImportResolution and rename ImportResolution to NameResolution

8 years agoRefactor away separate tracking of used_public and used_reexport.
Jeffrey Seyfried [Sun, 7 Feb 2016 21:48:24 +0000 (21:48 +0000)]
Refactor away separate tracking of used_public and used_reexport.

NameBinding now encodes these directly with binding.is_public() and (binding.is_public() && binding.is_import()) (respectively)

8 years agoExpand NameBinding to better represent bindings from imports
Jeffrey Seyfried [Sun, 7 Feb 2016 21:34:23 +0000 (21:34 +0000)]
Expand NameBinding to better represent bindings from imports

8 years agoAdd and use an arena for `NameBinding`s
Jeffrey Seyfried [Sun, 7 Feb 2016 21:23:58 +0000 (21:23 +0000)]
Add and use an arena for `NameBinding`s

8 years agoRefactor away Target
Jeffrey Seyfried [Sun, 7 Feb 2016 21:04:01 +0000 (21:04 +0000)]
Refactor away Target

8 years agoMake resolve_name_in_module solely responsible for tracking used crates in lib.rs
Jeffrey Seyfried [Sun, 7 Feb 2016 19:29:51 +0000 (19:29 +0000)]
Make resolve_name_in_module solely responsible for tracking used crates in lib.rs

8 years agoAuto merge of #31470 - alexcrichton:lets-find-jemalloc, r=brson
bors [Sun, 7 Feb 2016 23:31:46 +0000 (23:31 +0000)]
Auto merge of #31470 - alexcrichton:lets-find-jemalloc, r=brson

Both of these targets have jemalloc disabled unconditionally right now, so using
`maybe_jemalloc` here isn't right. This fixes the case where a Linux compiler
(which is itself configured to use jemalloc) attempts to cross-compile to MinGW,
causing it to try to find an `alloc_jemalloc` crate (and failing).

8 years agoClean up Error Handling case study examples
Andrew Barchuk [Sun, 7 Feb 2016 21:00:01 +0000 (23:00 +0200)]
Clean up Error Handling case study examples

Remove unnecessary cloning and conversions. Expand tabs left in examples.

8 years agoAuto merge of #31469 - nagisa:mir-else-dest-fix, r=arielb1
bors [Sun, 7 Feb 2016 20:27:51 +0000 (20:27 +0000)]
Auto merge of #31469 - nagisa:mir-else-dest-fix, r=arielb1

r? @arielb1

8 years agoIgnore if we can't create a symlink in this test
Paul Dicker [Sun, 7 Feb 2016 20:10:29 +0000 (21:10 +0100)]
Ignore if we can't create a symlink in this test

8 years agorustc: Tweak exe allocator for MinGW/rumprun
Alex Crichton [Sun, 7 Feb 2016 20:03:06 +0000 (12:03 -0800)]
rustc: Tweak exe allocator for MinGW/rumprun

Both of these targets have jemalloc disabled unconditionally right now, so using
`maybe_jemalloc` here isn't right. This fixes the case where a Linux compiler
(which is itself configured to use jemalloc) attempts to cross-compile to MinGW,
causing it to try to find an `alloc_jemalloc` crate (and failing).

8 years ago[MIR] Fix the destination of implicit else branch
Simonas Kazlauskas [Sun, 7 Feb 2016 19:47:23 +0000 (21:47 +0200)]
[MIR] Fix the destination of implicit else branch

8 years agoDon't let `remove_dir_all` recursively remove a symlink
Paul Dicker [Sun, 7 Feb 2016 18:31:14 +0000 (19:31 +0100)]
Don't let `remove_dir_all` recursively remove a symlink
See #29412

8 years agoDo not forget to drop the boxes on scope exits
Simonas Kazlauskas [Sun, 7 Feb 2016 15:58:50 +0000 (17:58 +0200)]
Do not forget to drop the boxes on scope exits

Fixes #31463

8 years agoEmit destructor invocation in FnOnce shim for Fn/FnMut
John Hodge [Sun, 7 Feb 2016 11:35:39 +0000 (19:35 +0800)]
Emit destructor invocation in FnOnce shim for Fn/FnMut

- Fixes #29946

8 years agoAuto merge of #31433 - nagisa:fix-man-ur, r=brson
bors [Sun, 7 Feb 2016 10:33:36 +0000 (10:33 +0000)]
Auto merge of #31433 - nagisa:fix-man-ur, r=brson

seems to not work on OS X (or requires label, which would make link repeat twice on non-OS X)

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

8 years agoAuto merge of #31450 - bluss:no-null-markers, r=Gankro
bors [Sun, 7 Feb 2016 07:57:06 +0000 (07:57 +0000)]
Auto merge of #31450 - bluss:no-null-markers, r=Gankro

Document that Unique<T> and Shared<T> are non-null

8 years agoAuto merge of #31445 - saurvs:master, r=brson
bors [Sun, 7 Feb 2016 03:50:39 +0000 (03:50 +0000)]
Auto merge of #31445 - saurvs:master, r=brson

Similar to https://github.com/rust-lang/rust/issues/31432. Links do not show in OS X for the ```rustdoc``` man page.

8 years agoAuto merge of #31440 - reem:rwlock-map-fix, r=alexcrichton
bors [Sun, 7 Feb 2016 00:16:58 +0000 (00:16 +0000)]
Auto merge of #31440 - reem:rwlock-map-fix, r=alexcrichton

Also update the instability reason to include a note about a possible
bad interaction with condition variables on systems that allow
waiting on a RwLock guard.

8 years agoAuto merge of #30629 - brson:emscripten-upstream, r=alexcrichton
bors [Sat, 6 Feb 2016 21:18:50 +0000 (21:18 +0000)]
Auto merge of #30629 - brson:emscripten-upstream, r=alexcrichton

Here's another go at adding emscripten support. This needs to wait again on new [libc definitions](https://github.com/rust-lang-nursery/libc/pull/122) landing. To get the libc definitions right I had to add support for i686-unknown-linux-musl, which are very similar to emscripten's, which are derived from arm/musl.

This branch additionally removes the makefile dependency on the `EMSCRIPTEN` environment variable by not building the unused compiler-rt.

Again, this is not sufficient for actually compiling to asmjs since it needs additional LLVM patches.

r? @alexcrichton

8 years agoAdd emscripten support to compiletest
Brian Anderson [Wed, 6 Jan 2016 19:21:28 +0000 (19:21 +0000)]
Add emscripten support to compiletest

8 years agoAdd support for i686-unknown-linux-musl
Brian Anderson [Tue, 29 Dec 2015 22:33:58 +0000 (22:33 +0000)]
Add support for i686-unknown-linux-musl

8 years agorustc: Add obj_is_bitcode to TargetOptions
Brian Anderson [Fri, 27 Nov 2015 19:44:33 +0000 (19:44 +0000)]
rustc: Add obj_is_bitcode to TargetOptions

This tells trans::back::write not to LLVM codegen to create .o
files but to put LLMV bitcode in .o files.

Emscripten's emcc supports .o in this format, and this is,
I think, slightly easier than making rlibs work without .o
files.

8 years agoAdd the asmjs-unknown-emscripten triple. Add cfgs to libs.
Brian Anderson [Thu, 26 Nov 2015 19:05:10 +0000 (19:05 +0000)]
Add the asmjs-unknown-emscripten triple. Add cfgs to libs.

Backtraces, and the compilation of libbacktrace for asmjs, are disabled.

This port doesn't use jemalloc so, like pnacl, it disables jemalloc *for all targets*
in the configure file.

It disables stack protection.

8 years agoAuto merge of #31428 - reem:remove-mutexguard-map, r=alexcrichton
bors [Sat, 6 Feb 2016 19:16:10 +0000 (19:16 +0000)]
Auto merge of #31428 - reem:remove-mutexguard-map, r=alexcrichton

It could return in the future if it returned a different guard type, which
could not be used with Condvar, otherwise it is unsafe as another thread
can invalidate an "inner" reference during a Condvar::wait.

cc #27746

8 years agoAuto merge of #31427 - reem:more-debug-mutex, r=sfackler
bors [Sat, 6 Feb 2016 17:13:49 +0000 (17:13 +0000)]
Auto merge of #31427 - reem:more-debug-mutex, r=sfackler

There is no reason to require T: 'static; the bound appears to be
a historical artifact.

8 years agoDocument that Unique<T> and Shared<T> are non-null
Ulrik Sverdrup [Sat, 6 Feb 2016 15:18:23 +0000 (16:18 +0100)]
Document that Unique<T> and Shared<T> are non-null

8 years agoAuto merge of #31417 - alexcrichton:cloexec-all-the-things, r=brson
bors [Sat, 6 Feb 2016 15:15:56 +0000 (15:15 +0000)]
Auto merge of #31417 - alexcrichton:cloexec-all-the-things, r=brson

These commits finish up closing out https://github.com/rust-lang/rust/issues/24237 by filling out all locations we create new file descriptors with variants that atomically create the file descriptor and set CLOEXEC where possible. Previous support for doing this in `File::open` was added in #27971 and support for `try_clone` was added in #27980. This commit fills out:

* `Socket::new` now passes `SOCK_CLOEXEC`
* `Socket::accept` now uses `accept4`
* `pipe2` is used instead of `pipe`

Unfortunately most of this support is Linux-specific, and most of it is post-2.6.18 (our oldest supported version), so all of the detection here is done dynamically. It looks like OSX does not have equivalent variants for these functions, so there's nothing more we can do there. Support for BSDs can be added over time if they also have these functions.

Closes #24237

8 years agoAuto merge of #31410 - rkruppe:issue31109, r=pnkfelix
bors [Sat, 6 Feb 2016 13:16:03 +0000 (13:16 +0000)]
Auto merge of #31410 - rkruppe:issue31109, r=pnkfelix

Issue #31109 uncovered two semi-related problems:

* A panic in `str::parse::<f64>`
* A panic in `rustc::middle::const_eval::lit_to_const` where the result of float parsing was unwrapped.

This series of commits fixes both issues and also drive-by-fixes some things I noticed while tracking down the parsing panic.

8 years agoReuse MIR visitors for EraseRegions pass
Simonas Kazlauskas [Sun, 31 Jan 2016 18:25:17 +0000 (20:25 +0200)]
Reuse MIR visitors for EraseRegions pass

8 years agoAuto merge of #31333 - lambda:31273-abort-on-stack-overflow, r=brson
bors [Sat, 6 Feb 2016 09:24:04 +0000 (09:24 +0000)]
Auto merge of #31333 - lambda:31273-abort-on-stack-overflow, r=brson

Abort on stack overflow instead of re-raising SIGSEGV

We use guard pages that cause the process to abort to protect against
undefined behavior in the event of stack overflow.  We have a handler
that catches segfaults, prints out an error message if the segfault was
due to a stack overflow, then unregisters itself and returns to allow
the signal to be re-raised and kill the process.

This caused some confusion, as it was unexpected that safe code would be
able to cause a segfault, while it's easy to overflow the stack in safe
code.  To avoid this confusion, when we detect a segfault in the guard
page, abort instead of the previous behavior of re-raising SIGSEGV.

To test this, we need to adapt the tests for segfault to actually check
the exit status.  Doing so revealed that the existing test for segfault
behavior was actually invalid; LLVM optimizes the explicit null pointer
reference down to an illegal instruction, so the program aborts with
SIGILL instead of SIGSEGV and the test didn't actually trigger the
signal handler at all.  Use a C helper function to get a null pointer
that LLVM can't optimize away, so we get our segfault instead.

This is a [breaking-change] if anyone is relying on the exact signal
raised to kill a process on stack overflow.

Closes #31273

8 years agoRemoved .UR from rustdoc man page
qpid [Sat, 6 Feb 2016 05:32:47 +0000 (11:02 +0530)]
Removed .UR from rustdoc man page

8 years agoFix RwLock*Guard::map to not allow escaping a reference to the data.
Jonathan Reem [Sat, 6 Feb 2016 01:11:17 +0000 (17:11 -0800)]
Fix RwLock*Guard::map to not allow escaping a reference to the data.

Also update the instability reason to include a note about a possible
bad interaction with condition variables on systems that allow
waiting on a RwLock guard.

8 years agoAbort on stack overflow instead of re-raising SIGSEGV
Brian Campbell [Sun, 31 Jan 2016 23:30:32 +0000 (18:30 -0500)]
Abort on stack overflow instead of re-raising SIGSEGV

We use guard pages that cause the process to abort to protect against
undefined behavior in the event of stack overflow.  We have a handler
that catches segfaults, prints out an error message if the segfault was
due to a stack overflow, then unregisters itself and returns to allow
the signal to be re-raised and kill the process.

This caused some confusion, as it was unexpected that safe code would be
able to cause a segfault, while it's easy to overflow the stack in safe
code.  To avoid this confusion, when we detect a segfault in the guard
page, abort instead of the previous behavior of re-raising the SIGSEGV.

To test this, we need to adapt the tests for segfault to actually check
the exit status.  Doing so revealed that the existing test for segfault
behavior was actually invalid; LLVM optimizes the explicit null pointer
reference down to an illegal instruction, so the program aborts with
SIGILL instead of SIGSEGV and the test didn't actually trigger the
signal handler at all.  Use a C helper function to get a null pointer
that LLVM can't optimize away, so we get our segfault instead.

This is a [breaking-change] if anyone is relying on the exact signal
raised to kill a process on stack overflow.

Closes #31273

8 years agoAuto merge of #31307 - nagisa:mir-drop-terminator, r=nikomatsakis
bors [Sat, 6 Feb 2016 01:24:22 +0000 (01:24 +0000)]
Auto merge of #31307 - nagisa:mir-drop-terminator, r=nikomatsakis

The scope of these refactorings is a little bit bigger than the title implies. See each commit for details.

I’m submitting this for nitpicking now (the first 4 commits), because I feel the basic idea/implementation is sound and should work. I will eventually expand this PR to cover the translator changes necessary for all this to work (+ tests), ~~and perhaps implement a dynamic dropping scheme while I’m at it as well.~~

r? @nikomatsakis

8 years agostd: Try to use pipe2 on Linux for pipes
Alex Crichton [Thu, 4 Feb 2016 23:23:26 +0000 (15:23 -0800)]
std: Try to use pipe2 on Linux for pipes

This commit attempts to use the `pipe2` syscall on Linux to atomically set the
CLOEXEC flag for pipes created. Unfortunately this was added in 2.6.27 so we
have to dynamically determine whether we can use it or not.

This commit also updates the `fds-are-cloexec.rs` test to test stdio handles for
spawned processes as well.

8 years agostd: Add support for accept4 on Linux
Alex Crichton [Thu, 4 Feb 2016 23:22:41 +0000 (15:22 -0800)]
std: Add support for accept4 on Linux

This is necessary to atomically accept a socket and set the CLOEXEC flag at the
same time. Support only appeared in Linux 2.6.28 so we have to dynamically
determine which syscall we're supposed to call in this case.

8 years agostd: Add a helper for symbols that may not exist
Alex Crichton [Thu, 4 Feb 2016 21:56:59 +0000 (13:56 -0800)]
std: Add a helper for symbols that may not exist

Right now we only attempt to call one symbol which my not exist everywhere,
__pthread_get_minstack, but this pattern will come up more often as we start to
bind newer functionality of systems like Linux.

Take a similar strategy as the Windows implementation where we use `dlopen` to
lookup whether a symbol exists or not.

8 years agostd: Atomically set CLOEXEC for sockets if possible
Alex Crichton [Thu, 4 Feb 2016 21:30:24 +0000 (13:30 -0800)]
std: Atomically set CLOEXEC for sockets if possible

This commit adds support for creating sockets with the `SOCK_CLOEXEC` flag.
Support for this flag was added in Linux 2.6.27, however, and support does not
exist on platforms other than Linux. For this reason we still have the same
fallback as before but just special case Linux if we can.

8 years agostd: When duplicating fds, skip extra set_cloexec
Alex Crichton [Thu, 4 Feb 2016 21:22:51 +0000 (13:22 -0800)]
std: When duplicating fds, skip extra set_cloexec

Similar to the previous commit, if `F_DUPFD_CLOEXEC` succeeds then there's no
need for us to then call `set_cloexec` on platforms other than Linux. The bug
mentioned of kernels not actually setting the `CLOEXEC` flag has only been
repored on Linux, not elsewhere.

8 years agostd: Only have extra set_cloexec for files on Linux
Alex Crichton [Thu, 4 Feb 2016 19:59:31 +0000 (11:59 -0800)]
std: Only have extra set_cloexec for files on Linux

On Linux we have to do this for binary compatibility with 2.6.18, but for other
OSes (e.g. OSX/BSDs/etc) they all support this flag so we don't need to pass it.

8 years agoIgnore a test on MSVC
Simonas Kazlauskas [Sat, 6 Feb 2016 00:31:19 +0000 (02:31 +0200)]
Ignore a test on MSVC

The MSVC SEH is still not implemented, so we go ahead and ignore it.

8 years agoAuto merge of #31304 - nikomatsakis:incr-comp-read-from-hir-map, r=michaelwoerister
bors [Fri, 5 Feb 2016 20:13:25 +0000 (20:13 +0000)]
Auto merge of #31304 - nikomatsakis:incr-comp-read-from-hir-map, r=michaelwoerister

This change also modifies the dep graph infrastructure to keep track of the number of active tasks, so that even if we are not building the full dep-graph, we still get assertions when there is no active task and one does something that would add a read/write edge. This is particularly helpful since, if the assertions are *not* active, you wind up with the error happening in the message processing thread, which is too late to know the correct backtrace.

~~Before landing, I need to do some performance measurements. Those are underway.~~

See measurements below. No real effect on time.

r? @michaelwoerister

8 years agoDo not .UR in man
Simonas Kazlauskas [Fri, 5 Feb 2016 18:51:36 +0000 (20:51 +0200)]
Do not .UR in man

seems to not work on OS X (or requires label, which would make link repeat twice on non-OS X)

8 years agoAddress nits.
Niko Matsakis [Fri, 5 Feb 2016 18:19:21 +0000 (13:19 -0500)]
Address nits.

8 years agoUpdate collect to use the standard visit routine, rather than rolling
Niko Matsakis [Fri, 29 Jan 2016 21:25:21 +0000 (16:25 -0500)]
Update collect to use the standard visit routine, rather than rolling
its own.

8 years agoInstrument a bunch of tasks that employ the HIR map in one way or
Niko Matsakis [Fri, 29 Jan 2016 20:04:07 +0000 (15:04 -0500)]
Instrument a bunch of tasks that employ the HIR map in one way or
another and were not previously instrumented.

8 years agoInstrument the AST map so that it registers reads when data is
Niko Matsakis [Fri, 29 Jan 2016 20:07:04 +0000 (15:07 -0500)]
Instrument the AST map so that it registers reads when data is
acccessed.

8 years agoAdd a local counter that tracks how many tasks are pushed or not pushed,
Niko Matsakis [Fri, 29 Jan 2016 20:00:46 +0000 (15:00 -0500)]
Add a local counter that tracks how many tasks are pushed or not pushed,
so that we can still get assertion failures even when dep-graph
construction is disabled.

8 years agoAuto merge of #31349 - nikomatsakis:issue-31157-obligation-forest-cache, r=aturon
bors [Fri, 5 Feb 2016 17:16:03 +0000 (17:16 +0000)]
Auto merge of #31349 - nikomatsakis:issue-31157-obligation-forest-cache, r=aturon

Have the `ObligationForest` keep some per-tree state (or type `T`) and have it give a mutable reference for use when processing obligations. In this case, it will be a hashmap. This obviously affects the work that @soltanmm has been doing on snapshotting. I partly want to toss this out there for discussion.

Fixes #31157. (The test in question goes to approx. 30s instead of 5 minutes for me.)
cc #30977.
cc @aturon @arielb1 @soltanmm

r? @aturon who reviewed original `ObligationForest`

8 years agoAuto merge of #31400 - durka:civilized-deriving, r=alexcrichton
bors [Fri, 5 Feb 2016 15:11:45 +0000 (15:11 +0000)]
Auto merge of #31400 - durka:civilized-deriving, r=alexcrichton

You can `#[derive(FromPrimitive)]`, but it [fails later in the compile](https://play.rust-lang.org/?gist=82cb8ad2fac49e3fe472&version=stable) due to hardcoding `std::num::FromPrimitive` which [was removed](https://github.com/rust-lang/rust/commit/eeb94886adccb3f13003f92f117115d17846ce1f) (for some reason Github doesn't show `FromPrimitive` in the diff, but `git show` does).

Anyway, this PR removes the code. I didn't mark it as a breaking change, even though [this extremely contrived code using highly unstable features](https://play.rust-lang.org/?gist=1e1b1bbff962837b228a&version=nightly) is broken by it -- should I?

8 years agoAuto merge of #31390 - dotdash:fix_quadratic_drop, r=nagisa
bors [Fri, 5 Feb 2016 13:02:26 +0000 (13:02 +0000)]
Auto merge of #31390 - dotdash:fix_quadratic_drop, r=nagisa

If a new cleanup is added to a cleanup scope, the cached exits for that
scope are cleared, so all previous cleanups have to be translated
again. In the worst case this means that we get N distinct landing pads
where the last one has N cleanups, then N-1 and so on.

As new cleanups are to be executed before older ones, we can instead
cache the number of already translated cleanups in addition to the
block that contains them, and then only translate new ones, if any and
then jump to the cached ones, getting away with linear growth instead.

For the crate in #31381 this reduces the compile time for an optimized
build from >20 minutes (I cancelled the build at that point) to about 11
seconds. Testing a few crates that come with rustc show compile time
improvements somewhere between 1 and 8%. The "big" winner being
rustc_platform_intrinsics which features code similar to that in #31381.

Fixes #31381

8 years agoAuto merge of #31389 - mitaa:schars, r=nrc
bors [Fri, 5 Feb 2016 10:58:52 +0000 (10:58 +0000)]
Auto merge of #31389 - mitaa:schars, r=nrc

A span spanning only a single character would render like `^~`
instead of just `^`.

r? @nrc

8 years agoRemove MutexGuard::map, as it is not safe in combination with Condvar.
Jonathan Reem [Fri, 5 Feb 2016 10:22:32 +0000 (02:22 -0800)]
Remove MutexGuard::map, as it is not safe in combination with Condvar.

It could return in the future if it returned a different guard type, which
could not be used with Condvar, otherwise it is unsafe as another thread
can invalidate an "inner" reference during a Condvar::wait.

cc #27746

8 years agoRemove an unnecessary 'static bound in the impl of Debug for Mutex.
Jonathan Reem [Fri, 5 Feb 2016 09:19:29 +0000 (01:19 -0800)]
Remove an unnecessary 'static bound in the impl of Debug for Mutex.

There is no reason to require T: 'static; the bound appears to be
a historical artifact.

8 years agoAuto merge of #31388 - gmbonnet:compiler-rt-werror, r=alexcrichton
bors [Fri, 5 Feb 2016 08:54:46 +0000 (08:54 +0000)]
Auto merge of #31388 - gmbonnet:compiler-rt-werror, r=alexcrichton

Without this patch, `compiler-rt` fails to build when the `CFLAGS` environment variable contains a `-Werror=*` flag (for example `-Werror=format-security`).

The build system was removing only the `-Werror` part from the flag, thus passing an unrecognized `=*` (for example `=format-security`) argument to gcc.

8 years agoAuto merge of #31386 - tbu-:pr_cow_from_vec, r=alexcrichton
bors [Fri, 5 Feb 2016 06:51:05 +0000 (06:51 +0000)]
Auto merge of #31386 - tbu-:pr_cow_from_vec, r=alexcrichton

Fixes #31354.

8 years agoAuto merge of #31321 - jseyfried:cleanup, r=nrc
bors [Fri, 5 Feb 2016 03:03:45 +0000 (03:03 +0000)]
Auto merge of #31321 - jseyfried:cleanup, r=nrc

The first commit improves detection of unused imports -- it should have been part of #30325. Right now, the unused import in the changed test would not be reported.

The rest of the commits are miscellaneous, independent clean-ups in resolve that I didn't think warranted individual PRs.

r? @nrc

8 years agoAuto merge of #30865 - alexcrichton:mtime-system-time, r=aturon
bors [Fri, 5 Feb 2016 01:00:31 +0000 (01:00 +0000)]
Auto merge of #30865 - alexcrichton:mtime-system-time, r=aturon

These accessors are used to get at the last modification, last access, and
creation time of the underlying file. Currently not all platforms provide the
creation time, so that currently returns `Option`.

8 years agoAuto merge of #31416 - steveklabnik:rollup, r=steveklabnik
bors [Thu, 4 Feb 2016 22:55:47 +0000 (22:55 +0000)]
Auto merge of #31416 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #31007, #31396, #31401, #31411, #31412, #31413, #31415
- Failed merges:

8 years agoICE more gracefully in constant evaluation when float parsing fails
Robin Kruppe [Thu, 4 Feb 2016 15:18:20 +0000 (16:18 +0100)]
ICE more gracefully in constant evaluation when float parsing fails

Ideally float parsing wouldn't fail at all, but for the moment let's give a helpful message.

Fixes #31109

8 years agoRollup merge of #31415 - tshepang:2-space-indent, r=steveklabnik
Steve Klabnik [Thu, 4 Feb 2016 21:39:06 +0000 (16:39 -0500)]
Rollup merge of #31415 - tshepang:2-space-indent, r=steveklabnik

8 years agoRollup merge of #31413 - tshepang:improve, r=steveklabnik
Steve Klabnik [Thu, 4 Feb 2016 21:39:06 +0000 (16:39 -0500)]
Rollup merge of #31413 - tshepang:improve, r=steveklabnik

8 years agoRollup merge of #31412 - tshepang:add-trailing-commas, r=steveklabnik
Steve Klabnik [Thu, 4 Feb 2016 21:39:05 +0000 (16:39 -0500)]
Rollup merge of #31412 - tshepang:add-trailing-commas, r=steveklabnik

8 years agoRollup merge of #31411 - tshepang:idiom, r=steveklabnik
Steve Klabnik [Thu, 4 Feb 2016 21:39:05 +0000 (16:39 -0500)]
Rollup merge of #31411 - tshepang:idiom, r=steveklabnik

8 years agoRollup merge of #31401 - frewsxcv:clarify-ascii, r=steveklabnik
Steve Klabnik [Thu, 4 Feb 2016 21:39:05 +0000 (16:39 -0500)]
Rollup merge of #31401 - frewsxcv:clarify-ascii, r=steveklabnik

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

8 years agoRollup merge of #31396 - mbrubeck:grammar-stmts, r=alexcrichton
Steve Klabnik [Thu, 4 Feb 2016 21:39:05 +0000 (16:39 -0500)]
Rollup merge of #31396 - mbrubeck:grammar-stmts, r=alexcrichton

"stmt" already includes the terminating semicolon.

8 years agoRollup merge of #31007 - pra85:license, r=aturon
Steve Klabnik [Thu, 4 Feb 2016 21:39:05 +0000 (16:39 -0500)]
Rollup merge of #31007 - pra85:license, r=aturon

According to http://www.copyright.gov/circs/circ01.pdf (See screenshot of relevant section below) , listing the first year of publication in the copyright is enough

![selection_008](https://cloud.githubusercontent.com/assets/829526/12409934/7021c3a6-be95-11e5-8d1a-18f6948571e0.png)

The commits d5c8f626a8e4c5166833 and f979f91ae20b2da9b24140334 have changed the copyright years

This commit reverts back those changes, so that license year is again 2014 (As it was, when this license was first introduced in commit 90ba013bde2396f200196  )

--------------------------------------
Edit 1: Added screenshot

8 years agodoc: Rust indents are 4-space wide by convention
Tshepang Lekhonkhobe [Thu, 4 Feb 2016 21:31:22 +0000 (23:31 +0200)]
doc: Rust indents are 4-space wide by convention

8 years agostd: Expose SystemTime accessors on fs::Metadata
Alex Crichton [Wed, 13 Jan 2016 01:24:16 +0000 (17:24 -0800)]
std: Expose SystemTime accessors on fs::Metadata

These accessors are used to get at the last modification, last access, and
creation time of the underlying file. Currently not all platforms provide the
creation time, so that currently returns `Option`.

8 years agoAuto merge of #30759 - Manishearth:attr-tls, r=alexcrichton
bors [Thu, 4 Feb 2016 20:52:22 +0000 (20:52 +0000)]
Auto merge of #30759 - Manishearth:attr-tls, r=alexcrichton

fixes #30756

r? @Gankro

8 years agoreference: add trailing commas
Tshepang Lekhonkhobe [Thu, 4 Feb 2016 20:31:47 +0000 (22:31 +0200)]
reference: add trailing commas

8 years agoreference: make the line a little more readable
Tshepang Lekhonkhobe [Thu, 4 Feb 2016 20:39:15 +0000 (22:39 +0200)]
reference: make the line a little more readable

8 years agoreference: explicit return at function end is not idiomatic
Tshepang Lekhonkhobe [Thu, 4 Feb 2016 20:32:53 +0000 (22:32 +0200)]
reference: explicit return at function end is not idiomatic

8 years agoAuto merge of #31360 - pitdicker:fs_tests_cleanup, r=alexcrichton
bors [Thu, 4 Feb 2016 18:48:41 +0000 (18:48 +0000)]
Auto merge of #31360 - pitdicker:fs_tests_cleanup, r=alexcrichton

- use `symlink_file` and `symlink_dir` instead of the old `soft_link`
- create a junction instead of a directory symlink for testing recursive_rmdir (as it causes the
  same troubles, but can be created by users without `SeCreateSymbolicLinkPrivilege`)
- `remove_dir_all` was unable to remove directory symlinks and junctions
- only run tests that create symlinks if we have the right permissions.
- rename `Path2` to `Path`
- remove the global `#[allow(deprecated)]` and outdated comments
- After factoring out `create_junction()` from the test `directory_junctions_are_directories` and
  removing needlessly complex code, what I was left with was:
  ```
  #[test]
  #[cfg(windows)]
  fn directory_junctions_are_directories() {
      use sys::fs::create_junction;

      let tmpdir = tmpdir();

      let foo = tmpdir.join("foo");
      let bar = tmpdir.join("bar");

      fs::create_dir(&foo).unwrap();
      check!(create_junction(&foo, &bar));
      assert!(bar.metadata().unwrap().is_dir());
  }
  ```
  It test whether a junction is a directory instead of a reparse point. But it actually test the
  target of the junction (which is a directory if it exists) instead of the junction itself, which
  should always be a symlink. So this test is invalid, and I expect it only exists because the
  author was suprised by it. So I removed it.

Some things that do not yet work right:
- relative symlinks do not accept forward slashes
- the conversion of paths for `create_junction` is hacky
- `remove_dir_all` now messes with the internal data of `FileAttr` to be able to remove symlinks.
  We should add some method like `is_symlink_dir()` to it, so code outside the standard library
  can see the difference between file and directory symlinks too.

8 years agoTest for unsafe code in TLS macro
Manish Goregaokar [Thu, 4 Feb 2016 12:20:32 +0000 (17:50 +0530)]
Test for unsafe code in TLS macro

8 years agoStop using unsafe code in TLS macro expansion (fixes #30756)
Manish Goregaokar [Thu, 4 Feb 2016 12:20:20 +0000 (17:50 +0530)]
Stop using unsafe code in TLS macro expansion (fixes #30756)

8 years agoClarify scenario where AsciiExt appears to operate on non-ASCII
Corey Farwell [Thu, 4 Feb 2016 05:11:18 +0000 (00:11 -0500)]
Clarify scenario where AsciiExt appears to operate on non-ASCII

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

8 years agoAuto merge of #31382 - DanielJCampbell:SaveSpans, r=nrc
bors [Thu, 4 Feb 2016 15:44:35 +0000 (15:44 +0000)]
Auto merge of #31382 - DanielJCampbell:SaveSpans, r=nrc

r? @nrc

8 years agoAllow dead code for `symlink_junction()`
Paul Dicker [Thu, 4 Feb 2016 15:29:55 +0000 (16:29 +0100)]
Allow dead code for `symlink_junction()`

8 years agodrive-by doc fixes
Robin Kruppe [Thu, 4 Feb 2016 13:09:59 +0000 (14:09 +0100)]
drive-by doc fixes

8 years agoEnable unit tests for literals that overflow. I have no idea why this condition was...
Robin Kruppe [Thu, 4 Feb 2016 12:51:18 +0000 (13:51 +0100)]
Enable unit tests for literals that overflow. I have no idea why this condition was ever added.

8 years agoPrevent the immediate panic uncovered by #31109 and add a test.
Robin Kruppe [Tue, 26 Jan 2016 21:10:21 +0000 (22:10 +0100)]
Prevent the immediate panic uncovered by #31109 and add a test.

The code there still triggers an ICE, but for different reasons (const eval unwraps the parse result).

8 years agoAdd the kind of input from #31109 to the expensive tests (not run by default)
Robin Kruppe [Tue, 26 Jan 2016 21:05:21 +0000 (22:05 +0100)]
Add the kind of input from #31109 to the expensive tests (not run by default)