Commit Graph

50152 Commits

Author SHA1 Message Date
bors
f50fb159e9 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
2016-02-07 10:33:36 +00:00
bors
e548d6c08f Auto merge of #31450 - bluss:no-null-markers, r=Gankro
Document that Unique<T> and Shared<T> are non-null
2016-02-07 07:57:06 +00:00
bors
1678072ce8 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.
2016-02-07 03:50:39 +00:00
bors
3623797ebb 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.
2016-02-07 00:16:58 +00:00
bors
8c604dc940 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
2016-02-06 21:18:50 +00:00
Brian Anderson
7afb56f51e Add emscripten support to compiletest 2016-02-06 20:56:31 +00:00
Brian Anderson
bd3fe498e5 Add support for i686-unknown-linux-musl 2016-02-06 20:56:31 +00:00
Brian Anderson
81ba4a78b5 rustc: Add obj_is_bitcode to TargetOptions
This tells trans:🔙: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.
2016-02-06 20:56:31 +00:00
Brian Anderson
d6c0d859f6 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.
2016-02-06 20:56:14 +00:00
bors
915fa2a378 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
2016-02-06 19:16:10 +00:00
bors
3ad5bc01ec 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.
2016-02-06 17:13:49 +00:00
Ulrik Sverdrup
70650f849f Document that Unique<T> and Shared<T> are non-null 2016-02-06 16:22:17 +01:00
bors
be2ffddffb 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
2016-02-06 15:15:56 +00:00
bors
695c907dcc 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.
2016-02-06 13:16:03 +00:00
bors
35635aebab 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
2016-02-06 09:24:04 +00:00
qpid
61e4f2eb71 Removed .UR from rustdoc man page 2016-02-06 11:02:47 +05:30
Jonathan Reem
ad73330391 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.
2016-02-05 19:04:04 -08:00
Brian Campbell
ee79bfa18a 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
2016-02-05 20:41:18 -05:00
bors
5147c1f2c0 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
2016-02-06 01:24:22 +00:00
Alex Crichton
812b309c47 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.
2016-02-05 17:11:02 -08:00
Alex Crichton
46315184cb 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.
2016-02-05 17:11:02 -08:00
Alex Crichton
1a31e1c09f 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.
2016-02-05 17:11:02 -08:00
Alex Crichton
1bd2d20161 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.
2016-02-05 17:02:31 -08:00
Alex Crichton
0fff73b64a 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.
2016-02-05 16:58:10 -08:00
Alex Crichton
64d7eca0e5 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.
2016-02-05 16:58:10 -08:00
Simonas Kazlauskas
caf62ef984 Ignore a test on MSVC
The MSVC SEH is still not implemented, so we go ahead and ignore it.
2016-02-06 02:31:19 +02:00
bors
34af2de409 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
2016-02-05 20:13:25 +00:00
Simonas Kazlauskas
65921ca13c 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)
2016-02-05 20:51:36 +02:00
Niko Matsakis
a0f96d631e Address nits. 2016-02-05 13:19:55 -05:00
Niko Matsakis
8a29040989 Update collect to use the standard visit routine, rather than rolling
its own.
2016-02-05 13:19:55 -05:00
Niko Matsakis
35b6e2b0bb Instrument a bunch of tasks that employ the HIR map in one way or
another and were not previously instrumented.
2016-02-05 13:19:55 -05:00
Niko Matsakis
d09fd1a529 Instrument the AST map so that it registers reads when data is
acccessed.
2016-02-05 13:19:55 -05:00
Niko Matsakis
37fbfaf183 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.
2016-02-05 13:19:55 -05:00
bors
6dc112dbb7 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`
2016-02-05 17:16:03 +00:00
bors
98422e8c15 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](eeb94886ad) (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?
2016-02-05 15:11:45 +00:00
bors
38dfb96b46 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
2016-02-05 13:02:26 +00:00
bors
f12d32d307 Auto merge of #31389 - mitaa:schars, r=nrc
A span spanning only a single character would render like `^~`
instead of just `^`.

r? @nrc
2016-02-05 10:58:52 +00:00
Jonathan Reem
a61983f935 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
2016-02-05 02:26:19 -08:00
Jonathan Reem
ca72440e69 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.
2016-02-05 01:19:29 -08:00
bors
06fac8298f 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.
2016-02-05 08:54:46 +00:00
bors
2ad6dc2556 Auto merge of #31386 - tbu-:pr_cow_from_vec, r=alexcrichton
Fixes #31354.
2016-02-05 06:51:05 +00:00
bors
dcf8ef2723 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
2016-02-05 03:03:45 +00:00
bors
7bcced73b7 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`.
2016-02-05 01:00:31 +00:00
bors
9d8e3a024a Auto merge of #31416 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #31007, #31396, #31401, #31411, #31412, #31413, #31415
- Failed merges:
2016-02-04 22:55:47 +00:00
Robin Kruppe
a76cb45e34 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
2016-02-04 23:06:50 +01:00
Steve Klabnik
96d866a19d Rollup merge of #31415 - tshepang:2-space-indent, r=steveklabnik 2016-02-04 16:39:06 -05:00
Steve Klabnik
09e62bac0f Rollup merge of #31413 - tshepang:improve, r=steveklabnik 2016-02-04 16:39:06 -05:00
Steve Klabnik
fc6e7698c1 Rollup merge of #31412 - tshepang:add-trailing-commas, r=steveklabnik 2016-02-04 16:39:05 -05:00
Steve Klabnik
cd418ba09b Rollup merge of #31411 - tshepang:idiom, r=steveklabnik 2016-02-04 16:39:05 -05:00
Steve Klabnik
73db842617 Rollup merge of #31401 - frewsxcv:clarify-ascii, r=steveklabnik
Fixes https://github.com/rust-lang/rust/issues/31203
2016-02-04 16:39:05 -05:00