]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #38123 - GuillaumeGomez:panic_doc, r=frewsxcv
Guillaume Gomez [Wed, 7 Dec 2016 18:42:51 +0000 (10:42 -0800)]
Rollup merge of #38123 - GuillaumeGomez:panic_doc, r=frewsxcv

Add missing examples for panicking objects

r? @frewsxcv

7 years agoRollup merge of #38085 - estebank:empty-import-list-fix-38012, r=jseyfried
Guillaume Gomez [Wed, 7 Dec 2016 18:42:51 +0000 (10:42 -0800)]
Rollup merge of #38085 - estebank:empty-import-list-fix-38012, r=jseyfried

Warn when an import list is empty

For a given file

```rust
use std::*;
use std::{};
```

output the following warnings

```
warning: unused import: `use std::{};`, #[warn(unused_imports)] on by default
 --> file.rs:2:1
  |
2 | use std::{};
  | ^^^^^^^^^^^^

warning: unused import: `std::*;`, #[warn(unused_imports)] on by default
 --> file.rs:1:5
  |
1 | use std::*;
  |     ^^^^^^^
```

7 years agoAuto merge of #37817 - alexcrichton:rustbuild-default, r=brson
bors [Wed, 7 Dec 2016 12:09:11 +0000 (12:09 +0000)]
Auto merge of #37817 - alexcrichton:rustbuild-default, r=brson

mk: Switch rustbuild to the default build system

This commit switches the default build system for Rust from the makefiles to
rustbuild. The rustbuild build system has been in development for almost a year
now and has become quite mature over time. This commit is an implementation of
the proposal on [internals] which slates deletion of the makefiles on
2017-02-02.

[internals]: https://internals.rust-lang.org/t/proposal-for-promoting-rustbuild-to-official-status/4368

This commit also updates various documentation in `README.md`,
`CONTRIBUTING.md`, `src/bootstrap/README.md`, and throughout the source code of
rustbuild itself.

7 years agomk: Switch rustbuild to the default build system
Alex Crichton [Wed, 16 Nov 2016 20:31:19 +0000 (12:31 -0800)]
mk: Switch rustbuild to the default build system

This commit switches the default build system for Rust from the makefiles to
rustbuild. The rustbuild build system has been in development for almost a year
now and has become quite mature over time. This commit is an implementation of
the proposal on [internals] which slates deletion of the makefiles on
2016-01-02.

[internals]: https://internals.rust-lang.org/t/proposal-for-promoting-rustbuild-to-official-status/4368

This commit also updates various documentation in `README.md`,
`CONTRIBUTING.md`, `src/bootstrap/README.md`, and throughout the source code of
rustbuild itself.

Closes #37858

7 years agoAuto merge of #38149 - bluss:is-empty, r=alexcrichton
bors [Wed, 7 Dec 2016 07:15:31 +0000 (07:15 +0000)]
Auto merge of #38149 - bluss:is-empty, r=alexcrichton

Forward more ExactSizeIterator methods and `is_empty` edits

- Forward ExactSizeIterator methods in more places, like `&mut I` and `Box<I>` iterator impls.
- Improve `VecDeque::is_empty` itself (see commit 4)
- All the collections iterators now have `len` or `is_empty` forwarded if doing so is a benefit. In the remaining cases, they already use a simple size hint (using something like a stored `usize` value), which is sufficient for the default implementation of len and is_empty.

7 years agoAuto merge of #38144 - clarcharr:redundant, r=alexcrichton
bors [Wed, 7 Dec 2016 03:54:14 +0000 (03:54 +0000)]
Auto merge of #38144 - clarcharr:redundant, r=alexcrichton

Remove redundant assertion near is_char_boundary

Follow-up from #38056. `is_char_boundary` already checks for `idx <= len`, so, an extra assertion is redundant.

7 years agoAuto merge of #38134 - bluss:iter-nth, r=aturon
bors [Wed, 7 Dec 2016 00:30:25 +0000 (00:30 +0000)]
Auto merge of #38134 - bluss:iter-nth, r=aturon

Remove Self: Sized from Iterator::nth

It is an unnecessary restriction; nth neither needs self to be sized
nor needs to be exempted from the trait object.

It increases the utility of the nth method, because type specific
implementations are available through `&mut I` or through an iterator
trait object.

It is a backwards compatible change due to the special cases of the
`where Self: Sized` bound; it was already optional to include this bound
in `Iterator` implementations.

7 years agoAuto merge of #38017 - arthurprs:hm-extend, r=bluss
bors [Tue, 6 Dec 2016 21:05:31 +0000 (21:05 +0000)]
Auto merge of #38017 - arthurprs:hm-extend, r=bluss

Smarter HashMap/HashSet pre-allocation for extend/from_iter

HashMap/HashSet from_iter and extend are making totally different assumptions.

A more balanced decision may allocate half the lower hint (rounding up). For "well defined" iterators this effectively limits the worst case to two resizes (the initial reserve + one resize).

cc #36579
cc @bluss

7 years agoAuto merge of #38036 - Mark-Simulacrum:polish-2, r=nagisa,eddyb
bors [Tue, 6 Dec 2016 17:38:26 +0000 (17:38 +0000)]
Auto merge of #38036 - Mark-Simulacrum:polish-2, r=nagisa,eddyb

Simplify calling find_implied_output_region.

@nnethercote added the optimization that find_implied_output_region
takes a closure as an optimization in #37014, but passing an iterator is
simpler, and more ergonomic for callers.

7 years agoAuto merge of #37994 - upsuper:msvc-link-opt, r=alexcrichton
bors [Tue, 6 Dec 2016 14:16:49 +0000 (14:16 +0000)]
Auto merge of #37994 - upsuper:msvc-link-opt, r=alexcrichton

Don't apply msvc link opts for non-opt build

`/OPT:REF,ICF` sometimes takes lots of time. It makes no sense to apply them when doing debug build. MSVC's linker by default disables these optimizations when `/DEBUG` is specified, unless they are explicitly passed.

7 years agoSimplify calling find_implied_output_region.
Mark-Simulacrum [Sun, 27 Nov 2016 16:52:44 +0000 (09:52 -0700)]
Simplify calling find_implied_output_region.

@nnethercote added the optimization that find_implied_output_region
takes a closure as an optimization in #37014, but passing an iterator is
simpler, and more ergonomic for callers.

7 years agoAuto merge of #37973 - vadimcn:dllimport, r=alexcrichton
bors [Tue, 6 Dec 2016 10:54:45 +0000 (10:54 +0000)]
Auto merge of #37973 - vadimcn:dllimport, r=alexcrichton

Implement RFC 1717

Implement the first two points from #37403.

r? @alexcrichton

7 years agoSmarter HashMap/HashSet extend
arthurprs [Sat, 26 Nov 2016 16:30:29 +0000 (17:30 +0100)]
Smarter HashMap/HashSet extend

7 years agoAuto merge of #38097 - Mark-Simulacrum:fn-sig-slice, r=eddyb
bors [Tue, 6 Dec 2016 07:35:21 +0000 (07:35 +0000)]
Auto merge of #38097 - Mark-Simulacrum:fn-sig-slice, r=eddyb

Refactor ty::FnSig to contain a &'tcx Slice<Ty<'tcx>>

We refactor this in order to achieve the following wins:

 - Decrease the size of `FnSig` (`Vec` + `bool`: 32, `&Slice` + `bool`: 24).
 - Potentially decrease total allocated memory due to arena-allocating `FnSig` inputs/output; since they are allocated in the type list arena, other users of type lists can reuse the same allocation for an equivalent type list.
 - Remove the last part of the type system which needs drop glue (#37965 removed the other remaining part). This makes arenas containing `FnSig` faster to drop (since we don't need to drop a Vec for each one), and makes reusing them without clearing/dropping potentially possible.

r? @eddyb

7 years agoRefactor FnSig to contain a Slice for its inputs and outputs.
Mark-Simulacrum [Tue, 29 Nov 2016 03:25:33 +0000 (20:25 -0700)]
Refactor FnSig to contain a Slice for its inputs and outputs.

7 years agoRefactor ty::FnSig to privatize all fields
Mark-Simulacrum [Tue, 29 Nov 2016 02:35:38 +0000 (19:35 -0700)]
Refactor ty::FnSig to privatize all fields

7 years agoAuto merge of #38128 - cardoe:req-cmake-only-for-llvm, r=alexcrichton
bors [Tue, 6 Dec 2016 03:45:49 +0000 (03:45 +0000)]
Auto merge of #38128 - cardoe:req-cmake-only-for-llvm, r=alexcrichton

configure: only req CMake if we're building LLVM

CMake is only necessary if LLVM is going to be built and not in any
other case.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
7 years agoWarn when an import list is empty
Esteban Küber [Wed, 30 Nov 2016 08:07:31 +0000 (00:07 -0800)]
Warn when an import list is empty

For a given file

```rust
use std::*;
use std::{};
```

output the following warnings

```
warning: unused import: `use std::{};`, #[warn(unused_imports)] on by default
 --> file.rs:2:1
  |
2 | use std::{};
  | ^^^^^^^^^^^^

warning: unused import: `std::*;`, #[warn(unused_imports)] on by default
 --> file.rs:1:5
  |
1 | use std::*;
  |     ^^^^^^^
```

7 years agoConsider only libs that aren't excluded by #[link(cfg=...)]
Vadim Chugunov [Mon, 5 Dec 2016 18:15:14 +0000 (10:15 -0800)]
Consider only libs that aren't excluded by #[link(cfg=...)]

7 years agoAnnotate more tests with kind="static"
Vadim Chugunov [Tue, 6 Dec 2016 00:31:05 +0000 (16:31 -0800)]
Annotate more tests with kind="static"

7 years agoAuto merge of #38121 - jonathandturner:better_e0061, r=nikomatsakis
bors [Tue, 6 Dec 2016 00:17:24 +0000 (00:17 +0000)]
Auto merge of #38121 - jonathandturner:better_e0061, r=nikomatsakis

Point arg num mismatch errors back to their definition

This PR updates the arg num errors (like E0061) to point back at the function definition where they were defined.

Before:

```
error[E0061]: this function takes 2 parameters but 1 parameter was supplied
  --> E0061.rs:18:7
   |
18 |     f(0);
   |       ^
   |
   = note: the following parameter types were expected:
   = note: u16, &str
```

Now:

```
error[E0061]: this function takes 2 parameters but 1 parameter was supplied
  --> E0061.rs:18:7
   |
11 | fn f(a: u16, b: &str) {}
   | ------------------------ defined here
...
18 |     f(0);
   |       ^ expected 2 parameters
```

This is an incremental improvement.  We probably want to underline only the function name and also have support for functions defined in crates outside of the current crate.

r? @nikomatsakis

7 years agoAuto merge of #38117 - michaelwoerister:hidden-symbols, r=alexcrichton
bors [Mon, 5 Dec 2016 20:53:04 +0000 (20:53 +0000)]
Auto merge of #38117 - michaelwoerister:hidden-symbols, r=alexcrichton

Improve symbol visibility handling for dynamic libraries.

This will hopefully fix issue https://github.com/rust-lang/rust/issues/37530 and maybe also https://github.com/rust-lang/rust/issues/32887.

I'm relying on @m4b to post some numbers on how awesome the improvement for cdylibs is `:)`

cc @rust-lang/compiler @rust-lang/tools @cuviper @froydnj
r? @alexcrichton

7 years agoAuto merge of #38111 - japaric:jemalloc, r=alexcrichton
bors [Mon, 5 Dec 2016 17:37:40 +0000 (17:37 +0000)]
Auto merge of #38111 - japaric:jemalloc, r=alexcrichton

don't rebuild alloc_jemalloc if jemalloc's .git directory has changed

the .git directory is modified by `bootstrap` when it updates this git
submodule; this triggered rebuilds every time `bootstrap` was called.

likely fixes #38094

r? @alexcrichton

7 years agoMake symbol-visibility test case work on all platforms.
Michael Woerister [Fri, 2 Dec 2016 23:02:46 +0000 (18:02 -0500)]
Make symbol-visibility test case work on all platforms.

7 years agoMention cdylibs in LTO error message.
Michael Woerister [Fri, 2 Dec 2016 23:02:14 +0000 (18:02 -0500)]
Mention cdylibs in LTO error message.

7 years agoExport the plugin registrar from proc-macro crates (and not much else)
Michael Woerister [Fri, 2 Dec 2016 23:00:41 +0000 (18:00 -0500)]
Export the plugin registrar from proc-macro crates (and not much else)

7 years agoAdd test case for symbol visibility in dylibs.
Michael Woerister [Thu, 1 Dec 2016 20:06:33 +0000 (15:06 -0500)]
Add test case for symbol visibility in dylibs.

7 years agoLinking: Include export lists in debug output.
Michael Woerister [Thu, 1 Dec 2016 19:57:46 +0000 (14:57 -0500)]
Linking: Include export lists in debug output.

7 years agoGenerate a version script for linkers on Linux.
Michael Woerister [Wed, 30 Nov 2016 18:16:53 +0000 (13:16 -0500)]
Generate a version script for linkers on Linux.

7 years agoRefactor symbol export list generation.
Michael Woerister [Wed, 30 Nov 2016 15:03:42 +0000 (10:03 -0500)]
Refactor symbol export list generation.

7 years agotrans: Rename `reachable` to `exported_symbols` where appropriate.
Michael Woerister [Mon, 28 Nov 2016 23:05:53 +0000 (18:05 -0500)]
trans: Rename `reachable` to `exported_symbols` where appropriate.

7 years agoMake LLVM symbol visibility FFI types more stable.
Michael Woerister [Mon, 28 Nov 2016 22:44:51 +0000 (17:44 -0500)]
Make LLVM symbol visibility FFI types more stable.

7 years agoAuto merge of #38107 - keeperofdakeys:proc-macro-test, r=alexcrichton
bors [Mon, 5 Dec 2016 14:27:06 +0000 (14:27 +0000)]
Auto merge of #38107 - keeperofdakeys:proc-macro-test, r=alexcrichton

Allow --test to be used on proc-macro crates

Fixes #37480

This patch allows `--test` to work for proc-macro crates, removing the previous error.

7 years agoAuto merge of #38100 - nox:llvm, r=alexcrichton
bors [Mon, 5 Dec 2016 10:04:25 +0000 (10:04 +0000)]
Auto merge of #38100 - nox:llvm, r=alexcrichton

Update llvm fork to 3ec14daffb4b8c0604df50b7fb0ab552f456e381

7 years agoAuto merge of #38098 - luser:windows-commandext, r=alexcrichton
bors [Mon, 5 Dec 2016 06:53:56 +0000 (06:53 +0000)]
Auto merge of #38098 - luser:windows-commandext, r=alexcrichton

Add std::os::windows::process::CommandExt. Fixes #37827

This adds a CommandExt trait for Windows along with an implementation of it
for std::process::Command with methods to set the process creation flags that
are passed to CreateProcess.

7 years agoAdd missing examples for panicking objects
Guillaume Gomez [Fri, 2 Dec 2016 01:29:53 +0000 (17:29 -0800)]
Add missing examples for panicking objects

7 years agoAuto merge of #38093 - mikhail-m1:stack-overflow, r=arielb1
bors [Mon, 5 Dec 2016 02:48:03 +0000 (02:48 +0000)]
Auto merge of #38093 - mikhail-m1:stack-overflow, r=arielb1

fix stack overflow by enum and cont issue #36163

some paths were skipped while checking for recursion.

I fixed bug reproduces on win64 cargo test. In previous PR #36458 time complexity was exponential in case of linked const values. Now it's linear.

r? @alexcrichton

7 years agoAuto merge of #38092 - pnkfelix:mir-stats, r=nikomatsakis
bors [Sun, 4 Dec 2016 23:36:50 +0000 (23:36 +0000)]
Auto merge of #38092 - pnkfelix:mir-stats, r=nikomatsakis

Adds `-Z mir-stats`, which is similar to `-Z hir-stats`.

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 promoted mir being newly 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.

7 years agoAuto merge of #38087 - jooert:remove_unmarked, r=petrochenkov
bors [Sun, 4 Dec 2016 19:47:18 +0000 (19:47 +0000)]
Auto merge of #38087 - jooert:remove_unmarked, r=petrochenkov

Remove the `unmarked_api` feature

Closes #37981.

7 years agoAuto merge of #38086 - semarie:openbsd-i686, r=alexcrichton
bors [Sun, 4 Dec 2016 16:35:09 +0000 (16:35 +0000)]
Auto merge of #38086 - semarie:openbsd-i686, r=alexcrichton

Add i686-unknown-openbsd target.

It is a preliminary work. I still have some tests failing, but I have a working rustc binary which is able to rebuild itself.

an update of libc should be required too, but I dunno how to do it with vendor/ layout.

r? @alexcrichton

7 years agoalloc: Forward ExactSizeIterator methods in Iterator for Box<I>
Ulrik Sverdrup [Sat, 3 Dec 2016 20:42:03 +0000 (21:42 +0100)]
alloc: Forward ExactSizeIterator methods in Iterator for Box<I>

7 years agoiter: Forward ExactSizeIterator methods for &mut I
Ulrik Sverdrup [Sat, 3 Dec 2016 21:47:33 +0000 (22:47 +0100)]
iter: Forward ExactSizeIterator methods for &mut I

7 years agobinary_heap: Forward ExactSizeIterator::is_empty
Ulrik Sverdrup [Sat, 3 Dec 2016 21:44:57 +0000 (22:44 +0100)]
binary_heap: Forward ExactSizeIterator::is_empty

7 years agocollections: Simplify VecDeque::is_empty
Ulrik Sverdrup [Sat, 3 Dec 2016 21:11:06 +0000 (22:11 +0100)]
collections: Simplify VecDeque::is_empty

Improve is_empty on the VecDeque and its iterators by just comparing
tail and head; this saves a few instructions (to be able to remove the
`& (size - 1)` computation, it would have to know that size is a power of two).

7 years agostd: Forward ExactSizeIterator::is_empty for Args, ArgsOs iterators
Ulrik Sverdrup [Sat, 3 Dec 2016 20:59:00 +0000 (21:59 +0100)]
std: Forward ExactSizeIterator::is_empty for Args, ArgsOs iterators

7 years agocore: Forward ExactSizeIterator::is_empty for Bytes
Ulrik Sverdrup [Sat, 3 Dec 2016 20:43:51 +0000 (21:43 +0100)]
core: Forward ExactSizeIterator::is_empty for Bytes

7 years agoDisable ICF opt of MSVC for non-opt build
Xidorn Quan [Fri, 25 Nov 2016 08:17:21 +0000 (19:17 +1100)]
Disable ICF opt of MSVC for non-opt build

7 years agoAuto merge of #38082 - jseyfried:macro_invocation_paths, r=nrc
bors [Sun, 4 Dec 2016 12:51:38 +0000 (12:51 +0000)]
Auto merge of #38082 - jseyfried:macro_invocation_paths, r=nrc

macros: support invocation paths (e.g. `foo::bar!()`) behind `#![feature(use_extern_macros)]`

r? @nrc

7 years agoAuto merge of #37920 - nikomatsakis:compile-time-regression-37864, r=mw
bors [Sun, 4 Dec 2016 06:38:38 +0000 (06:38 +0000)]
Auto merge of #37920 - nikomatsakis:compile-time-regression-37864, r=mw

in region, treat current (and future) item-likes alike

The `visit_fn` code mutates its surrounding context.  Between *items*,
this was saved/restored, but between impl items it was not. This meant
that we wound up with `CallSiteScope` entries with two parents (or
more!).  As far as I can tell, this is harmless in actual type-checking,
since the regions you interact with are always from at most one of those
branches. But it can slow things down.

Before, the effect was limited, since it only applied to impl items
within an impl. After #37660, impl items are visisted all together at
the end, and hence this could create a very messed up
hierarchy. Isolating impl item properly solves both issues.

I cannot come up with a way to unit-test this; for posterity, however,
you can observe the messed up hierarchies with a test as simple as the
following, which would create a callsite scope with two parents both
before and after

```
struct Foo {
}

impl Foo {
    fn bar(&self) -> usize {
        22
    }

    fn baz(&self) -> usize {
        22
    }
}

fn main() { }
```

Fixes #37864.

r? @michaelwoerister

cc @pnkfelix -- can you think of a way to make a regr test?

7 years agoOpenBSD under x86 has particular ABI for returning a struct.
Sébastien Marie [Sat, 3 Dec 2016 17:58:21 +0000 (18:58 +0100)]
OpenBSD under x86 has particular ABI for returning a struct.

It is like OSX or Windows: small structs are returned as integers.

7 years agoAuto merge of #37857 - shepmaster:llvm-4.0-dinodes, r=michaelwoerister
bors [Sun, 4 Dec 2016 02:30:23 +0000 (02:30 +0000)]
Auto merge of #37857 - shepmaster:llvm-4.0-dinodes, r=michaelwoerister

[LLVM 4.0] Handle new DIFlags enum

7 years agoIgnore test on -windows-gnu.
Vadim Chugunov [Sat, 3 Dec 2016 23:01:09 +0000 (15:01 -0800)]
Ignore test on -windows-gnu.

7 years agoAuto merge of #38148 - frewsxcv:rollup, r=frewsxcv
bors [Sat, 3 Dec 2016 20:59:08 +0000 (20:59 +0000)]
Auto merge of #38148 - frewsxcv:rollup, r=frewsxcv

Rollup of 15 pull requests

- Successful merges: #37859, #37919, #38020, #38028, #38029, #38065, #38073, #38077, #38089, #38090, #38096, #38112, #38113, #38130, #38141
- Failed merges:

7 years agoRollup merge of #38141 - GuillaumeGomez:component_doc, r=frewsxcv
Corey Farwell [Sat, 3 Dec 2016 20:39:54 +0000 (15:39 -0500)]
Rollup merge of #38141 - GuillaumeGomez:component_doc, r=frewsxcv

Add Component examples

r? @frewsxcv

7 years agoRollup merge of #38130 - jethrogb:patch-3, r=steveklabnik
Corey Farwell [Sat, 3 Dec 2016 20:39:53 +0000 (15:39 -0500)]
Rollup merge of #38130 - jethrogb:patch-3, r=steveklabnik

Update items section in reference

Make clear that items must be definitions, and add missing extern block

7 years agoRollup merge of #38113 - nikomatsakis:incremental-dump-hash, r=michaelwoerister
Corey Farwell [Sat, 3 Dec 2016 20:39:53 +0000 (15:39 -0500)]
Rollup merge of #38113 - nikomatsakis:incremental-dump-hash, r=michaelwoerister

add a `-Z incremental-dump-hash` flag

This causes us to dump a bunch of has information to stdout that can be
useful in tracking down incremental compilation invalidations,
particularly across crates.

7 years agoRollup merge of #38112 - tarka:book-testing-fix, r=steveklabnik
Corey Farwell [Sat, 3 Dec 2016 20:39:53 +0000 (15:39 -0500)]
Rollup merge of #38112 - tarka:book-testing-fix, r=steveklabnik

Minor fix to testing concurrency section

7 years agoRollup merge of #38096 - michaelwoerister:more-incremental-info, r=nikomatsakis
Corey Farwell [Sat, 3 Dec 2016 20:39:53 +0000 (15:39 -0500)]
Rollup merge of #38096 - michaelwoerister:more-incremental-info, r=nikomatsakis

incr.comp.: Add more output to -Z incremental-info.

Also makes sure that all output from `-Z incremental-info` is prefixed with `incremental:` for better grep-ability.

r? @nikomatsakis

7 years agoRollup merge of #38090 - GuillaumeGomez:option_doc, r=frewsxcv
Corey Farwell [Sat, 3 Dec 2016 20:39:53 +0000 (15:39 -0500)]
Rollup merge of #38090 - GuillaumeGomez:option_doc, r=frewsxcv

Add cloned example for Option

r? @frewsxcv

7 years agoRollup merge of #38089 - michaelwoerister:disable-debuginfo-test-on-aarch64, r=alexcr...
Corey Farwell [Sat, 3 Dec 2016 20:39:52 +0000 (15:39 -0500)]
Rollup merge of #38089 - michaelwoerister:disable-debuginfo-test-on-aarch64, r=alexcrichton

debuginfo: Ignore macro-stepping test on aarch64

See https://github.com/rust-lang/rust/issues/37225.

r? @alexcrichton

7 years agoRollup merge of #38077 - GuillaumeGomez:ipaddr_doc, r=frewsxcv
Corey Farwell [Sat, 3 Dec 2016 20:39:52 +0000 (15:39 -0500)]
Rollup merge of #38077 - GuillaumeGomez:ipaddr_doc, r=frewsxcv

Add missing examples for IpAddr enum

r? @frewsxcv

7 years agoRollup merge of #38073 - cardoe:fix-typo, r=frewsxcv
Corey Farwell [Sat, 3 Dec 2016 20:39:52 +0000 (15:39 -0500)]
Rollup merge of #38073 - cardoe:fix-typo, r=frewsxcv

bootstrap/README: fix small typo

7 years agoRollup merge of #38065 - estebank:fix-37618, r=jonathandturner
Corey Farwell [Sat, 3 Dec 2016 20:39:52 +0000 (15:39 -0500)]
Rollup merge of #38065 - estebank:fix-37618, r=jonathandturner

Show `Trait` instead of `<Struct as Trait>` in E0323

For a given file

```
trait Foo {
    fn bar(&self);
}

pub struct FooConstForMethod;

impl Foo for FooConstForMethod {
    const bar: u64 = 1;
}
```

show

```
error[E0323]: item `bar` is an associated const, which doesn't match its trait `Foo`
```

instead of

```
error[E0323]: item `bar` is an associated const, which doesn't match its trait `<FooConstForMethod as Foo>`
```

Fix #37618

7 years agoRollup merge of #38029 - dns2utf8:fix_verify.rs, r=petrochenkov
Corey Farwell [Sat, 3 Dec 2016 20:39:52 +0000 (15:39 -0500)]
Rollup merge of #38029 - dns2utf8:fix_verify.rs, r=petrochenkov

Fix verify.rs

Finishing d2f8fb0 from @jseyfried

7 years agoRollup merge of #38028 - Mark-Simulacrum:polish, r=nikomatsakis
Corey Farwell [Sat, 3 Dec 2016 20:39:51 +0000 (15:39 -0500)]
Rollup merge of #38028 - Mark-Simulacrum:polish, r=nikomatsakis

Refactor one_bound_for_assoc_type to take an Iterator instead of Vec

I doubt the performance implications will be serious, but it will avoid allocating one-element Vecs for the successful case (and avoid allocating vecs at all for any case, too).

`--stage 2` tests passed locally.

7 years agoRollup merge of #38020 - GuillaumeGomez:udp-socket-doc, r=frewsxcv
Corey Farwell [Sat, 3 Dec 2016 20:39:51 +0000 (15:39 -0500)]
Rollup merge of #38020 - GuillaumeGomez:udp-socket-doc, r=frewsxcv

Add part of missing UdpSocket's urls and examples

r? @frewsxcv

7 years agoRollup merge of #37919 - nikomatsakis:incremental-36168, r=mw
Corey Farwell [Sat, 3 Dec 2016 20:39:51 +0000 (15:39 -0500)]
Rollup merge of #37919 - nikomatsakis:incremental-36168, r=mw

add regression test for #36168

Fixes #36168

r? @michaelwoerister

7 years agoRollup merge of #37859 - GuillaumeGomez:net_examples, r=nagisa
Corey Farwell [Sat, 3 Dec 2016 20:39:51 +0000 (15:39 -0500)]
Rollup merge of #37859 - GuillaumeGomez:net_examples, r=nagisa

Add missing examples for Ipv6Addr

r? @steveklabnik

cc @frewsxcv

7 years agomove test for #37290 into run-pass-fulldeps
Niko Matsakis [Sat, 3 Dec 2016 19:42:34 +0000 (14:42 -0500)]
move test for #37290 into run-pass-fulldeps

7 years agofix stack overflow by enum and cont issue #36163, some paths were skipped while check...
Mikhail Modin [Fri, 9 Sep 2016 21:11:31 +0000 (00:11 +0300)]
fix stack overflow by enum and cont issue #36163, some paths were skipped while checking for recursion.

7 years agoupdate src/liblibc to include i686-unknown-openbsd libc definition
Sébastien Marie [Wed, 30 Nov 2016 14:39:20 +0000 (15:39 +0100)]
update src/liblibc to include i686-unknown-openbsd libc definition

7 years agoAuto merge of #38079 - BurntSushi:attrtarget, r=alexcrichton
bors [Sat, 3 Dec 2016 17:41:14 +0000 (17:41 +0000)]
Auto merge of #38079 - BurntSushi:attrtarget, r=alexcrichton

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.

I've also expanded the x86 target feature whitelist.

7 years agoRemove redundant assertion near is_char_boundary.
Clar Charr [Tue, 29 Nov 2016 19:18:59 +0000 (14:18 -0500)]
Remove redundant assertion near is_char_boundary.

7 years agoAuto merge of #38061 - cardoe:target-spec, r=alexcrichton
bors [Sat, 3 Dec 2016 14:21:51 +0000 (14:21 +0000)]
Auto merge of #38061 - cardoe:target-spec, r=alexcrichton

print option to dump target spec as JSON

This lets the user dump out the target spec that the compiler is using. This is useful to people defining their own target.json to compare it against existing targets or understand how different targets change internal settings. It is also potentially useful for Cargo to determine if something has changed with a target and it needs to rebuild things.

7 years agoAuto merge of #38059 - arielb1:no-mere-overflow, r=nikomatsakis
bors [Sat, 3 Dec 2016 11:04:01 +0000 (11:04 +0000)]
Auto merge of #38059 - arielb1:no-mere-overflow, r=nikomatsakis

evaluate obligations in LIFO order during closure projection

This is an annoying gotcha with the projection cache's handling of
nested obligations.

Nested projection obligations enter the issue in this case:
```
DEBUG:rustc::traits::project: AssociatedTypeNormalizer: depth=3
normalized
<std::iter::Map<std::ops::Range<i32>,
[closure@not-a-recursion-error.rs:5:30: 5:53]> as
std::iter::IntoIterator>::Item to _#7t with 12 add'l obligations
```

Here the normalization result is the result of the nested impl
`<[closure@not-a-recursion-error.rs:5:30: 5:53] as FnMut(i32)>::Output`,
which is an additional obligation that is a part of "add'l obligations".

By itself, this is proper behaviour - the additional obligation is
returned, and the RFC 447 rules ensure that it is processed before the
output `#_7t` is used in any way.

However, the projection cache breaks this - it caches the
`<std::iter::Map<std::ops::Range<i32>,[closure@not-a-recursion-error.rs:5:30:
5:53]> as std::iter::IntoIterator>::Item = #_7t` resolution. Now
everybody else that attempts to look up the projection will just get
`#_7t` *without* any additional obligations. This obviously causes all
sorts of trouble (here a spurious `EvaluatedToAmbig` results in
specializations not being discarded
[here](https://github.com/rust-lang/rust/blob/9ca50bd4d50b55456e88a8c3ad8fcc9798f57522/src/librustc/traits/select.rs#L1705)).

The compiler works even with this projection cache gotcha because in most
cases during "one-pass evaluation". we tend to process obligations in LIFO
order - after an obligation is added to the cache, we process its nested
obligations before we do anything else (and if we have a cycle, we handle
it specifically) - which makes sure the inference variables are resolved
before they are used.

That "LIFO" order That was not done when projecting out of a closure, so
let's just fix that for the time being.

Fixes #38033.

Beta-nominating because regression.

r? @nikomatsakis

7 years agoAuto merge of #38056 - clarcharr:master, r=alexcrichton
bors [Sat, 3 Dec 2016 07:52:21 +0000 (07:52 +0000)]
Auto merge of #38056 - clarcharr:master, r=alexcrichton

Add String::split_off.

This seems to match up with the latest version of the collection reform, and seems useful enough to add. First pull request!

7 years agoAdd Component examples
Guillaume Gomez [Sat, 3 Dec 2016 04:16:12 +0000 (20:16 -0800)]
Add Component examples

7 years agoAuto merge of #38055 - rkruppe:rm-unused-llvm-ffi, r=alexcrichton
bors [Sat, 3 Dec 2016 03:57:57 +0000 (03:57 +0000)]
Auto merge of #38055 - rkruppe:rm-unused-llvm-ffi, r=alexcrichton

Remove unused functions from rustc_llvm

7 years ago[LLVM 4.0] Support new DIFlags enum
Jake Goulding [Fri, 18 Nov 2016 21:22:39 +0000 (16:22 -0500)]
[LLVM 4.0] Support new DIFlags enum

7 years ago[LLVM] Introduce a stable representation of DIFlags
Jake Goulding [Fri, 18 Nov 2016 22:15:14 +0000 (17:15 -0500)]
[LLVM] Introduce a stable representation of DIFlags

In LLVM 4.0, this enum becomes an actual type-safe enum, which breaks
all of the interfaces. Introduce our own copy of the bitflags that we
can then safely convert to the LLVM one.

7 years agoRename _all_ library instances.
Vadim Chugunov [Sat, 3 Dec 2016 01:51:54 +0000 (17:51 -0800)]
Rename _all_ library instances.

7 years agocore: Remove Self: Sized from Iterator::nth
Ulrik Sverdrup [Fri, 2 Dec 2016 20:13:57 +0000 (21:13 +0100)]
core: Remove Self: Sized from Iterator::nth

It is an unnecessary restriction; nth neither needs self to be sized
nor needs to be exempted from the trait object.

It increases the utility of the nth method, because type specific
implementations are available through `&mut I` or through an iterator
trait object.

It is a backwards compatible change due to the special cases of the
`where Self: Sized` bound; it was already optional to include this bound
in `Iterator` implementations.

7 years agopacify the mercilous tidy
Niko Matsakis [Fri, 2 Dec 2016 19:18:09 +0000 (14:18 -0500)]
pacify the mercilous tidy

7 years agoconfigure: quote variables
Doug Goldstein [Fri, 2 Dec 2016 17:25:43 +0000 (11:25 -0600)]
configure: quote variables

These should probably be quoted.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
7 years agoconfigure: only req CMake if we're building LLVM
Doug Goldstein [Fri, 2 Dec 2016 14:43:03 +0000 (08:43 -0600)]
configure: only req CMake if we're building LLVM

CMake is only necessary if LLVM is going to be built and not in any
other case.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
7 years agoUpdate items section in reference
jethrogb [Fri, 2 Dec 2016 17:19:38 +0000 (09:19 -0800)]
Update items section in reference

Make clear that items must be definitions, and add missing extern block

7 years agorustc: add basic test for --print target-spec
Doug Goldstein [Mon, 11 Apr 2016 03:17:27 +0000 (22:17 -0500)]
rustc: add basic test for --print target-spec

This is a very basic test of the --print target-spec feature.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
7 years agorustc: add --print target-spec option
Doug Goldstein [Thu, 7 Apr 2016 21:36:35 +0000 (16:36 -0500)]
rustc: add --print target-spec option

This option provides the user the ability to dump the configuration that
is in use by rustc for the target they are building for.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
7 years agoAuto merge of #38053 - eddyb:lazy-9, r=nikomatsakis
bors [Fri, 2 Dec 2016 15:06:36 +0000 (15:06 +0000)]
Auto merge of #38053 - eddyb:lazy-9, r=nikomatsakis

[9/n] rustc: move type information out of AdtDef and TraitDef.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37688) | [next]()) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

Both `AdtDef` and `TraitDef` contained type information (field types, generics and predicates) which was required to create them, preventing their use before that type information exists, or in the case of field types, *mutation* was required, leading to a variance-magicking implementation of `ivar`s.

This PR takes that information out and the resulting cleaner setup could even eventually end up merged with HIR, because, just like `AssociatedItem` before it, there's no dependency on types anymore.
(With one exception, variant discriminants should probably be moved into their own map later.)

7 years agoAuto merge of #38050 - alexcrichton:fix-llvm-deps, r=japaric
bors [Fri, 2 Dec 2016 11:35:57 +0000 (11:35 +0000)]
Auto merge of #38050 - alexcrichton:fix-llvm-deps, r=japaric

rustbuild: Cross-compiled LLVM depens on host

We use the host's tblgen so we need to be sure to always build the host first.

Closes #38037

7 years agoAuto merge of #37936 - tedsta:fuchsia_std_process, r=alexcrichton
bors [Fri, 2 Dec 2016 07:35:06 +0000 (07:35 +0000)]
Auto merge of #37936 - tedsta:fuchsia_std_process, r=alexcrichton

Fuchsia support for std::process via liblaunchpad.

Now we can launch processes on Fuchsia via the Rust standard library! ... Mostly.

Right now, ~5% of the time, reading the stdout/stderr off the pipes will fail. Some Magenta kernel people think it's probably a bug in Magenta's pipes. I wrote a unit test that demonstrates the issue in C, which I was told will expedite a fix. https://fuchsia-review.googlesource.com/#/c/15628/

Hopefully this can get merged once the issue is fixed :)

@raphlinus

7 years agoTighten up error checking of library renames.
Vadim Chugunov [Thu, 1 Dec 2016 23:57:16 +0000 (15:57 -0800)]
Tighten up error checking of library renames.

7 years agoRemove the "linked_from" feature.
Vadim Chugunov [Thu, 1 Dec 2016 23:21:59 +0000 (15:21 -0800)]
Remove the "linked_from" feature.

7 years agoPoint arg num mismatch errors back to their definition
Jonathan Turner [Fri, 2 Dec 2016 00:33:48 +0000 (16:33 -0800)]
Point arg num mismatch errors back to their definition

7 years agoImplement native library kind and name overrides from the command line.
Vadim Chugunov [Thu, 24 Nov 2016 00:09:51 +0000 (16:09 -0800)]
Implement native library kind and name overrides from the command line.

7 years agoFix rust_test_helpers linkage.
Vadim Chugunov [Thu, 24 Nov 2016 00:09:51 +0000 (16:09 -0800)]
Fix rust_test_helpers linkage.

7 years agoEmit 'dllimport' attribute for dylib foreign items on Windows.
Vadim Chugunov [Thu, 24 Nov 2016 00:09:51 +0000 (16:09 -0800)]
Emit 'dllimport' attribute for dylib foreign items on Windows.

7 years agoAuto merge of #37789 - arielb1:length-limit, r=nikomatsakis
bors [Fri, 2 Dec 2016 00:20:11 +0000 (00:20 +0000)]
Auto merge of #37789 - arielb1:length-limit, r=nikomatsakis

limit the length of types in monomorphization

This adds the new insta-stable `#![type_size_limit]` crate attribute to control
the limit, and is obviously a [breaking-change] fixable by that.

Fixes #37311.

r? @nikomatsakis

7 years agoconvert --print options to a vector
Doug Goldstein [Thu, 1 Dec 2016 22:26:47 +0000 (16:26 -0600)]
convert --print options to a vector

To allow manipulation of the options that appear in --print, convert it
to a vector.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
7 years agolimit the length of types in monomorphization
Ariel Ben-Yehuda [Tue, 15 Nov 2016 21:25:59 +0000 (23:25 +0200)]
limit the length of types in monomorphization

This adds the new insta-stable `#![type_size_limit]` crate attribute to control
the limit, and is obviously a [breaking-change] fixable by that.