Commit Graph

50383 Commits

Author SHA1 Message Date
Felix S. Klock II
77c8850e6f regression tests for issue #30438.
Fix #30438.
2016-02-08 13:49:06 +01:00
Felix S. Klock II
8801bdb6b0 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.
2016-02-08 13:44:03 +01:00
Piotr Czarnecki
a9ab8096ba Refactor storage of LandingPads 2016-02-08 11:53:06 +01:00
Piotr Czarnecki
06266eb3bd Refactor the MIR translator to use LLVM Builder directly 2016-02-08 11:41:24 +01:00
Piotr Czarnecki
8b776834a4 Implement OwnedBuilder and BlockAndBuilder 2016-02-08 11:12:31 +01:00
bors
e06f6928cb Auto merge of #31468 - pitdicker:fs_tests_cleanup, r=alexcrichton
See #29412
2016-02-08 07:38:11 +00:00
Jeffrey Seyfried
3c62d90202 Reallow methods from traits that are shadowed by non-import items 2016-02-08 02:25:10 +00:00
Jeffrey Seyfried
d7734aebec Refactor away add_export and cleanup the end of resolve_single_import 2016-02-08 02:25:09 +00:00
Jeffrey Seyfried
7000e70825 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
2016-02-08 02:25:08 +00:00
Jeffrey Seyfried
d881eee608 Change try_define_child to return a Result instead of an Option 2016-02-08 02:25:07 +00:00
Jeffrey Seyfried
16e7ff1bff Write and use increment_outstanding_references_for and decrement_outstanding_references_for 2016-02-08 02:25:05 +00:00
Jeffrey Seyfried
96b4dc4b87 Refactor away the fields id and is_public of ImportResolution and rename ImportResolution to NameResolution 2016-02-08 02:25:03 +00:00
Jeffrey Seyfried
4428b1cfdf 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)
2016-02-08 02:25:00 +00:00
Jeffrey Seyfried
2e24c7410f Expand NameBinding to better represent bindings from imports 2016-02-08 02:24:53 +00:00
Jeffrey Seyfried
22e189ed57 Add and use an arena for NameBindings 2016-02-08 02:24:16 +00:00
Jeffrey Seyfried
7366d105cb Refactor away Target 2016-02-08 02:22:41 +00:00
Jeffrey Seyfried
661b7ce830 Make resolve_name_in_module solely responsible for tracking used crates in lib.rs 2016-02-08 02:21:36 +00:00
bors
7fce5037a9 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).
2016-02-07 23:31:46 +00:00
Andrew Barchuk
422cf2d34a Clean up Error Handling case study examples
Remove unnecessary cloning and conversions. Expand tabs left in examples.
2016-02-07 23:08:46 +02:00
bors
73132caa0b Auto merge of #31469 - nagisa:mir-else-dest-fix, r=arielb1
r? @arielb1
2016-02-07 20:27:51 +00:00
Paul Dicker
d1bfe9bccf Ignore if we can't create a symlink in this test 2016-02-07 21:10:29 +01:00
Alex Crichton
79a6373573 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).
2016-02-07 12:05:03 -08:00
Simonas Kazlauskas
ae151d3945 [MIR] Fix the destination of implicit else branch 2016-02-07 21:47:23 +02:00
Paul Dicker
d47036cbd1 Don't let remove_dir_all recursively remove a symlink
See #29412
2016-02-07 19:31:14 +01:00
Simonas Kazlauskas
7faaf0e2de Do not forget to drop the boxes on scope exits
Fixes #31463
2016-02-07 18:03:15 +02:00
John Hodge
f08626bc9b Emit destructor invocation in FnOnce shim for Fn/FnMut
- Fixes #29946
2016-02-07 21:33:30 +08:00
Guillaume Gomez
6407b9405f Update long error explanations 2016-02-07 13:03:35 +01:00
Guillaume Gomez
eb5b9037ad Add compile-fail test in rustdoc 2016-02-07 13:03:32 +01:00
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
Simonas Kazlauskas
0b3ef97066 Reuse MIR visitors for EraseRegions pass 2016-02-06 12:56:52 +02: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