]> git.lizzy.rs Git - rust.git/log
rust.git
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 #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 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 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 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 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 agopacify the mercilous tidy
Niko Matsakis [Fri, 2 Dec 2016 19:18:09 +0000 (14:18 -0500)]
pacify the mercilous tidy

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 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.

7 years agostd::process fuchsia support cleanup
Theodore DeRego [Thu, 1 Dec 2016 20:01:07 +0000 (12:01 -0800)]
std::process fuchsia support cleanup

7 years agotest for #37290 using lint
Niko Matsakis [Tue, 29 Nov 2016 16:51:35 +0000 (11:51 -0500)]
test for #37290 using lint

7 years agoin region, treat current (and future) item-likes alike
Niko Matsakis [Mon, 21 Nov 2016 17:17:13 +0000 (12:17 -0500)]
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.

7 years agoadd a `-Z incremental-dump-hash` flag
Niko Matsakis [Thu, 1 Dec 2016 17:29:28 +0000 (12:29 -0500)]
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 agoMinor fix to testing concurrency section
Steve Smith [Thu, 1 Dec 2016 16:30:34 +0000 (16:30 +0000)]
Minor fix to testing concurrency section

7 years agoAuto merge of #38048 - rkruppe:llvm-stringref-fixes, r=alexcrichton
bors [Thu, 1 Dec 2016 15:21:11 +0000 (15:21 +0000)]
Auto merge of #38048 - rkruppe:llvm-stringref-fixes, r=alexcrichton

[LLVM 4.0] Don't assume llvm::StringRef is null terminated

StringRefs have a length and their contents are not usually null-terminated. The solution is to either copy the string data (in `rustc_llvm::diagnostic`) or take the size into account (in LLVMRustPrintPasses).

I couldn't trigger a bug caused by this (apparently all the strings returned in practice are actually null-terminated) but this is more correct and more future-proof.

cc #37609

7 years agoAuto merge of #38018 - sourcefrog:doc, r=alexcrichton
bors [Thu, 1 Dec 2016 11:35:19 +0000 (11:35 +0000)]
Auto merge of #38018 - sourcefrog:doc, r=alexcrichton

Document that Process::command will search the PATH

7 years agoUpdate llvm fork to 3ec14daffb4b8c0604df50b7fb0ab552f456e381
Anthony Ramine [Thu, 1 Dec 2016 00:48:58 +0000 (01:48 +0100)]
Update llvm fork to 3ec14daffb4b8c0604df50b7fb0ab552f456e381

7 years agoAuto merge of #37911 - liigo:rustdoc-playground, r=alexcrichton
bors [Thu, 1 Dec 2016 07:07:32 +0000 (07:07 +0000)]
Auto merge of #37911 - liigo:rustdoc-playground, r=alexcrichton

rustdoc: get back missing crate-name when --playground-url is used

follow up PR #37763
r? @alexcrichton (since you r+ed to #37763 )

----

Edit: When `#![doc(html_playground_url="")]` is used, the current crate name is saved to `PLAYGROUND`, so rustdoc may generate `extern crate NAME;` into code snips automatically. But when `--playground-url` was introduced in PR #37763, I forgot saving crate name to `PLAYGROUND`. This PR fix that.

----

Update:
- add test
- unstable `--playground-url`

7 years agoAdd String::split_off.
Clar Charr [Mon, 28 Nov 2016 18:54:55 +0000 (13:54 -0500)]
Add String::split_off.

7 years agoAuto merge of #37573 - ruuda:faster-cursor, r=alexcrichton
bors [Thu, 1 Dec 2016 02:52:09 +0000 (02:52 +0000)]
Auto merge of #37573 - ruuda:faster-cursor, r=alexcrichton

Add small-copy optimization for copy_from_slice

## Summary

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. Doing a manual copy if the slice contains only one element can speed things up significantly. For my program, this reduced the running time by 20%.

## Background

I am optimizing a program that relies heavily on reading a single byte at a time. To avoid IO overhead, I read all data into a vector once, and then I use a `Cursor` around that vector to read from. During profiling, I noticed that `__memmove_avx_unaligned_erms` was hot, taking up 7.3% of the running time. It turns out that these were caused by calls to `Cursor::read()`, which calls `<&[u8] as Read>::read()`, which calls `&[T]::copy_from_slice()`, which calls `ptr::copy_nonoverlapping()`. This one is implemented as a memcopy. Copying a single byte with a memcopy is very wasteful, because (at least on my platform) it involves calling `memcpy` in libc. This is an indirect call when libc is linked dynamically, and furthermore `memcpy` is optimized for copying large amounts of data at the cost of a bit of overhead for small copies.

## Benchmarks

Before I made this change, `perf` reported the following for my program. I only included the relevant functions, and how they rank. (This is on a different machine than where I ran the original benchmarks. It has an older CPU, so `__memmove_sse2_unaligned_erms` is called instead of `__memmove_avx_unaligned_erms`.)

```
#3   5.47%  bench_decode  libc-2.24.so      [.] __memmove_sse2_unaligned_erms
#5   1.67%  bench_decode  libc-2.24.so      [.] memcpy@GLIBC_2.2.5
#6   1.51%  bench_decode  bench_decode      [.] memcpy@plt
```

`memcpy` is eating up 8.65% of the total running time, and the overhead of dispatching to a specialized fast copy function (`memcpy@GLIBC` showing up) is clearly visible. The price of dynamic linking (`memcpy@plt` showing up) is visible too.

After this change, this is what `perf` reports:

```
#5   0.33%  bench_decode  libc-2.24.so      [.] __memmove_sse2_unaligned_erms
#14  0.01%  bench_decode  libc-2.24.so      [.] memcpy@GLIBC_2.2.5
```

Now only 0.34% of the running time is spent on memcopies. The dynamic linking overhead is not significant at all any more.

To add some more data, my program generates timing results for the operation in its main loop. These are the timings before and after the change:

| Time before   | Time after    | After/Before |
|---------------|---------------|--------------|
| 29.8 ± 0.8 ns | 23.6 ± 0.5 ns |  0.79 ± 0.03 |

The time is basically the total running time divided by a constant; the actual numbers are not important. This change reduced the total running time by 21% (much more than the original 9% spent on memmoves, likely because the CPU is stalling a lot less because data dependencies are more transparent). Of course YMMV and for most programs this will not matter at all. But when it does, the gains can be significant!

## Alternatives

* At first I implemented this in `io::Cursor`. I moved it to `&[T]::copy_from_slice()` instead, but this might be too intrusive, especially because it applies to all `T`, not just `u8`. To restrict this to `io::Read`, `<&[u8] as Read>::read()` is probably the best place.
* I tried copying bytes in a loop up to 64 or 8 bytes before calling `Read::read`, but both resulted in about a 20% slowdown instead of speedup.

7 years agojust add one method named creation_flags, fix the tidy error
Ted Mielczarek [Thu, 1 Dec 2016 02:31:47 +0000 (21:31 -0500)]
just add one method named creation_flags, fix the tidy error

7 years agoDocument that Process::command will search the PATH
Martin Pool [Sat, 26 Nov 2016 17:15:33 +0000 (09:15 -0800)]
Document that Process::command will search the PATH

7 years agoAdd std::os::windows::process::CommandExt, with set_creation_flags and add_creation_f...
Ted Mielczarek [Thu, 1 Dec 2016 00:44:07 +0000 (19:44 -0500)]
Add std::os::windows::process::CommandExt, with set_creation_flags and add_creation_flags methods. 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 agoAuto merge of #38047 - canndrew:fmt-void-non-empty, r=bluss
bors [Wed, 30 Nov 2016 23:40:10 +0000 (23:40 +0000)]
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.

7 years agoAdd tests.
Jeffrey Seyfried [Mon, 28 Nov 2016 07:57:17 +0000 (07:57 +0000)]
Add tests.

7 years agoSupport paths in macro invocations.
Jeffrey Seyfried [Sun, 27 Nov 2016 10:58:46 +0000 (10:58 +0000)]
Support paths in macro invocations.

7 years agoincr.comp.: Add more output to -Z incremental-info.
Michael Woerister [Wed, 30 Nov 2016 22:33:52 +0000 (17:33 -0500)]
incr.comp.: Add more output to -Z incremental-info.

7 years agoRemoved Option<ExitStatus> member from fuchsia Process struct. Destroy launchpads...
Theodore DeRego [Wed, 30 Nov 2016 22:20:44 +0000 (14:20 -0800)]
Removed Option<ExitStatus> member from fuchsia Process struct. Destroy launchpads and close handles in Drop impls rather than manually

7 years agoMinor cleanup.
Jeffrey Seyfried [Sun, 27 Nov 2016 10:27:41 +0000 (10:27 +0000)]
Minor cleanup.

7 years agoAdds `-Z mir-stats`, which is similar to `-Z hir-stats`.
Felix S. Klock II [Wed, 30 Nov 2016 17:14:17 +0000 (18:14 +0100)]
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.

7 years agoAuto merge of #37800 - alexcrichton:new-bootstrap, r=eddyb
bors [Wed, 30 Nov 2016 19:17:24 +0000 (19:17 +0000)]
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!

7 years agoUpdate the bootstrap compiler
Alex Crichton [Wed, 16 Nov 2016 17:19:02 +0000 (09:19 -0800)]
Update the bootstrap compiler

Now that we've got a beta build, let's use it!

7 years agoAdd cloned example for Option
Guillaume Gomez [Wed, 30 Nov 2016 17:44:33 +0000 (09:44 -0800)]
Add cloned example for Option

7 years agodebuginfo: Ignore macro-stepping test on aarch64
Michael Woerister [Wed, 30 Nov 2016 17:17:38 +0000 (12:17 -0500)]
debuginfo: Ignore macro-stepping test on aarch64

7 years agoAuto merge of #38014 - jseyfried:refactor_path_resolution, r=nrc
bors [Wed, 30 Nov 2016 16:02:18 +0000 (16:02 +0000)]
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

7 years agoRemove the `unmarked_api` feature
Johannes Oertel [Wed, 30 Nov 2016 14:23:11 +0000 (15:23 +0100)]
Remove the `unmarked_api` feature

Closes #37981.

7 years agoRefactor one_bound_for_assoc_type to take an Iterator instead of Vec.
Mark-Simulacrum [Sun, 27 Nov 2016 13:54:50 +0000 (06:54 -0700)]
Refactor one_bound_for_assoc_type to take an Iterator instead of Vec.

7 years agoAuto merge of #37989 - nrc:save-mod, r=nikomatsakis
bors [Wed, 30 Nov 2016 12:50:09 +0000 (12:50 +0000)]
Auto merge of #37989 - nrc:save-mod, r=nikomatsakis

save-analysis: redirect a module decl to the start of the defining file

7 years agoAdd i686-unknown-openbsd target.
Sébastien Marie [Tue, 29 Nov 2016 17:49:09 +0000 (18:49 +0100)]
Add i686-unknown-openbsd target.

7 years agoMove small-copy optimization into <&[u8] as Read>
Ruud van Asseldonk [Sat, 12 Nov 2016 14:58:58 +0000 (15:58 +0100)]
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.

7 years agoMove small-copy optimization into copy_from_slice
Ruud van Asseldonk [Thu, 3 Nov 2016 23:20:11 +0000 (00:20 +0100)]
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.

7 years agoAdd small-copy optimization for io::Cursor
Ruud van Asseldonk [Wed, 2 Nov 2016 21:49:27 +0000 (22:49 +0100)]
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.

7 years agoAuto merge of #37954 - eddyb:rustdoc-2, r=alexcrichton
bors [Wed, 30 Nov 2016 07:46:00 +0000 (07:46 +0000)]
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.

7 years agoAdd missing examples for IpAddr enum
Guillaume Gomez [Tue, 29 Nov 2016 22:28:16 +0000 (14:28 -0800)]
Add missing examples for IpAddr enum

7 years agorustdoc: link to cross-crate sources directly.
Eduard-Mihai Burtescu [Tue, 29 Nov 2016 06:15:16 +0000 (08:15 +0200)]
rustdoc: link to cross-crate sources directly.

7 years agorustc: track the Span's of definitions across crates.
Eduard-Mihai Burtescu [Wed, 23 Nov 2016 23:39:13 +0000 (01:39 +0200)]
rustc: track the Span's of definitions across crates.

7 years agoAuto merge of #37965 - Mark-Simulacrum:trait-obj-to-exis-predicate, r=eddyb
bors [Wed, 30 Nov 2016 02:41:38 +0000 (20:41 -0600)]
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),
}
```

7 years agorustdoc: fix up --playground-url
Liigo Zhuang [Wed, 30 Nov 2016 02:25:08 +0000 (10:25 +0800)]
rustdoc: fix up --playground-url

7 years agounstable --playground-url, add test code
Liigo Zhuang [Mon, 28 Nov 2016 04:49:33 +0000 (12:49 +0800)]
unstable --playground-url, add test code

7 years agorustdoc: get back missing crate-name when --playground-url is used
Liigo Zhuang [Fri, 18 Nov 2016 02:40:51 +0000 (10:40 +0800)]
rustdoc: get back missing crate-name when --playground-url is used

follow up PR #37763

7 years agoAdd new #[target_feature = "..."] attribute.
Andrew Gallant [Wed, 30 Nov 2016 00:02:00 +0000 (19:02 -0500)]
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.

7 years agoAuto merge of #37863 - mikhail-m1:mut_error, r=nikomatsakis
bors [Tue, 29 Nov 2016 23:27:00 +0000 (17:27 -0600)]
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

7 years agorustc: simplify AdtDef by removing the field types and ty::ivar.
Eduard-Mihai Burtescu [Thu, 24 Nov 2016 23:33:29 +0000 (01:33 +0200)]
rustc: simplify AdtDef by removing the field types and ty::ivar.

7 years agorustc: remove type information from TraitDef.
Eduard-Mihai Burtescu [Fri, 25 Nov 2016 00:29:26 +0000 (02:29 +0200)]
rustc: remove type information from TraitDef.