bors [Fri, 25 Mar 2016 18:00:01 +0000 (11:00 -0700)]
Auto merge of #32407 - alexcrichton:netbsd-gcc-s-link, r=aturon
std: Link to gcc_s on NetBSD
Currently the nightlies we're producing fail when linking some C code into a
Rust application with the error message:
libgcc_s.so.1: error adding symbols: DSO missing from command line
By linking `gcc_s` instead of `gcc` this error goes away. I haven't tested this
on NetBSD itself, but should help get the Linux cross-compile image moreso up
and working!
bors [Fri, 25 Mar 2016 12:03:13 +0000 (05:03 -0700)]
Auto merge of #31908 - jseyfried:disallow_shadowed_traits, r=nikomatsakis
Disallow methods from traits that are not in scope
This PR only allows a trait method to be used if the trait is in scope (fixes #31379).
This is a [breaking-change]. For example, the following would break:
```rust
mod foo {
pub trait T { fn f(&self) {} }
impl T for () {}
}
mod bar { pub use foo::T; }
fn main() {
pub use bar::*;
struct T; // This shadows the trait `T`,
().f() // making this an error.
}
```
r? @nikomatsakis
bors [Fri, 25 Mar 2016 06:12:57 +0000 (23:12 -0700)]
Auto merge of #32428 - nikomatsakis:scopes-in-mir, r=nagisa
Scopes in mir
This PR adds scopes to MIR. There is a tree of scopes (each represented by a `ScopeId`). Every statement, variable, and terminator now has an associated scope and span. It also adds a `-Z dump-mir` switch one can use to conveniently examine the MIR as optimizations proceed.
The intention is two-fold. First, to support MIR debug-info. This PR does not attempt to modify trans to make use of the scope information, however.
Second, in a more temporary capacity, to support the goal of moving regionck and borowck into the MIR. To that end, the PR also constructs a "scope auxiliary" table storing the extent of each span (this is kept separate from the main MIR, since it contains node-ids) and the dom/post-dom of the region in the graph where the scope occurs. When we move to non-lexical lifetimes, I expect this auxiliary information to be discarded, but that is still some ways in the future (requires, at minimum, an RFC, and there are some thorny details to work out -- though I've got an in-progress draft).
Right now, I'm just dropping this auxiliary information after it is constructed. I was debating for some time whether to add some sort of sanity tests, but decided to just open this PR instead, because I couldn't figure out what such a test would look like (and we don't have independent tests for this today beyond the regionck and borrowck tests).
I'd prefer not to store the auxiliary data into any kind of "per-fn" map. Rather, I'd prefer that we do regionck/borrowck/whatever-else immediately after construction -- that is, we build the MIR for fn X and immediately thereafter do extended correctness checking on it. This will reduce peak memory usage and also ensure that the auxiliary data doesn't exist once optimizations begin. It also clarifies the transition point where static checks are complete and MIR can be more freely optimized.
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).
Niko Matsakis [Thu, 24 Mar 2016 00:46:38 +0000 (20:46 -0400)]
rewrite scope drop to be iterative
while I'm at it, remove the "extra caching" that I was doing for no good
reason except laziness. Basically before I was caching at each scope in
the chain, but there's not really a reason to do that, since the cached
entry point at level N is always equal to the last cached exit point
from level N-1.
Niko Matsakis [Wed, 23 Mar 2016 09:01:30 +0000 (05:01 -0400)]
Add `ScopeAuxiliaryVec`, return MIR+aux via tuple
It's nice to be able to index with a scope-id,
but coherence rules prevent us from implementing
`Index<ScopeId>` for `Vec<ScopeAuxiliary>`, and I'd
prefer that `ScopeAuxiliary` remain in librustc_mir,
just for compilation time reasons.
Niko Matsakis [Wed, 23 Mar 2016 00:39:29 +0000 (20:39 -0400)]
rewrite drop code
This was triggered by me wanting to address a use of DUMMY_SP, but
actually I'm not sure what would be a better span -- I guess the span
for the function as a whole.
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 ?