Fix unsound behaviour with null characters in thread names (issue #32475)
Previously, the thread name (&str) was converted to a CString in the
new thread, but outside unwind::try, causing a panic to continue into FFI.
This patch changes that behaviour, so that the panic instead happens
in the parent thread (where panic infrastructure is properly set up),
not the new thread.
This could potentially be a breaking change for architectures who don't
support thread names.
Signed-off-by: David Henningsson <diwic@ubuntu.com>
bors [Thu, 24 Mar 2016 21:22:26 +0000 (14:22 -0700)]
Auto merge of #32346 - nikomatsakis:no-erased-regions, r=eddyb
Remove `ErasedRegions` from substs
This commit removes the `ErasedRegions` enum from `Substs`. Instead, in trans, we just generate a vector of `ReStatic` of suitable length. The goal is both general cleanup and to help pave the way for a glorious future where erasure is used in type check.
r? @eddyb
One concern: might be nice to do some profiling. Not sure the best way to do that. Perhaps I'll investigate running nrc's test suite locally.
Niko Matsakis [Wed, 9 Mar 2016 23:22:05 +0000 (18:22 -0500)]
remove ErasedRegions from substitutions
This hack has long since outlived its usefulness; the transition to
trans passing around full substitutions is basically done. Instead of
`ErasedRegions`, just supply substitutions with a suitable number of
`'static` entries, and invoke `erase_regions` when needed (the latter of
which we already do).
Rollup merge of #32437 - eddyb:orbital-msvc, r=alexcrichton
Annotate run-pass/backtrace with #[rustc_no_mir] on MSVC.
Fixes #32384 by not using MIR on MSVC for the functions in the path of the backtrace.
This is the known blocker for the MSVC MIR builder, hopefully the only one overall.
r? @alexcrichton Confirmed to work on a nightly, by @retep998.
Rollup merge of #32430 - sanxiyn:const-trans, r=arielb1
Fix const trans
Fix #30615.
The idea was that when there are N autoderefs, first do N-1 derefs and check for autoref. If there is autoref, done, if not, do one more deref. But when N is zero, doing one more deref is wrong.
Rollup merge of #32429 - alexcrichton:scope-id-hton, r=aturon
std: Store flowinfo/scope_id in host byte order
Apparently these aren't supposed to be stored in network byte order, so doing so
ends up causing failures when it would otherwise succeed when stored in the host
byte order.
bors [Wed, 23 Mar 2016 08:03:04 +0000 (01:03 -0700)]
Auto merge of #32348 - brson:cargotest, r=alexcrichton
Introduce 'cargotest' and the check-cargotest buildstep
This is a new suite of tests that verifies that the compiler builds specific revisions of select crates from crates.io.
It does not run by default. It is intended that bors runs these tests against all PRs, and gates on them. In this way we will make it harder still to break important swaths of the ecosystem, even on nightly.
This is a very basic implementation intended for feedback. The biggest thing it probably should do but doesn't is use a lockfile for every project it builds.
r? @alexcrichton cc @rust-lang/lang @rust-lang/libs
bors [Tue, 22 Mar 2016 23:05:39 +0000 (16:05 -0700)]
Auto merge of #32204 - alexcrichton:redesign-char-encoding-types, r=aturon
std: Change `encode_utf{8,16}` to return iterators
Currently these have non-traditional APIs which take a buffer and report how
much was filled in, but they're not necessarily ergonomic to use. Returning an
iterator which *also* exposes an underlying slice shouldn't result in any
performance loss as it's just a lazy version of the same implementation, and
it's also much more ergonomic!
Alex Crichton [Fri, 11 Mar 2016 19:01:46 +0000 (11:01 -0800)]
std: Change `encode_utf{8,16}` to return iterators
Currently these have non-traditional APIs which take a buffer and report how
much was filled in, but they're not necessarily ergonomic to use. Returning an
iterator which *also* exposes an underlying slice shouldn't result in any
performance loss as it's just a lazy version of the same implementation, and
it's also much more ergonomic!
bors [Tue, 22 Mar 2016 17:00:12 +0000 (10:00 -0700)]
Auto merge of #32156 - pnkfelix:borrowck-on-mir-move-analysis, r=nikomatsakis
Move analysis for MIR borrowck
This PR adds code for doing MIR-based gathering of the moves in a `fn` and the dataflow to determine where uninitialized locations flow to, analogous to how the same thing is done in `borrowck`.
It also adds a couple attributes to print out graphviz visualizations of the analyzed MIR that includes the dataflow analysis results.
Alex Crichton [Tue, 22 Mar 2016 16:33:36 +0000 (09:33 -0700)]
std: Store flowinfo/scope_id in host byte order
Apparently these aren't supposed to be stored in network byte order, so doing so
ends up causing failures when it would otherwise succeed when stored in the host
byte order.
These segmentation fault starts to be annoying. @dhuseby do you think it would be possible to have a shell access to openbsd buildbot in order to try to investigating a bit the reason of them ?
bors [Mon, 21 Mar 2016 23:00:08 +0000 (16:00 -0700)]
Auto merge of #32062 - Marwes:unification_table_for_eq_relations, r=nikomatsakis
Improve time complexity of equality relations
This PR adds a `UnificationTable` to the `TypeVariableTable` type which is used store information about variable equality instead of just storing them in a vector for later processing. By using a `UnificationTable` equality relations can be resolved in O(n) (for all realistic values of n) rather than O(n!) which can give massive speedups in certain cases (see combine as an example).
Link to combine: https://github.com/Marwes/combine
This PR adds a `UnificationTable` to the `TypeVariableTable` type which
is used store information about variable equality instead of just
storing them in a vector for later processing. By using a
`UnificationTable` equality relations can be resolved in O(n) (for all
realistic values of n) rather than O(n!) which can give massive
speedups in certain cases (see combine as an example).
Link to combine: https://github.com/Marwes/combine
assigning a (MIR) box into an lvalue allocates heap storage that will
need to be initialized. create a MoveOut to represent that deref'ed
`*lval` path.
Make `fn move_path_for` take `&mut self` instead of `&self`. This is a
precursor for a number of other simplifying changes (mostly removing
uses of `RefCell`).
dont create MovePathIndex's for individual statics.
Instead, create a single MovePathIndex that represents all statics.
(An alternative here would be to disallow representing statics at all.
I am hesitant to do that right now, in part because it could impose a
requirement that I thread checks for static data into the calling
code, either as pre- or post-invocation of `fn move_path_for`.)
emit (via debug!) scary message from `fn borrowck_mir` until basic
prototype is in place.
Gather children of move paths and set their kill bits in
dataflow. (Each node has a link to the child that is first among its
siblings.)
Hooked in libgraphviz based rendering, including of borrowck dataflow
state.
doing this well required some refactoring of the code, so I cleaned it
up more generally (adding comments to explain what its trying to do
and how it is doing it).
Update: this newer version addresses most review comments (at least
the ones that were largely mechanical changes), but I left the more
interesting revisions to separate followup commits (in this same PR).
Steve Klabnik [Mon, 21 Mar 2016 15:46:53 +0000 (11:46 -0400)]
Rollup merge of #32376 - cyplo:cyplo_fix_E0368_documentation, r=steveklabnik
Documentation fix for E0368
Made the 'good' example compile.
I got to the [E0368 error page](https://doc.rust-lang.org/error-index.html#E0368) by following the link in the output of the
compiler. My understanding is that the first example is 'bad' and the
second one is 'good'. Following that logic, I pasted the second example
into the file and to my surprise it did not compile. This commit fixes
the example to make it paste-able.
On the other hand the docstring contained `compile_fail` flag, which might indicate that this was intentional.
I am also assuming here that the `Rust Compiler Error Index` page is generated from the file I changed.
Please let me know what do you think. Thanks a lot !
Steve Klabnik [Mon, 21 Mar 2016 15:46:52 +0000 (11:46 -0400)]
Rollup merge of #32340 - Digipom:master, r=steveklabnik
Update of the book; Error handling, section on custom error types: we…
… should also show the changes to the `cause` method.
When I started creating my own error type, I found that we also have to update the cause method, otherwise we have a missing match branch.
It would also be nice to elaborate on the relationship and difference between the description() and fmt() method, but that should be done by someone with more experience with them. :)
bors [Mon, 21 Mar 2016 13:35:17 +0000 (06:35 -0700)]
Auto merge of #32378 - petrochenkov:patch-1, r=alexcrichton
Correct Windows build instructions in README.md
http://mingw-w64.org/doku.php/download/mingw-builds now provides GCC 5.3 as a default version, but avoiding 5.x is exactly the reason why Mingw-builds are recommended instead of MSYS2's own mingw toolchain. One of the 4.9.x versions has to be manually chosen during installation.