Commit Graph

59288 Commits

Author SHA1 Message Date
bors
dc81742b18 Auto merge of #38047 - canndrew:fmt-void-non-empty, r=bluss
Make core::fmt::Void a non-empty type.

Adding back this change that was removed from PR #36449 because it's a fix and because I immediately hit a problem with it again when I started implementing my fix for #12609.
2016-11-30 23:40:10 +00:00
Jeffrey Seyfried
ff621ec70e Add tests. 2016-11-30 23:17:56 +00:00
Jeffrey Seyfried
ed9a09d40c Support paths in macro invocations. 2016-11-30 22:54:40 +00:00
Michael Woerister
29a6ffa401 incr.comp.: Add more output to -Z incremental-info. 2016-11-30 17:33:52 -05:00
Theodore DeRego
8d9d07a1ca Removed Option<ExitStatus> member from fuchsia Process struct. Destroy launchpads and close handles in Drop impls rather than manually 2016-11-30 14:20:44 -08:00
Jeffrey Seyfried
29791ada1d Minor cleanup. 2016-11-30 21:19:46 +00:00
Felix S. Klock II
ff1ba6a505 Adds -Z mir-stats, which is similar to -Z hir-stats.
Some notes:

* This code attempts to present the breakdown of each variant for
  every enum in the MIR. This is meant to guide decisions about how to
  revise representations e.g. when to box payloads for rare variants
  to shrink the size of the enum overall.

* I left out the "Total:" line that hir-stats presents, because this
  implementation uses the MIR Visitor infrastructure, and the memory
  usage of structures directly embedded in other structures (e.g. the
  `func: Operand` in a `TerminatorKind:Call`) is not distinguished
  from similar structures allocated in a `Vec` (e.g. the `args:
  Vec<Operand>` in a `TerminatorKind::Call`). This means that a naive
  summation of all the accumulated sizes is misleading, because it
  will double-count the contribution of the `Operand` of the `func` as
  well as the size of the whole `TerminatorKind`.

  * I did consider abandoning the MIR Visitor and instead hand-coding
    a traversal that distinguished embedded storage from indirect
    storage. But such code would be fragile; better to just require
    people to take care when interpreting the presented results.

* This traverses the `mir.promoted` rvalues to capture stats for MIR
  stored there, even though the MIR visitor super_mir method does not
  do so. (I did not observe any new mir being traversed when compiling
  the rustc crate, however.)

* It might be nice to try to unify this code with hir-stats.  Then
  again, the reporting portion is the only common code (I think), and
  it is small compared to the visitors in hir-stats and mir-stats.
2016-11-30 21:33:18 +01:00
bors
ecff71a45c Auto merge of #37800 - alexcrichton:new-bootstrap, r=eddyb
Update the bootstrap compiler

Now that we've got a beta build, let's use it!
2016-11-30 19:17:24 +00:00
Alex Crichton
2186660b51 Update the bootstrap compiler
Now that we've got a beta build, let's use it!
2016-11-30 10:38:08 -08:00
Guillaume Gomez
8e6ae19bb5 Add cloned example for Option 2016-11-30 09:44:33 -08:00
Michael Woerister
a15d2dbef6 debuginfo: Ignore macro-stepping test on aarch64 2016-11-30 12:17:38 -05:00
bors
5a0248068c Auto merge of #38014 - jseyfried:refactor_path_resolution, r=nrc
resolve: refactor path resolution

This is a pure refactoring, modulo minor diagnostics improvements.
r? @nrc
2016-11-30 16:02:18 +00:00
Johannes Oertel
7cbd18a690 Remove the unmarked_api feature
Closes #37981.
2016-11-30 15:51:04 +01:00
Mark-Simulacrum
d21861dd89 Refactor one_bound_for_assoc_type to take an Iterator instead of Vec. 2016-11-30 07:16:34 -07:00
bors
5db4826410 Auto merge of #37989 - nrc:save-mod, r=nikomatsakis
save-analysis: redirect a module decl to the start of the defining file
2016-11-30 12:50:09 +00:00
Sébastien Marie
75927569fb Add i686-unknown-openbsd target. 2016-11-30 11:51:54 +01:00
Ruud van Asseldonk
3be2c3b309 Move small-copy optimization into <&[u8] as Read>
Based on the discussion in https://github.com/rust-lang/rust/pull/37573,
it is likely better to keep this limited to std::io, instead of
modifying a function which users expect to be a memcpy.
2016-11-30 11:09:29 +01:00
Ruud van Asseldonk
341805288e Move small-copy optimization into copy_from_slice
Ultimately copy_from_slice is being a bottleneck, not io::Cursor::read.
It might be worthwhile to move the check here, so more places can
benefit from it.
2016-11-30 11:09:29 +01:00
Ruud van Asseldonk
cd7fade0a9 Add small-copy optimization for io::Cursor
During benchmarking, I found that one of my programs spent between 5 and
10 percent of the time doing memmoves. Ultimately I tracked these down
to single-byte slices being copied with a memcopy in io::Cursor::read().
Doing a manual copy if only one byte is requested can speed things up
significantly. For my program, this reduced the running time by 20%.

Why special-case only a single byte, and not a "small" slice in general?
I tried doing this for slices of at most 64 bytes and of at most 8
bytes. In both cases my test program was significantly slower.
2016-11-30 11:09:29 +01:00
bors
3abaf43f77 Auto merge of #37954 - eddyb:rustdoc-2, r=alexcrichton
rustdoc: link to cross-crate sources directly.

Fixes #37684 by implementing proper support for getting the `Span` of definitions across crates.
In rustdoc this is used to generate direct links to the original source instead of fragile redirects.

This functionality could be expanded further for making error reporting code more uniform and seamless across crates, although at the moment there is no actual source to print, only file/line/column information.

Closes #37870 which is also "fixes" #37684 by throwing away the builtin macro docs from libcore.
After this lands, #37727 could be reverted, although it doesn't matter much either way.
2016-11-30 07:46:00 +00:00
Guillaume Gomez
336e5dd33d Add missing examples for IpAddr enum 2016-11-29 19:44:53 -08:00
Eduard-Mihai Burtescu
900191891f rustdoc: link to cross-crate sources directly. 2016-11-30 04:48:56 +02:00
Eduard-Mihai Burtescu
177913b49c rustc: track the Span's of definitions across crates. 2016-11-30 04:48:56 +02:00
bors
8e373b4787 Auto merge of #37965 - Mark-Simulacrum:trait-obj-to-exis-predicate, r=eddyb
Refactor TraitObject to Slice<ExistentialPredicate>

For reference, the primary types changes in this PR are shown below. They may add in the understanding of what is discussed below, though they should not be required.

We change `TraitObject` into a list of `ExistentialPredicate`s to allow for a couple of things:
 - Principal (ExistentialPredicate::Trait) is now optional.
 - Region bounds are moved out of `TraitObject` into `TyDynamic`. This permits wrapping only the `ExistentialPredicate` list in `Binder`.
 - `BuiltinBounds` and `BuiltinBound` are removed entirely from the codebase, to permit future non-constrained auto traits. These are replaced with `ExistentialPredicate::AutoTrait`, which only requires a `DefId`. For the time being, only `Send` and `Sync` are supported; this constraint can be lifted in a future pull request.
 - Binder-related logic is extracted from `ExistentialPredicate` into the parent (`Binder<Slice<EP>>`), so `PolyX`s are inside `TraitObject` are replaced with `X`.

The code requires a sorting order for `ExistentialPredicate`s in the interned `Slice`. The sort order is asserted to be correct during interning, but the slices are not sorted at that point.

1. `ExistentialPredicate::Trait` are defined as always equal; **This may be wrong; should we be comparing them and sorting them in some way?**
1. `ExistentialPredicate::Projection`: Compared by `ExistentialProjection::sort_key`.
1. `ExistentialPredicate::AutoTrait`: Compared by `TraitDef.def_path_hash`.

Construction of `ExistentialPredicate`s is conducted through `TyCtxt::mk_existential_predicates`, which interns a passed iterator as a `Slice`. There are no convenience functions to construct from a set of separate iterators; callers must pass an iterator chain. The lack of convenience functions is primarily due to few uses and the relative difficulty in defining a nice API due to optional parts and difficulty in recognizing which argument goes where. It is also true that the current situation isn't significantly better than 4 arguments to a constructor function; but the extra work is deemed unnecessary as of this time.

```rust
// before this PR
struct TraitObject<'tcx> {
    pub principal: PolyExistentialTraitRef<'tcx>,
    pub region_bound: &'tcx ty::Region,
    pub builtin_bounds: BuiltinBounds,
    pub projection_bounds: Vec<PolyExistentialProjection<'tcx>>,
}

// after
pub enum ExistentialPredicate<'tcx> {
    // e.g. Iterator
    Trait(ExistentialTraitRef<'tcx>),
    // e.g. Iterator::Item = T
    Projection(ExistentialProjection<'tcx>),
    // e.g. Send
    AutoTrait(DefId),
}
```
2016-11-29 20:41:38 -06:00
Liigo Zhuang
d5785a368e rustdoc: fix up --playground-url 2016-11-30 10:33:23 +08:00
Liigo Zhuang
943bf96300 unstable --playground-url, add test code 2016-11-30 10:33:22 +08:00
Liigo Zhuang
c1a6f17031 rustdoc: get back missing crate-name when --playground-url is used
follow up PR #37763
2016-11-30 10:33:22 +08:00
Andrew Gallant
80ef1dbf2d Add new #[target_feature = "..."] attribute.
This commit adds a new attribute that instructs the compiler to emit
target specific code for a single function. For example, the following
function is permitted to use instructions that are part of SSE 4.2:

    #[target_feature = "+sse4.2"]
    fn foo() { ... }

In particular, use of this attribute does not require setting the
-C target-feature or -C target-cpu options on rustc.

This attribute does not have any protections built into it. For example,
nothing stops one from calling the above `foo` function on hosts without
SSE 4.2 support. Doing so may result in a SIGILL.

This commit also expands the target feature whitelist to include lzcnt,
popcnt and sse4a. Namely, lzcnt and popcnt have their own CPUID bits,
but were introduced with SSE4.
2016-11-29 20:32:14 -05:00
bors
fa0005f2d5 Auto merge of #37863 - mikhail-m1:mut_error, r=nikomatsakis
add hint to fix error for immutable ref in arg

fix  #36412 part of #35233
r? @jonathandturner
2016-11-29 17:27:00 -06:00
Alex Crichton
8e9f7f5836 rustbuild: Use src/rustc for assembled compilers
The `src/rustc` path is intended for assembling a compiler (e.g. the bare bones)
not actually compiling the whole compiler itself. This path was accidentally
getting hijacked to represent the whole compiler being compiled, so let's
redirect that elsewhere for that particular cargo project.

Closes #38039
2016-11-29 13:40:43 -08:00
Eduard-Mihai Burtescu
07ff914be1 rustc: simplify AdtDef by removing the field types and ty::ivar. 2016-11-29 21:24:26 +02:00
Eduard-Mihai Burtescu
3f338eed99 rustc: remove type information from TraitDef. 2016-11-29 21:24:26 +02:00
Doug Goldstein
ffcdc19178
bootstrap/README: fix small typo 2016-11-29 13:14:37 -06:00
bors
b30022a1d3 Auto merge of #37369 - estebank:multiline-span, r=nikomatsakis
Show multiline spans in full if short enough

When dealing with multiline spans that span few lines, show the complete span instead of restricting to the first character of the first line.

For example, instead of:

```
% ./rustc file2.rs
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
  --> file2.rs:13:9
   |
13 |    foo(1 + bar(x,
   |        ^ trait `{integer}: std::ops::Add<()>` not satisfied
   |
```

show

```
% ./rustc file2.rs
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
  --> file2.rs:13:9
   |
13 |      foo(1 + bar(x,
   |  ________^ starting here...
14 | |            y),
   | |_____________^ ...ending here: trait `{integer}: std::ops::Add<()>` not satisfied
   |
```

The [proposal in internals](https://internals.rust-lang.org/t/proposal-for-multiline-span-comments/4242/6) outlines the reasoning behind this.
2016-11-29 12:53:47 -06:00
bors
f50dbd580f Auto merge of #37918 - flodiebold:separate-bodies, r=nikomatsakis
Separate function bodies from their signatures in HIR

Also give them their own dep map node.

I'm still unhappy with the handling of inlined items (1452edc1), but maybe you have a suggestion how to improve it.

Fixes #35078.

r? @nikomatsakis
2016-11-29 08:50:38 -06:00
Florian Diebold
593b273659 librustdoc: Fix compilation after visitor change 2016-11-29 13:18:02 +01:00
Niko Matsakis
9457497bcc update comments 2016-11-29 13:04:27 +01:00
Niko Matsakis
104125d5f7 revamp Visitor with a single method for controlling nested visits 2016-11-29 13:04:27 +01:00
Florian Diebold
8575184b39 Fix rebase breakage 2016-11-29 13:04:27 +01:00
Florian Diebold
bf298aebfd Fix doc test collection 2016-11-29 13:04:27 +01:00
Florian Diebold
b10bbde335 Fix SVH tests some more 2016-11-29 13:04:27 +01:00
Florian Diebold
f0ce5bb66b Split nested_visit_mode function off from nested_visit_map
... and make the latter mandatory to implement.
2016-11-29 13:04:27 +01:00
Florian Diebold
725cffb1d5 Address remaining review comments 2016-11-29 13:04:27 +01:00
Florian Diebold
d5a501d312 Fix remaining SVH tests 2016-11-29 13:04:27 +01:00
Florian Diebold
d0ae2c8142 Refactor inlined items some more
They don't implement FnLikeNode anymore, instead are handled differently
further up in the call tree. Also, keep less information (just def ids
for the args).
2016-11-29 13:04:27 +01:00
Niko Matsakis
dd1491cfbe WIP: update tests to pass -- not complete 2016-11-29 13:04:27 +01:00
Niko Matsakis
688946d671 restructure CollectItem dep-node to separate fn sigs from bodies
Setup two tasks, one of which only processes the signatures, in order to
isolate the typeck entries for signatures from those for bodies.

Fixes #36078
Fixes #37720
2016-11-29 13:04:27 +01:00
Florian Diebold
f75c8a98dd Add make tidy fixes 2016-11-29 13:04:27 +01:00
Florian Diebold
23a8c7d4d9 Remove unused import 2016-11-29 13:04:27 +01:00
Florian Diebold
8d5ca62dcd Fix some comments 2016-11-29 13:04:27 +01:00