]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoRollup merge of #33345 - birkenfeld:issue-31754, r=pnkfelix
Steve Klabnik [Wed, 11 May 2016 13:27:43 +0000 (09:27 -0400)]
Rollup merge of #33345 - birkenfeld:issue-31754, r=pnkfelix

middle: reset loop labels while visiting closure

This should fix #31754 and follow-up #25343.  Before the latter, the closure was visited twice in the context of the enclosing fn, which made even a single closure with a loop label emit a warning.

With this change, the closure is still visited within the context of the main fn (which is intended, since it is not a separate item) but resets the found loop labels while being visited.

Fixes: #31754
Note: I amended the test file from #25343, but I don't know if the original or amended test are effective, since as far as I could see, compiletest's run-pass tests do not check for zero warnings emitted?

/cc @Manishearth

8 years agoRollup merge of #33260 - mrmiywj:help-on-pattern-guard, r=guillaumegomez
Steve Klabnik [Wed, 11 May 2016 13:27:42 +0000 (09:27 -0400)]
Rollup merge of #33260 - mrmiywj:help-on-pattern-guard, r=guillaumegomez

add help on pattern guard

8 years agoRollup merge of #33129 - GuillaumeGomez:fmt_doc, r=steveklabnik
Steve Klabnik [Wed, 11 May 2016 13:27:42 +0000 (09:27 -0400)]
Rollup merge of #33129 - GuillaumeGomez:fmt_doc, r=steveklabnik

Doc improvement on std::fmt module

Part of #29355.

r? @steveklabnik

8 years agoAuto merge of #33425 - eddyb:rift, r=nikomatsakis
bors [Wed, 11 May 2016 06:40:09 +0000 (23:40 -0700)]
Auto merge of #33425 - eddyb:rift, r=nikomatsakis

Split the type context into a global and a local (inference-only) one.

After this change, each `InferCtxt` creates its own local type interner for types with inference by-products.
Most of the code which handles both a global and a local interner uses `'gcx` and `'tcx` for them.
A reference to the type context in that situation (e.g. `infcx.tcx`) is `TyCtxt<'a, 'gcx, 'tcx>`.
The global type context which used to be `&'a TyCtxt<'tcx>` is now `TyCtxt<'a, 'tcx, 'tcx>`.

In order to minimize the number of extra lifetime parameters, many functions became methods.
Where possible (some inherent impls), lifetime parameters were added on the impl, not each method.

As inference by-products no longer escape their inference contexts, memory usage is lower.
Example of `-Z time-passes` excerpt for `librustc`, stage1 (~100MB gains):
Before "rustc: Split local type contexts interners from the global one.":
```
time: 0.395; rss: 335MB item-types checking
time: 15.392; rss: 472MB        item-bodies checking
time: 0.000; rss: 472MB drop-impl checking
time: 1.140; rss: 478MB const checking
time: 0.139; rss: 478MB privacy checking
time: 0.024; rss: 478MB stability index
time: 0.072; rss: 478MB intrinsic checking
time: 0.038; rss: 478MB effect checking
time: 0.255; rss: 478MB match checking
time: 0.128; rss: 484MB liveness checking
time: 1.372; rss: 484MB rvalue checking
time: 1.404; rss: 597MB MIR dump
time: 0.809; rss: 599MB MIR passes
```
After:
```
time: 0.467; rss: 337MB item-types checking
time: 17.443; rss: 395MB        item-bodies checking
time: 0.000; rss: 395MB drop-impl checking
time: 1.423; rss: 401MB const checking
time: 0.141; rss: 401MB privacy checking
time: 0.024; rss: 401MB stability index
time: 0.116; rss: 401MB intrinsic checking
time: 0.038; rss: 401MB effect checking
time: 0.382; rss: 401MB match checking
time: 0.132; rss: 407MB liveness checking
time: 1.678; rss: 407MB rvalue checking
time: 1.614; rss: 503MB MIR dump
time: 0.957; rss: 512MB MIR passes
```

**NOTE**: Functions changed to methods weren't re-indented to keep this PR easier to review.
Once approved, the changes will be mechanically performed.
However, indentation changes of function arguments are there - and I believe there's a way to hide whitespace-only changes in diffs on GitHub.

8 years agoFixup indentation after methodification.
Eduard Burtescu [Wed, 11 May 2016 05:48:12 +0000 (08:48 +0300)]
Fixup indentation after methodification.

8 years agoAuto merge of #33512 - birkenfeld:issue-25944, r=sanxiyn
bors [Wed, 11 May 2016 03:14:46 +0000 (20:14 -0700)]
Auto merge of #33512 - birkenfeld:issue-25944, r=sanxiyn

rustdoc: remove artificial indentation of doctest code

The indentation makes the examples look nicer when printed (when is this done?), but breaks tests using multi-line string literals.

Fixes: #25944
8 years agorustc: Split local type contexts interners from the global one.
Eduard Burtescu [Wed, 11 May 2016 01:14:41 +0000 (04:14 +0300)]
rustc: Split local type contexts interners from the global one.

8 years agorustc_typeck: Generalize over 'tcx != 'gcx.
Eduard Burtescu [Mon, 2 May 2016 15:07:47 +0000 (18:07 +0300)]
rustc_typeck: Generalize over 'tcx != 'gcx.

8 years agorustc: Remove the unnecessary ast_ty_to_ty_cache.
Eduard Burtescu [Mon, 2 May 2016 15:07:04 +0000 (18:07 +0300)]
rustc: Remove the unnecessary ast_ty_to_ty_cache.

8 years agorustc: More interning for data used in Ty<'tcx>.
Eduard Burtescu [Fri, 29 Apr 2016 05:30:54 +0000 (08:30 +0300)]
rustc: More interning for data used in Ty<'tcx>.

8 years agorustc: Generalize a minimum set of functions over 'tcx != 'gcx.
Eduard Burtescu [Fri, 29 Apr 2016 03:00:23 +0000 (06:00 +0300)]
rustc: Generalize a minimum set of functions over 'tcx != 'gcx.

8 years agorustc: Remove a redundant lifetime parameter from ExprUseVisitor.
Eduard Burtescu [Fri, 25 Mar 2016 03:37:04 +0000 (05:37 +0200)]
rustc: Remove a redundant lifetime parameter from ExprUseVisitor.

8 years agorustc: Wrap users of InferCtxt in an anonymous scope.
Eduard Burtescu [Fri, 25 Mar 2016 03:22:44 +0000 (05:22 +0200)]
rustc: Wrap users of InferCtxt in an anonymous scope.

8 years agorustc: Remove the TyCtxt field from ParameterEnvironment.
Eduard Burtescu [Fri, 25 Mar 2016 03:22:52 +0000 (05:22 +0200)]
rustc: Remove the TyCtxt field from ParameterEnvironment.

8 years agorustc_typeck: Use Deref for FnCtxt, Inherited and InferCtxt fields and methods.
Eduard Burtescu [Thu, 24 Mar 2016 16:49:04 +0000 (18:49 +0200)]
rustc_typeck: Use Deref for FnCtxt, Inherited and InferCtxt fields and methods.

8 years agorustc: Split 'tcx into 'gcx and 'tcx for InferCtxt and its users.
Eduard Burtescu [Tue, 3 May 2016 02:23:22 +0000 (05:23 +0300)]
rustc: Split 'tcx into 'gcx and 'tcx for InferCtxt and its users.

8 years agorustc: Keep a reference to the interners in TyCtxt.
Eduard Burtescu [Thu, 28 Apr 2016 00:13:17 +0000 (03:13 +0300)]
rustc: Keep a reference to the interners in TyCtxt.

8 years agorustc: Use set recovery APIs in the TyCtxt interners.
Eduard Burtescu [Wed, 23 Mar 2016 02:56:49 +0000 (04:56 +0200)]
rustc: Use set recovery APIs in the TyCtxt interners.

8 years agorustc: Replace &'a TyCtxt<'tcx> with a TyCtxt<'a, 'tcx> wrapper.
Eduard Burtescu [Tue, 3 May 2016 01:56:42 +0000 (04:56 +0300)]
rustc: Replace &'a TyCtxt<'tcx> with a TyCtxt<'a, 'tcx> wrapper.

8 years agoregionck: Use methods on RegionCtxt instead of free functions.
Eduard Burtescu [Wed, 16 Mar 2016 23:10:22 +0000 (01:10 +0200)]
regionck: Use methods on RegionCtxt instead of free functions.

8 years agorustc: Avoid free functions taking &TyCtxt and &InferCtxt.
Eduard Burtescu [Wed, 16 Mar 2016 22:15:31 +0000 (00:15 +0200)]
rustc: Avoid free functions taking &TyCtxt and &InferCtxt.

8 years agotypeck: Turn everything operating on FnCtxt into a method.
Eduard Burtescu [Sat, 12 Mar 2016 01:06:24 +0000 (03:06 +0200)]
typeck: Turn everything operating on FnCtxt into a method.

8 years agotypeck: Avoid passing &TyCtxt around where possible.
Eduard Burtescu [Fri, 11 Mar 2016 14:33:42 +0000 (16:33 +0200)]
typeck: Avoid passing &TyCtxt around where possible.

8 years agotypeck: merge CollectCtxt and collect::CollectCtxt.
Eduard Burtescu [Fri, 11 Mar 2016 14:29:12 +0000 (16:29 +0200)]
typeck: merge CollectCtxt and collect::CollectCtxt.

8 years agomem_categorization: freely_aliasable doesn't need to take TyCtxt.
Eduard Burtescu [Fri, 11 Mar 2016 00:33:46 +0000 (02:33 +0200)]
mem_categorization: freely_aliasable doesn't need to take TyCtxt.

8 years agoinfer: Turn normalize_associated_type into a method on TyCtxt.
Eduard Burtescu [Fri, 11 Mar 2016 00:33:20 +0000 (02:33 +0200)]
infer: Turn normalize_associated_type into a method on TyCtxt.

8 years agoinfer: Use methods for creating an InferCtxt.
Eduard Burtescu [Fri, 11 Mar 2016 00:31:38 +0000 (02:31 +0200)]
infer: Use methods for creating an InferCtxt.

8 years agorustc: Always refer to TyCtxt as tcx.
Eduard Burtescu [Tue, 3 May 2016 01:02:41 +0000 (04:02 +0300)]
rustc: Always refer to TyCtxt as tcx.

8 years agoDoc improvement on std::fmt module
Guillaume Gomez [Sun, 1 May 2016 12:04:13 +0000 (14:04 +0200)]
Doc improvement on std::fmt module

8 years agoAuto merge of #33319 - birkenfeld:issue31424, r=jseyfried
bors [Tue, 10 May 2016 21:36:46 +0000 (14:36 -0700)]
Auto merge of #33319 - birkenfeld:issue31424, r=jseyfried

borrowck: do not suggest to change "&mut self" to "&mut mut self"

Matching the snippet string might not be the cleanest, but matching
the AST node instead seems to end in a lot of nested `if let`s, so I
don't know what's better.

Of course it's entirely possible that there is another API altogether
that I just don't know of?

Fixes #31424.

8 years agoAuto merge of #33488 - eddyb:trans-fixes, r=Aatch
bors [Tue, 10 May 2016 17:40:02 +0000 (10:40 -0700)]
Auto merge of #33488 - eddyb:trans-fixes, r=Aatch

Fix several -Z orbit crater blockers.

Fixes 3 of the issues found by @nikomatsakis' crater run with `-Z orbit` forced on:
https://gist.github.com/nikomatsakis/6688c30a0e5d3fed07cc1ebd4efb1412

Two of the regressions seemed to be fixed by #33130 and the remaining two are timeouts.

8 years agoborrowck: do not suggest to change "&mut self" to "&mut mut self"
Georg Brandl [Sun, 1 May 2016 18:18:04 +0000 (20:18 +0200)]
borrowck: do not suggest to change "&mut self" to "&mut mut self"

Matching the snippet string might not be the cleanest, but matching
the AST node instead seems to end in a lot of nested `if let`s...

Fixes #31424.

8 years agoAuto merge of #33471 - birkenfeld:issue-33464, r=jseyfried
bors [Tue, 10 May 2016 12:22:17 +0000 (05:22 -0700)]
Auto merge of #33471 - birkenfeld:issue-33464, r=jseyfried

resolve: do not modify span of non-importable name

This span modification is probably leftover from a time when import spans were assigned differently.

With this change, error spans for the following are properly reported:

```
use abc::one_el;
use abc::{a, bbb, cccccc};
use a_very_long_name::{el, el2};
```

before (spans only):
```
x.rs:3 use abc::one_el;
           ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                 ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                    ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                         ^~~
(internal compiler error: unprintable span)
(internal compiler error: unprintable span)
```

after:
```
x.rs:3 use abc::one_el;
           ^~~~~~~~~~~
x.rs:4 use abc::{a, bbb, cccccc};
                 ^
x.rs:4 use abc::{a, bbb, cccccc};
                    ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                         ^~~~~~
x.rs:5 use a_very_long_name::{el, el2};
                              ^~
x.rs:5 use a_very_long_name::{el, el2};
                                  ^~~
```

Fixes: #33464
8 years agoAuto merge of #33337 - birkenfeld:issue-27842, r=jseyfried
bors [Tue, 10 May 2016 10:06:05 +0000 (03:06 -0700)]
Auto merge of #33337 - birkenfeld:issue-27842, r=jseyfried

typeck: show a note about tuple indexing for erroneous tup[i]

Fixes: #27842
8 years agoAuto merge of #33473 - michaelwoerister:split-cratecontext, r=nikomatsakis
bors [Tue, 10 May 2016 06:50:10 +0000 (23:50 -0700)]
Auto merge of #33473 - michaelwoerister:split-cratecontext, r=nikomatsakis

Preparatory refactorings for collector-driven trans.

This is a set of refactorings that allows to do translation item collection and partitioning before LocalCrateContext instances or LLVM modules are generated. As a consequence we can now create LocalCrateContexts already with knowledge of the codegen unit it will be used for. This is a preparation step for driving trans by the results of codegen unit partitioning.

8 years agoresolve: do not modify span of non-importable name
Georg Brandl [Fri, 6 May 2016 17:26:30 +0000 (19:26 +0200)]
resolve: do not modify span of non-importable name

This span modification is probably leftover from a time when
import spans were assigned differently.

With this change, error spans for the following are properly reported:

```
use abc::one_el;
use abc::{a, bbb, cccccc};
use a_very_long_name::{el, el2};
```

before (spans only):
```
x.rs:3 use abc::one_el;
           ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                 ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                    ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                         ^~~
(internal compiler error: unprintable span)
(internal compiler error: unprintable span)
```

after:
```
x.rs:3 use abc::one_el;
           ^~~~~~~~~~~
x.rs:4 use abc::{a, bbb, cccccc};
                 ^
x.rs:4 use abc::{a, bbb, cccccc};
                    ^~~
x.rs:4 use abc::{a, bbb, cccccc};
                         ^~~~~~
x.rs:5 use a_very_long_name::{el, el2};
                              ^~
x.rs:5 use a_very_long_name::{el, el2};
                                  ^~~
```

Fixes: #33464
8 years agoAuto merge of #33443 - jseyfried:resolve_ast, r=nrc
bors [Tue, 10 May 2016 04:31:55 +0000 (21:31 -0700)]
Auto merge of #33443 - jseyfried:resolve_ast, r=nrc

Perform name resolution before and during ast->hir lowering

This PR performs name resolution before and during ast->hir lowering instead of in phase 3.
r? @nrc

8 years agoAuto merge of #32900 - alexcrichton:panic2abort, r=nikomatsakis
bors [Tue, 10 May 2016 01:23:48 +0000 (18:23 -0700)]
Auto merge of #32900 - alexcrichton:panic2abort, r=nikomatsakis

rustc: Implement custom panic runtimes

This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.

[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md

Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.

With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.

Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).

Closes #32837

8 years agorustc: Use C++ personalities on MSVC
Alex Crichton [Tue, 26 Apr 2016 21:30:01 +0000 (14:30 -0700)]
rustc: Use C++ personalities on MSVC

Currently the compiler has two relatively critical bugs in the implementation of
MSVC unwinding:

* #33112 - faults like segfaults and illegal instructions will run destructors
           in Rust, meaning we keep running code after a super-fatal exception
           has happened.

* #33116 - When compiling with LTO plus `-Z no-landing-pads` (or `-C
           panic=abort` with the previous commit) LLVM won't remove all `invoke`
           instructions, meaning that some landing pads stick around and
           cleanups may be run due to the previous bug.

These both stem from the flavor of "personality function" that Rust uses for
unwinding on MSVC. On 32-bit this is `_except_handler3` and on 64-bit this is
`__C_specific_handler`, but they both essentially are the "most generic"
personality functions for catching exceptions and running cleanups. That is,
thse two personalities will run cleanups for all exceptions unconditionally, so
when we use them we run cleanups for **all SEH exceptions** (include things like
segfaults).

Note that this also explains why LLVM won't optimize away `invoke` instructions.
These functions can legitimately still unwind (the `nounwind` attribute only
seems to apply to "C++ exception-like unwining"). Also note that the standard
library only *catches* Rust exceptions, not others like segfaults and illegal
instructions.

LLVM has support for another personality, `__CxxFrameHandler3`, which does not
run cleanups for general exceptions, only C++ exceptions thrown by
`_CxxThrowException`. This essentially ideally matches our use case, so this
commit moves us over to using this well-known personality function as well as
exception-throwing function.

This doesn't *seem* to pull in any extra runtime dependencies just yet, but if
it does we can perhaps try to work out how to implement more of it in Rust
rather than relying on MSVCRT runtime bits.

More details about how this is actually implemented can be found in the changes
itself, but this...

Closes #33112
Closes #33116

8 years agoAuto merge of #33523 - Manishearth:rollup, r=Manishearth
bors [Mon, 9 May 2016 23:11:51 +0000 (16:11 -0700)]
Auto merge of #33523 - Manishearth:rollup, r=Manishearth

Rollup of 10 pull requests

- Successful merges: #33129, #33224, #33370, #33383, #33431, #33474, #33480, #33496, #33509, #33514
- Failed merges:

8 years agoRollup merge of #33493 - Manishearth:more-diag, r=Manishearth
Manish Goregaokar [Mon, 9 May 2016 22:00:14 +0000 (15:00 -0700)]
Rollup merge of #33493 - Manishearth:more-diag, r=Manishearth

 r? @GuillaumeGomez

8 years agoRollup merge of #33514 - birkenfeld:issue-29503, r=alexcrichton
Manish Goregaokar [Mon, 9 May 2016 19:50:22 +0000 (12:50 -0700)]
Rollup merge of #33514 - birkenfeld:issue-29503, r=alexcrichton

rustdoc: do not strip blanket impls in crate of origin

In `impl<T> Trait for T`, the blanket type parameters `T` were recognized as "local" and "not exported", so these impls were thrown out.

Now we check if they are generic, and keep them in that case.

Fixes: #29503
8 years agoRollup merge of #33509 - birkenfeld:issue-30219, r=alexcrichton
Manish Goregaokar [Mon, 9 May 2016 19:50:22 +0000 (12:50 -0700)]
Rollup merge of #33509 - birkenfeld:issue-30219, r=alexcrichton

rustdoc: fix emitting duplicate implementors in .js files

The collect() fn checks for double quotes; use them here as well.

Fixes: #30219
8 years agoRollup merge of #33496 - silvo38:master, r=apasel422
Manish Goregaokar [Mon, 9 May 2016 19:50:22 +0000 (12:50 -0700)]
Rollup merge of #33496 - silvo38:master, r=apasel422

Fix minor typo in E0312

8 years agoRollup merge of #33480 - birkenfeld:issue-33422, r=steveklabnik
Manish Goregaokar [Mon, 9 May 2016 19:50:21 +0000 (12:50 -0700)]
Rollup merge of #33480 - birkenfeld:issue-33422, r=steveklabnik

book: fixup code in error handling tutorial

A few oversights happened while porting the example from docopt to getopts.  I retraced all the steps, fixing code and description as necessary.

Fixes: #33422
8 years agoRollup merge of #33474 - frewsxcv:unwrap-err, r=alexcrichton
Manish Goregaokar [Mon, 9 May 2016 19:50:21 +0000 (12:50 -0700)]
Rollup merge of #33474 - frewsxcv:unwrap-err, r=alexcrichton

Utilize `Result::unwrap_err` in more places.

None

8 years agoRollup merge of #33431 - GuillaumeGomez:issue-30416, r=steveklabnik
Manish Goregaokar [Mon, 9 May 2016 19:50:21 +0000 (12:50 -0700)]
Rollup merge of #33431 - GuillaumeGomez:issue-30416, r=steveklabnik

Update CSS for future rustdoc merge

cc #33382

r? @steveklabnik
cc @Manishearth
cc @birkenfeld

8 years agoRollup merge of #33383 - cramertj:E0509, r=Manishearth
Manish Goregaokar [Mon, 9 May 2016 19:50:21 +0000 (12:50 -0700)]
Rollup merge of #33383 - cramertj:E0509, r=Manishearth

Add detailed error explanation for E0509

Part of #32777

8 years agoRollup merge of #33370 - aochagavia:dump, r=nrc
Manish Goregaokar [Mon, 9 May 2016 19:50:21 +0000 (12:50 -0700)]
Rollup merge of #33370 - aochagavia:dump, r=nrc

save-analysis: use a decoupled representation for dumped data

Closes #33348

This will probably break any tool relying on the csv backend of save_analysis, for the following reasons:

1. Dumped spans don't contain extents anymore (`Dump` uses `SpanData` now instead of internal `Span`s). In case we still want to dump extents we could add them to `SpanData`.
1. `DefId`s are no longer dumped as a pair of `(ref_id, ref_crate)`. Instead, they are dumped as a single `Id`.

@nrc You said something about storing the id in a `u64`, but you didn't explain why. I kept using `u32` in this branch but I can change it if you prefer that.

r? @nrc

By the way, the fact that this breaks tools relying on CSV may be a good occasion to start dumping CSV in a different way (i.e. using the serializer like in the JSON backend).

8 years agoRollup merge of #33224 - alexcrichton:create-exit-status, r=aturon
Manish Goregaokar [Mon, 9 May 2016 19:50:20 +0000 (12:50 -0700)]
Rollup merge of #33224 - alexcrichton:create-exit-status, r=aturon

std: Allow creating ExitStatus from raw values

Sometimes a process may be waited on externally from the standard library, in
which case it can be useful to create a raw `ExitStatus` structure to return.
This commit extends the existing Unix `ExitStatusExt` extension trait and adds a
new Windows-specific `ExitStatusExt` extension trait to do this. The methods are
currently called `ExitStatus::from_raw`.

cc #32713

8 years agoAuto merge of #33224 - alexcrichton:create-exit-status, r=aturon
bors [Mon, 9 May 2016 21:04:08 +0000 (14:04 -0700)]
Auto merge of #33224 - alexcrichton:create-exit-status, r=aturon

std: Allow creating ExitStatus from raw values

Sometimes a process may be waited on externally from the standard library, in
which case it can be useful to create a raw `ExitStatus` structure to return.
This commit extends the existing Unix `ExitStatusExt` extension trait and adds a
new Windows-specific `ExitStatusExt` extension trait to do this. The methods are
currently called `ExitStatus::from_raw`.

cc #32713

8 years agorustdoc: remove artificial indentation of doctest code
Georg Brandl [Mon, 9 May 2016 13:30:24 +0000 (15:30 +0200)]
rustdoc: remove artificial indentation of doctest code

This makes the examples look nicer when printed (when is this
done?), but breaks tests using multi-line string literals.

Fixes: #25944
8 years agoFix some rebasing fallout.
Michael Woerister [Mon, 9 May 2016 20:15:04 +0000 (16:15 -0400)]
Fix some rebasing fallout.

8 years agotrans::context: Remove some tcx::tls wackiness
Michael Woerister [Fri, 6 May 2016 21:09:18 +0000 (17:09 -0400)]
trans::context: Remove some tcx::tls wackiness

8 years agotrans: Consistently name SharedCrateContext instances 'scx'
Michael Woerister [Fri, 6 May 2016 21:07:36 +0000 (17:07 -0400)]
trans: Consistently name SharedCrateContext instances 'scx'

8 years agoMake FixedCount partitioning handle case where codegen units have to be added.
Michael Woerister [Fri, 6 May 2016 21:00:59 +0000 (17:00 -0400)]
Make FixedCount partitioning handle case where codegen units have to be added.

8 years agotrans: Add some explanatory comments to trans::context types.
Michael Woerister [Fri, 6 May 2016 20:53:59 +0000 (16:53 -0400)]
trans: Add some explanatory comments to trans::context types.

8 years agotrans: Make partitioning available in LocalCrateContext.
Michael Woerister [Fri, 6 May 2016 19:21:17 +0000 (15:21 -0400)]
trans: Make partitioning available in LocalCrateContext.

8 years agoRestructure trans_crate() so that codegen unit partitioning happens before creating...
Michael Woerister [Fri, 6 May 2016 18:27:34 +0000 (14:27 -0400)]
Restructure trans_crate() so that codegen unit partitioning happens before creating LocalCrateContexts.

8 years agoMake trans::collector only depend on SharedCrateContext.
Michael Woerister [Fri, 6 May 2016 17:33:14 +0000 (13:33 -0400)]
Make trans::collector only depend on SharedCrateContext.

8 years agotrans: Make glue::get_drop_glue_type() independent of CrateContext.
Michael Woerister [Fri, 6 May 2016 05:23:44 +0000 (01:23 -0400)]
trans: Make glue::get_drop_glue_type() independent of CrateContext.

8 years agotrans: Make base::custom_coerce_unsize_info only depend on SharedCrateContext.
Michael Woerister [Fri, 6 May 2016 04:55:53 +0000 (00:55 -0400)]
trans: Make base::custom_coerce_unsize_info only depend on SharedCrateContext.

8 years agotrans: Make common::fulfill_obligation only depend on SharedCrateContext.
Michael Woerister [Fri, 6 May 2016 04:47:28 +0000 (00:47 -0400)]
trans: Make common::fulfill_obligation only depend on SharedCrateContext.

Plus make it produce a nicer dependency graph via DepTrackingMap::memoize().

8 years agotrans: Make various trans::collector functions independent of CrateContext.
Michael Woerister [Thu, 5 May 2016 18:59:16 +0000 (14:59 -0400)]
trans: Make various trans::collector functions independent of CrateContext.

8 years agotrans: Make meth::get_vtable_methods() not depend on CrateContext.
Michael Woerister [Thu, 5 May 2016 18:32:59 +0000 (14:32 -0400)]
trans: Make meth::get_vtable_methods() not depend on CrateContext.

8 years agotrans: Make normalize_and_test_predicates() not depend on CrateContext.
Michael Woerister [Thu, 5 May 2016 18:29:02 +0000 (14:29 -0400)]
trans: Make normalize_and_test_predicates() not depend on CrateContext.

8 years agoMake trans::collector item printing methods independent of CrateContext.
Michael Woerister [Thu, 5 May 2016 18:24:41 +0000 (14:24 -0400)]
Make trans::collector item printing methods independent of CrateContext.

8 years agotrans: Split LocalCrateContext ownership out of SharedCrateContext.
Michael Woerister [Thu, 5 May 2016 18:14:41 +0000 (14:14 -0400)]
trans: Split LocalCrateContext ownership out of SharedCrateContext.

8 years agotrans: deal with the fact that ZSTs are always "initialized".
Eduard Burtescu [Sat, 7 May 2016 19:59:03 +0000 (22:59 +0300)]
trans: deal with the fact that ZSTs are always "initialized".

8 years agotrans: monomorphize varidiac call argument types.
Eduard Burtescu [Mon, 9 May 2016 19:52:01 +0000 (22:52 +0300)]
trans: monomorphize varidiac call argument types.

8 years agoAuto merge of #33457 - oli-obk:const_err/cast_u8_ptr, r=eddyb
bors [Mon, 9 May 2016 17:57:35 +0000 (10:57 -0700)]
Auto merge of #33457 - oli-obk:const_err/cast_u8_ptr, r=eddyb

casting `&[u8]` to `* const u8` doesn't work in const_eval

fixes #33452

r? @eddyb

cc @Ms2ger

8 years agoAuto merge of #33048 - Amanieu:integer_atomics, r=alexcrichton
bors [Mon, 9 May 2016 15:48:58 +0000 (08:48 -0700)]
Auto merge of #33048 - Amanieu:integer_atomics, r=alexcrichton

Add integer atomic types

Tracking issue: #32976
RFC: rust-lang/rfcs#1543

The changes to AtomicBool in the RFC are not included, they are in a separate PR (#32365).

8 years agorustc: Implement custom panic runtimes
Alex Crichton [Fri, 8 Apr 2016 23:18:40 +0000 (16:18 -0700)]
rustc: Implement custom panic runtimes

This commit is an implementation of [RFC 1513] which allows applications to
alter the behavior of panics at compile time. A new compiler flag, `-C panic`,
is added and accepts the values `unwind` or `panic`, with the default being
`unwind`. This model affects how code is generated for the local crate, skipping
generation of landing pads with `-C panic=abort`.

[RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md

Panic implementations are then provided by crates tagged with
`#![panic_runtime]` and lazily required by crates with
`#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic
runtime must match the final product, and if the panic strategy is not `abort`
then the entire DAG must have the same panic strategy.

With the `-C panic=abort` strategy, users can expect a stable method to disable
generation of landing pads, improving optimization in niche scenarios,
decreasing compile time, and decreasing output binary size. With the `-C
panic=unwind` strategy users can expect the existing ability to isolate failure
in Rust code from the outside world.

Organizationally, this commit dismantles the `sys_common::unwind` module in
favor of some bits moving part of it to `libpanic_unwind` and the rest into the
`panicking` module in libstd. The custom panic runtime support is pretty similar
to the custom allocator support with the only major difference being how the
panic runtime is injected (takes the `-C panic` flag into account).

8 years agorustdoc: do not strip blanket impls in crate of origin
Georg Brandl [Mon, 9 May 2016 14:48:02 +0000 (16:48 +0200)]
rustdoc: do not strip blanket impls in crate of origin

In `impl<T> Trait for T`, the blanket type parameters `T` were
recognized as "local" and "not exported", so these impls were
thrown out.

Now we check if they are generic, and keep them in that case.

Fixes: #29503
8 years agoAuto merge of #33484 - murarth:diagnostic-builder-fields, r=brson
bors [Mon, 9 May 2016 13:40:56 +0000 (06:40 -0700)]
Auto merge of #33484 - murarth:diagnostic-builder-fields, r=brson

Add accessor methods to DiagnosticBuilder

8 years agoUtilize `Result::unwrap_err` in more places.
Corey Farwell [Fri, 6 May 2016 23:32:18 +0000 (19:32 -0400)]
Utilize `Result::unwrap_err` in more places.

8 years agoAdd test to ensure that atomic types are lock-free
Amanieu d'Antras [Sun, 17 Apr 2016 11:49:26 +0000 (12:49 +0100)]
Add test to ensure that atomic types are lock-free

8 years agoAdd new atomic integer types
Amanieu d'Antras [Sat, 16 Apr 2016 04:21:53 +0000 (05:21 +0100)]
Add new atomic integer types

8 years agoAdd #[cfg(target_has_atomic)] to get atomic support for the current target
Amanieu d'Antras [Fri, 15 Apr 2016 19:16:19 +0000 (20:16 +0100)]
Add #[cfg(target_has_atomic)] to get atomic support for the current target

8 years agoFix fallout in `librustdoc` and in tests
Jeffrey Seyfried [Sun, 8 May 2016 04:18:55 +0000 (04:18 +0000)]
Fix fallout in `librustdoc` and in tests

8 years agoAuto merge of #33478 - xen0n:normalize-callee-trait-ref, r=eddyb
bors [Mon, 9 May 2016 11:32:39 +0000 (04:32 -0700)]
Auto merge of #33478 - xen0n:normalize-callee-trait-ref, r=eddyb

trans: callee: normalize trait_ref before use

This fixes #33436 and #33461. Ran the tests and nothing else seems to be affected.

P.S. How to write the regression test for this fix? Does this qualify as run-pass or run-make, as the test only needs to be successfully compiled to be considered passed? Will add the testcase (the minimal example in #33461 seems fit) after clarifying this.

8 years agoRefactor out `driver::lower_and_resolve`
Jeffrey Seyfried [Sun, 8 May 2016 03:32:42 +0000 (03:32 +0000)]
Refactor out `driver::lower_and_resolve`

8 years agoRefactor `hir::lowering::Resolver`
Jeffrey Seyfried [Fri, 6 May 2016 08:24:04 +0000 (08:24 +0000)]
Refactor `hir::lowering::Resolver`

8 years agorustdoc: fix emitting duplicate implementors in .js files
Georg Brandl [Mon, 9 May 2016 08:18:06 +0000 (10:18 +0200)]
rustdoc: fix emitting duplicate implementors in .js files

The collect() fn checks for double quotes; use them here as well.

Fixes: #30219
8 years agoMerge E0410 into E0408
Manish Goregaokar [Fri, 6 May 2016 15:12:23 +0000 (20:42 +0530)]
Merge E0410 into E0408

8 years agotrans: monomorphize the cast destination type before using it.
Eduard Burtescu [Sat, 7 May 2016 17:00:42 +0000 (20:00 +0300)]
trans: monomorphize the cast destination type before using it.

8 years agoAuto merge of #33365 - birkenfeld:makehelpfix, r=alexcrichton
bors [Mon, 9 May 2016 03:07:10 +0000 (20:07 -0700)]
Auto merge of #33365 - birkenfeld:makehelpfix, r=alexcrichton

Makefile: there is only one tidy target now

Also removes mention of tidy.py from the tidy sources.

8 years agoReimplement pretty printing
Jeffrey Seyfried [Thu, 5 May 2016 08:54:18 +0000 (08:54 +0000)]
Reimplement pretty printing

8 years agoResolve paths generated in the ast->hir lowerer
Jeffrey Seyfried [Mon, 2 May 2016 23:26:18 +0000 (23:26 +0000)]
Resolve paths generated in the ast->hir lowerer

8 years agoRefactor the interface that `resolve` exposes to `driver`
Jeffrey Seyfried [Wed, 4 May 2016 06:00:27 +0000 (06:00 +0000)]
Refactor the interface that `resolve` exposes to `driver`

8 years agoMove resolution to before lowering
Jeffrey Seyfried [Sun, 24 Apr 2016 03:26:10 +0000 (03:26 +0000)]
Move resolution to before lowering

8 years agoAuto merge of #33360 - alexcrichton:rustbuild-dox, r=brson
bors [Mon, 9 May 2016 00:58:54 +0000 (17:58 -0700)]
Auto merge of #33360 - alexcrichton:rustbuild-dox, r=brson

rustbuild: Document many more parts of the build

This commit expands the bootstrap build system's `README.md` as well as ensuring
that all API documentation is present and up-to-date. Additionally a new
`config.toml.example` file is checked in with commented out versions of all
possible configuration values.

8 years agoTemporarily unimplement pretty printing
Jeffrey Seyfried [Fri, 22 Apr 2016 23:21:57 +0000 (23:21 +0000)]
Temporarily unimplement pretty printing

8 years agoRefactor `Resolver` field `def_map` from `RefCell<DefMap>` to `DefMap`
Jeffrey Seyfried [Tue, 3 May 2016 20:44:27 +0000 (20:44 +0000)]
Refactor `Resolver` field `def_map` from `RefCell<DefMap>` to `DefMap`

8 years agoRemove a use of `ast_map.span_if_local()` in `resolve`
Jeffrey Seyfried [Thu, 5 May 2016 20:20:23 +0000 (20:20 +0000)]
Remove a use of `ast_map.span_if_local()` in `resolve`

8 years agoAuto merge of #33288 - cyplo:32834_retry_download, r=alexcrichton
bors [Sun, 8 May 2016 21:57:57 +0000 (14:57 -0700)]
Auto merge of #33288 - cyplo:32834_retry_download, r=alexcrichton

Get a file during bootstrap to a temp location first.

When downloading a file in the bootstrap phase - get it to a temp
location first. Verify it there and only if downloaded properly move it
to the `cache` directory.

This should prevent `make` being stuck if the download was interrupted
or otherwise corrupted, as per discussion in #32834

The temporary files are deleted in case of an exception.

I was looking for some unit/integration tests around this and couldn't find any - presumably because this is being tested by just Travis launching it ? Let me know if it would be good to try to write tests around this. Thanks !

8 years agoMerge pull request #1 from nrc/save-ids-fix
Adolfo OchagavĂ­a [Sun, 8 May 2016 17:57:12 +0000 (19:57 +0200)]
Merge pull request #1 from nrc/save-ids-fix

Save ids fix

8 years agoAdd E0408/E0409
Manish Goregaokar [Fri, 6 May 2016 14:50:04 +0000 (20:20 +0530)]
Add E0408/E0409

8 years agoAuto merge of #33414 - Nercury:master, r=alexcrichton
bors [Sun, 8 May 2016 16:13:19 +0000 (09:13 -0700)]
Auto merge of #33414 - Nercury:master, r=alexcrichton

Add armv7-linux-androideabi target

This PR adds `armv7-linux-androideabi` target that matches `armeabi-v7a` Android ABI, ~~downscales `arm-linux-androideabi` target to match `armeabi` Android ABI~~ (TBD later if needed).

This should allow us to get the best performance from every [Android ABI level](http://developer.android.com/ndk/guides/abis.html).

Currently existing target `arm-linux-androideabi` started gaining features out of the supported range of [android `armeabi`](http://developer.android.com/ndk/guides/abis.html). While android compiler does not use a different target for later supported `armv7` architecture, it has distinct ABI name `armeabi-v7a`. We decided to add rust target `armv7-linux-androideabi` to match it.

Note that `NEON`, `VFPv3-D32`, and `ThumbEE` instruction sets are not added, because not all android devices are guaranteed to support all or some of these, and [their availability should be checked at runtime](http://developer.android.com/ndk/guides/abis.html#v7a).

~~This reduces performance of existing `arm-linux-androideabi` and may make it _much_ slower (we are talking more than order of magnitude in some random ad-hoc fp benchmark that I did).~~

Part of #33278.

8 years agoAuto merge of #33494 - Manishearth:rollup, r=Manishearth
bors [Sun, 8 May 2016 14:04:17 +0000 (07:04 -0700)]
Auto merge of #33494 - Manishearth:rollup, r=Manishearth

Rollup of 8 pull requests

- Successful merges: #33369, #33373, #33404, #33406, #33420, #33424, #33426, #33473
- Failed merges: