]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoMove the myriad-closures.rs test case to run-pass-full test suite.
Michael Woerister [Tue, 22 Nov 2016 20:16:54 +0000 (15:16 -0500)]
Move the myriad-closures.rs test case to run-pass-full test suite.

7 years agoAuto merge of #37834 - bluss:peek-none, r=BurntSushi
bors [Tue, 22 Nov 2016 09:29:46 +0000 (03:29 -0600)]
Auto merge of #37834 - bluss:peek-none, r=BurntSushi

Make Peekable remember peeking a None

Peekable should remember if a None has been seen in the `.peek()` method.
It ensures that `.peek(); .peek();` or `.peek(); .next();` only advances the
underlying iterator at most once. This does not by itself make the iterator
fused.

Thanks to @s3bk for the code in `fn peek()` itself.

Fixes #37784

7 years agoAuto merge of #37602 - jseyfried:directory_ownership, r=nikomatsakis
bors [Tue, 22 Nov 2016 03:15:48 +0000 (21:15 -0600)]
Auto merge of #37602 - jseyfried:directory_ownership, r=nikomatsakis

parser: simplify directory ownership semantics

This PR simplifies the semantics of "directory ownership". After this PR,
 - a non-inline module without a `#[path]` attribute (e.g. `mod foo;`) is allowed iff its parent module/block (whichever is nearer) is a directory owner,
 - an non-inline module is a directory owner iff its corresponding file is named `mod.rs` (c.f. [comment](https://github.com/rust-lang/rust/issues/32401#issuecomment-201021902)),
 - a block is never a directory owner (c.f. #31534), and
 - an inline module is a directory owner iff either
   - its parent module/block is a directory owner (again, c.f. #31534), or
   - it has a `#[path]` attribute (c.f. #36789).

These semantics differ from today's in three orthogonal ways:
 - `#[path = "foo.rs"] mod foo;` is no longer a directory owner. This is a [breaking-change].
 - #36789 is generalized to apply to modules that are not directory owners in addition to blocks.
 - A macro-expanded non-inline module is only allowed where an ordinary non-inline module would be allowed. Today, we incorrectly allow macro-expanded non-inline modules in modules that are not directory owners (but not in blocks). This is a [breaking-change].

Fixes #32401.
r? @nikomatsakis

7 years agoStart warning cycle.
Jeffrey Seyfried [Mon, 14 Nov 2016 09:31:03 +0000 (09:31 +0000)]
Start warning cycle.

7 years agoFix fallout in tests.
Jeffrey Seyfried [Sat, 5 Nov 2016 10:46:44 +0000 (10:46 +0000)]
Fix fallout in tests.

7 years agoAdd a regression test and organize tests.
Jeffrey Seyfried [Sat, 5 Nov 2016 05:31:35 +0000 (05:31 +0000)]
Add a regression test and organize tests.

7 years agoClean up directory ownership semantics.
Jeffrey Seyfried [Sat, 5 Nov 2016 04:16:26 +0000 (04:16 +0000)]
Clean up directory ownership semantics.

7 years agoAuto merge of #37642 - nnethercote:no-HirVec-of-P, r=michaelwoerister
bors [Mon, 21 Nov 2016 23:59:10 +0000 (17:59 -0600)]
Auto merge of #37642 - nnethercote:no-HirVec-of-P, r=michaelwoerister

Change HirVec<P<T>> to HirVec<T> in hir:: Expr.

This PR changes data structures like this:
```
[ ExprArray | 8 | P ]
                  |
                  v
                  [ P | P | P | P | P | P | P | P ]
                    |
                    v
                    [ ExprTup | 2 | P ]
                                    |
                                    v
                                    [ P | P ]
                                      |
                                      v
                                      [ Expr ]
```
to this:
```
[ ExprArray | 8 | P ]
                  |
                  v
                  [ [ ExprTup | 2 | P ] | ... ]
                                    |
                                    v
                                    [ Expr | Expr ]
```
I thought this would be a win for #36799, and on a cut-down version of that workload this reduces the peak heap size (as measured by Massif) from 885 MiB to 875 MiB. However, the peak RSS as measured by `-Ztime-passes` and by `/usr/bin/time` increases by about 30 MiB.

I'm not sure why. Just look at the picture above -- the second data structure clearly takes up less space than the first. My best idea relates to unused elements in the slices. `HirVec<Expr>` is a typedef for `P<[Expr]>`. If there were any unused excess elements then I could see that memory usage would increase, because those excess elements are larger in `HirVec<Expr>` than in `HirVec<P<Expr>>`. But AIUI there are no such excess elements, and Massif's measurements corroborate that.

However, the two main creation points for these data structures are these lines from `lower_expr`:
```rust
        ExprKind::Vec(ref exprs) => {
            hir::ExprArray(exprs.iter().map(|x| self.lower_expr(x)).collect())
        }
        ExprKind::Tup(ref elts) => {
            hir::ExprTup(elts.iter().map(|x| self.lower_expr(x)).collect())
        }
```
I suspect what is happening is that temporary excess elements are created within the `collect` calls. The workload from #36799 has many 2-tuples and 3-tuples and when `Vec` gets doubled it goes from a capacity of 1 to 4, which would lead to excess elements. Though, having said that, `Vec::with_capacity` doesn't create excess AFAICT. So I'm not sure. What goes on inside `collect` is complex.

Anyway, in its current form this PR is a memory consumption regression and so not worth landing but I figured I'd post it in case anyone has additional insight.

7 years agoChange HirVec<P<T>> to HirVec<T> in Expr.
Nicholas Nethercote [Fri, 28 Oct 2016 10:16:44 +0000 (21:16 +1100)]
Change HirVec<P<T>> to HirVec<T> in Expr.

This changes structures like this:
```
[ ExprArray | 8 | P ]
                  |
                  v
                  [ P | P | P | P | P | P | P | P ]
                    |
                    v
                    [ ExprTup | 2 | P ]
                                    |
                                    v
                                    [ P | P ]
                                      |
                                      v
                                      [ Expr ]
```
to this:
```
[ ExprArray | 8 | P ]
                  |
                  v
                  [ [ ExprTup | 2 | P ] | ... ]
                                    |
                                    v
                                    [ Expr | Expr ]
```

7 years agoAuto merge of #37677 - jsen-:master, r=alexcrichton
bors [Mon, 21 Nov 2016 20:37:24 +0000 (14:37 -0600)]
Auto merge of #37677 - jsen-:master, r=alexcrichton

libstd: support creation of anonymous pipe on WinXP/2K3

`PIPE_REJECT_REMOTE_CLIENTS` flag is not supported on Windows < VISTA, and every invocation of `anon_pipe` including attempts to pipe `std::process::Child`'s stdio fails.
This PR should work around this issue by performing a runtime check of windows version and conditionally omitting this flag on "XP and friends".

Getting the version should be probably moved out of the function `anon_pipe` itself (the OS version does not often change during runtime :) ), but:
 - I didn't find any precedent for this and assuming there's not much overhead (I hope windows does not perform any heuristics to find out it's own version, just fills couple of fields in the struct).
 - the code path is not especially performance sensitive anyway.

7 years agoAuto merge of #37912 - sanxiyn:llvm-compat, r=eddyb
bors [Mon, 21 Nov 2016 17:23:04 +0000 (11:23 -0600)]
Auto merge of #37912 - sanxiyn:llvm-compat, r=eddyb

Restore compatibility with LLVM 3.7 and 3.8

This should fix Travis build.

7 years agoAuto merge of #37824 - jseyfried:symbols, r=eddyb
bors [Mon, 21 Nov 2016 14:08:47 +0000 (08:08 -0600)]
Auto merge of #37824 - jseyfried:symbols, r=eddyb

Clean up `ast::Attribute`, `ast::CrateConfig`, and string interning

This PR
 - removes `ast::Attribute_` (changing `Attribute` from `Spanned<Attribute_>` to a struct),
 - moves a `MetaItem`'s name from the `MetaItemKind` variants to a field of `MetaItem`,
 - avoids needlessly wrapping `ast::MetaItem` with `P`,
 - moves string interning into `syntax::symbol` (`ast::Name` is a reexport of `symbol::Symbol` for now),
 - replaces `InternedString` with `Symbol` in the AST, HIR, and various other places, and
 - refactors `ast::CrateConfig` from a `Vec` to a `HashSet`.

r? @eddyb

7 years agoFix fallout in `rustdoc` and tests.
Jeffrey Seyfried [Thu, 17 Nov 2016 14:04:36 +0000 (14:04 +0000)]
Fix fallout in `rustdoc` and tests.

7 years agoRestore compatibility with LLVM 3.7 and 3.8
Seo Sanghyeon [Mon, 21 Nov 2016 11:30:05 +0000 (20:30 +0900)]
Restore compatibility with LLVM 3.7 and 3.8

7 years agoAuto merge of #37127 - jseyfried:stabilize_RFC_1560, r=nrc
bors [Mon, 21 Nov 2016 10:54:46 +0000 (04:54 -0600)]
Auto merge of #37127 - jseyfried:stabilize_RFC_1560, r=nrc

Stabilize RFC 1560

Fixes #13598, fixes #23157, fixes #32303.
cc #35120
r? @nrc

7 years agoFix fallout in tests.
Jeffrey Seyfried [Thu, 13 Oct 2016 08:05:03 +0000 (08:05 +0000)]
Fix fallout in tests.

7 years agoCleanup.
Jeffrey Seyfried [Tue, 11 Oct 2016 07:47:21 +0000 (07:47 +0000)]
Cleanup.

7 years agoStabilize RFC 1560.
Jeffrey Seyfried [Fri, 30 Sep 2016 00:03:16 +0000 (00:03 +0000)]
Stabilize RFC 1560.

7 years agoFix incremental compilation hashing.
Jeffrey Seyfried [Sun, 20 Nov 2016 00:32:54 +0000 (00:32 +0000)]
Fix incremental compilation hashing.

7 years agoRemove `Rc` from the interner.
Jeffrey Seyfried [Sat, 19 Nov 2016 05:55:28 +0000 (05:55 +0000)]
Remove `Rc` from the interner.

7 years agoCleanup `InternedString`.
Jeffrey Seyfried [Thu, 17 Nov 2016 14:04:20 +0000 (14:04 +0000)]
Cleanup `InternedString`.

7 years agoUse `Symbol` instead of `InternedString` in the AST, HIR, and various other places.
Jeffrey Seyfried [Wed, 16 Nov 2016 10:52:37 +0000 (10:52 +0000)]
Use `Symbol` instead of `InternedString` in the AST, HIR, and various other places.

7 years agoAuto merge of #37895 - jseyfried:fix_proc_macro_deps, r=nrc
bors [Mon, 21 Nov 2016 06:16:51 +0000 (00:16 -0600)]
Auto merge of #37895 - jseyfried:fix_proc_macro_deps, r=nrc

Fix bug involving proc-macro dependencies

Fixes #37893.
r? @nrc

7 years agoMove `syntax::util::interner` -> `syntax::symbol`, cleanup.
Jeffrey Seyfried [Wed, 16 Nov 2016 08:21:52 +0000 (08:21 +0000)]
Move `syntax::util::interner` -> `syntax::symbol`, cleanup.

7 years agoAuto merge of #37888 - bluss:chars-count, r=alexcrichton
bors [Sun, 20 Nov 2016 23:06:53 +0000 (17:06 -0600)]
Auto merge of #37888 - bluss:chars-count, r=alexcrichton

Improve .chars().count()

Use a simpler loop to count the `char` of a string: count the
number of non-continuation bytes. Use `count += <conditional>` which the
compiler understands well and can apply loop optimizations to.

benchmark descriptions and results for two configurations:

- ascii: ascii text
- cy: cyrillic text
- jp: japanese text
- words ascii: counting each split_whitespace item from the ascii text
- words jp: counting each split_whitespace item from the jp text

```
x86-64 rustc -Copt-level=3
 name               orig_ ns/iter      cmov_ ns/iter      diff ns/iter   diff %
 count_ascii        1,453 (1755 MB/s)  1,398 (1824 MB/s)           -55   -3.79%
 count_cy           5,990 (856 MB/s)   2,545 (2016 MB/s)        -3,445  -57.51%
 count_jp           3,075 (1169 MB/s)  1,772 (2029 MB/s)        -1,303  -42.37%
 count_words_ascii  4,157 (521 MB/s)   1,797 (1205 MB/s)        -2,360  -56.77%
 count_words_jp     3,337 (1071 MB/s)  1,772 (2018 MB/s)        -1,565  -46.90%

x86-64 rustc -Ctarget-feature=+avx -Copt-level=3
 name               orig_ ns/iter      cmov_ ns/iter      diff ns/iter   diff %
 count_ascii        1,444 (1766 MB/s)  763 (3343 MB/s)            -681  -47.16%
 count_cy           5,871 (874 MB/s)   1,527 (3360 MB/s)        -4,344  -73.99%
 count_jp           2,874 (1251 MB/s)  1,073 (3351 MB/s)        -1,801  -62.67%
 count_words_ascii  4,131 (524 MB/s)   1,871 (1157 MB/s)        -2,260  -54.71%
 count_words_jp     3,253 (1099 MB/s)  1,331 (2686 MB/s)        -1,922  -59.08%
```

I briefly explored a more involved blocked algorithm (looking at 8 or more bytes at a time),
but the code in this PR was always winning `count_words_ascii` in particular (counting
many small strings); this solution is an improvement without tradeoffs.

7 years agosupport creation of anonymous pipe on WinXP/2K3
jsen- [Thu, 10 Nov 2016 01:00:25 +0000 (02:00 +0100)]
support creation of anonymous pipe on WinXP/2K3

7 years agoAuto merge of #37862 - shepmaster:llvm-4.0-always-set-eh-personality, r=eddyb
bors [Sun, 20 Nov 2016 19:50:47 +0000 (13:50 -0600)]
Auto merge of #37862 - shepmaster:llvm-4.0-always-set-eh-personality, r=eddyb

[LLVM 4.0] Set EH personality when resuming stack unwinding

To resume stack unwinding, the LLVM `resume` instruction must be used.

In order to use this instruction, the calling function must have an
exception handling personality set.

LLVM 4.0 adds a new IR validation check to ensure a personality is
always set in these cases.

This was introduced in [r277360](https://reviews.llvm.org/rL277360).

7 years agoAuto merge of #37896 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Sun, 20 Nov 2016 16:36:25 +0000 (10:36 -0600)]
Auto merge of #37896 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 8 pull requests

- Successful merges: #37835, #37840, #37841, #37848, #37876, #37880, #37881, #37882
- Failed merges:

7 years agoRollup merge of #37882 - ollie27:chars_last, r=bluss
Guillaume Gomez [Sun, 20 Nov 2016 14:00:05 +0000 (15:00 +0100)]
Rollup merge of #37882 - ollie27:chars_last, r=bluss

Optimise Chars::last()

The default implementation of last() goes through the entire iterator
but that's not needed here.

7 years agoRollup merge of #37881 - ollie27:rustdoc_stab_enum_macro, r=alexcrichton
Guillaume Gomez [Sun, 20 Nov 2016 14:00:05 +0000 (15:00 +0100)]
Rollup merge of #37881 - ollie27:rustdoc_stab_enum_macro, r=alexcrichton

rustdoc: Remove unnecessary stability versions

For some reason only on enum and macro pages, the stability version is
rendered after the summary unlike all other pages. As it is already
displayed at the top of the page for all items, this removes it for
consistency and to prevent it from overlapping the summary text.

Fixes #36093

7 years agoRollup merge of #37880 - GuillaumeGomez:socket-4-doc, r=frewsxcv
Guillaume Gomez [Sun, 20 Nov 2016 14:00:05 +0000 (15:00 +0100)]
Rollup merge of #37880 - GuillaumeGomez:socket-4-doc, r=frewsxcv

Add missing examples in SocketAddr

r? @frewsxcv

7 years agoRollup merge of #37876 - birkenfeld:patch-1, r=apasel422
Guillaume Gomez [Sun, 20 Nov 2016 14:00:05 +0000 (15:00 +0100)]
Rollup merge of #37876 - birkenfeld:patch-1, r=apasel422

reference: fix duplicate bullet points in feature list

7 years agoRollup merge of #37848 - nnethercote:UnificationTable-probe, r=arielb1
Guillaume Gomez [Sun, 20 Nov 2016 14:00:04 +0000 (15:00 +0100)]
Rollup merge of #37848 - nnethercote:UnificationTable-probe, r=arielb1

Don't clone in UnificationTable::probe().

This speeds up compilation of rustc-benchmarks/inflate-0.1.0 by 1%.

7 years agoRollup merge of #37841 - michaelwoerister:ich-loop-tests, r=nikomatsakis
Guillaume Gomez [Sun, 20 Nov 2016 14:00:04 +0000 (15:00 +0100)]
Rollup merge of #37841 - michaelwoerister:ich-loop-tests, r=nikomatsakis

ICH: Add regression tests for various kinds of loops.

r? @nikomatsakis

7 years agoRollup merge of #37840 - brcooley:patch-1, r=steveklabnik
Guillaume Gomez [Sun, 20 Nov 2016 14:00:04 +0000 (15:00 +0100)]
Rollup merge of #37840 - brcooley:patch-1, r=steveklabnik

Fix grammar error in lifetimes.md

7 years agoRollup merge of #37835 - ojsheikh:E0088, r=jonathandturner
Guillaume Gomez [Sun, 20 Nov 2016 14:00:04 +0000 (15:00 +0100)]
Rollup merge of #37835 - ojsheikh:E0088, r=jonathandturner

Update E0088 to new error format

Fixes #35226 which is part of #35233. Is based on #36208 from @yossi-k.

r? @jonathandturner

7 years agoAdd regression test.
Jeffrey Seyfried [Sun, 20 Nov 2016 13:45:58 +0000 (13:45 +0000)]
Add regression test.

7 years agoFix bug in proc-macro dependencies.
Jeffrey Seyfried [Sun, 20 Nov 2016 13:28:31 +0000 (13:28 +0000)]
Fix bug in proc-macro dependencies.

7 years agoAuto merge of #37861 - shepmaster:llvm-4.0-inline-pass, r=alexcrichton
bors [Sun, 20 Nov 2016 13:26:03 +0000 (07:26 -0600)]
Auto merge of #37861 - shepmaster:llvm-4.0-inline-pass, r=alexcrichton

[LLVM 4.0] Update AlwaysInliner pass header and constructor

7 years agoRefactor `P<ast::MetaItem>` -> `ast::MetaItem`.
Jeffrey Seyfried [Tue, 15 Nov 2016 10:17:24 +0000 (10:17 +0000)]
Refactor `P<ast::MetaItem>` -> `ast::MetaItem`.

7 years agoMove `MetaItemKind`'s `Name` to a field of `MetaItem`.
Jeffrey Seyfried [Tue, 15 Nov 2016 07:37:10 +0000 (07:37 +0000)]
Move `MetaItemKind`'s `Name` to a field of `MetaItem`.

7 years agoRefactor `CrateConfig`.
Jeffrey Seyfried [Tue, 15 Nov 2016 08:54:27 +0000 (08:54 +0000)]
Refactor `CrateConfig`.

7 years agoRefactor `MetaItemKind` to use `Name`s instead of `InternedString`s.
Jeffrey Seyfried [Tue, 15 Nov 2016 04:34:52 +0000 (04:34 +0000)]
Refactor `MetaItemKind` to use `Name`s instead of `InternedString`s.

7 years agoAvoid clearing the string interner.
Jeffrey Seyfried [Fri, 18 Nov 2016 22:58:16 +0000 (22:58 +0000)]
Avoid clearing the string interner.

7 years agoRefactor away `ast::Attribute_`.
Jeffrey Seyfried [Mon, 14 Nov 2016 12:00:25 +0000 (12:00 +0000)]
Refactor away `ast::Attribute_`.

7 years agoAuto merge of #37855 - tbu-:pr_fix_debug_str, r=alexcrichton
bors [Sun, 20 Nov 2016 09:13:58 +0000 (03:13 -0600)]
Auto merge of #37855 - tbu-:pr_fix_debug_str, r=alexcrichton

Fix `fmt::Debug` for strings, e.g. for Chinese characters

The problem occured due to lines like

```
3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
```

in `UnicodeData.txt`, which the script previously interpreted as two
characters, although it represents the whole range.

Fixes #34318.

7 years agoAuto merge of #37842 - nikomatsakis:incremental-test, r=mw
bors [Sun, 20 Nov 2016 05:39:25 +0000 (23:39 -0600)]
Auto merge of #37842 - nikomatsakis:incremental-test, r=mw

Add tests for incremental reuse scenarios

These are microbenchmarks checking that we achieve the expected reuse in the scenarios covered by incremental beta.

r? @michaelwoerister

7 years agoAuto merge of #37833 - sfackler:process-abort, r=alexcrichton
bors [Sun, 20 Nov 2016 02:01:52 +0000 (20:01 -0600)]
Auto merge of #37833 - sfackler:process-abort, r=alexcrichton

Add std::process::abort

This calls libc abort on Unix and fastfail on Windows, first running
cleanups to do things like flush stdout buffers. This matches with libc
abort's behavior, which flushes open files.

r? @alexcrichton

7 years agoOptimise CharIndices::last()
Oliver Middleton [Sun, 20 Nov 2016 00:37:48 +0000 (00:37 +0000)]
Optimise CharIndices::last()

The default implementation of last() goes through the entire iterator
but that's not needed here.

7 years agostr: Improve .chars().count()
Ulrik Sverdrup [Sat, 19 Nov 2016 22:18:43 +0000 (23:18 +0100)]
str: Improve .chars().count()

Use a simpler loop to count the `char` of a string: count the
number of non-continuation bytes. Use `count += <conditional>` which the
compiler understands well and can apply loop optimizations to.

7 years agoAuto merge of #37831 - rkruppe:llvm-attr-fwdcompat, r=eddyb
bors [Sat, 19 Nov 2016 22:39:25 +0000 (16:39 -0600)]
Auto merge of #37831 - rkruppe:llvm-attr-fwdcompat, r=eddyb

[LLVM 4.0] Use llvm::Attribute APIs instead of "raw value" APIs

The latter will be removed in LLVM 4.0 (see https://github.com/llvm-mirror/llvm/commit/4a6fc8bacf11d8066da72cf8481467167877ed16).

The librustc_llvm API remains mostly unchanged, except that llvm::Attribute is no longer a bitflag but represents only a *single* attribute.
The ability to store many attributes in a small number of bits and modify them without interacting with LLVM is only used in rustc_trans::abi and closely related modules, and only attributes for function arguments are considered there.
Thus rustc_trans::abi now has its own bit-packed representation of argument attributes, which are translated to rustc_llvm::Attribute when applying the attributes.

cc #37609

7 years agoAdd missing examples in SocketAddr
Guillaume Gomez [Sat, 19 Nov 2016 17:33:32 +0000 (18:33 +0100)]
Add missing examples in SocketAddr

7 years agoAuto merge of #37826 - keeperofdakeys:proc-macro-test, r=alexcrichton
bors [Sat, 19 Nov 2016 19:28:50 +0000 (13:28 -0600)]
Auto merge of #37826 - keeperofdakeys:proc-macro-test, r=alexcrichton

Show a better error when using --test with #[proc_macro_derive]

Fixes https://github.com/rust-lang/rust/issues/37480

Currently using `--test` with a crate that contains a `#[proc_macro_derive]` attribute causes an error. This PR doesn't attempt to fix the issue itself, or determine what tesing of a proc_macro_derive crate should be - just to provide a better error message.

7 years agoOptimise Chars::last()
Oliver Middleton [Sat, 19 Nov 2016 18:43:41 +0000 (18:43 +0000)]
Optimise Chars::last()

The default implementation of last() goes through the entire iterator
but that's not needed here.

7 years agorustdoc: Remove unnecessary stability versions
Oliver Middleton [Sat, 19 Nov 2016 17:22:33 +0000 (17:22 +0000)]
rustdoc: Remove unnecessary stability versions

For some reason only on enum and macro pages, the stability version is
rendered after the summary unlike all other pages. As it is already
displayed at the top of the page for all items, this removes it for
consistency and to prevent it from overlapping the summary text.

7 years agoAuto merge of #37822 - cuviper:llvm-link-shared, r=alexcrichton
bors [Sat, 19 Nov 2016 16:08:26 +0000 (08:08 -0800)]
Auto merge of #37822 - cuviper:llvm-link-shared, r=alexcrichton

rustbuild: allow dynamically linking LLVM

The makefiles and `mklldeps.py` called `llvm-config --shared-mode` to
find out if LLVM defaulted to shared or static libraries, and just went
with that.  But under rustbuild, `librustc_llvm/build.rs` was assuming
that LLVM should be static, and even forcing `--link-static` for 3.9+.

Now that build script also uses `--shared-mode` to learn the default,
which should work better for pre-3.9 configured for dynamic linking, as
it wasn't possible back then to choose differently via `llvm-config`.

Further, the configure script now has a new `--enable-llvm-link-shared`
option, which allows one to manually override `--link-shared` on 3.9+
instead of forcing static.

Update: There are now four static/shared scenarios that can happen
for the supported LLVM versions:

- 3.9+: By default use `llvm-config --link-static`
- 3.9+ and `--enable-llvm-link-shared`: Use `--link-shared` instead.
- 3.8: Use `llvm-config --shared-mode` and go with its answer.
- 3.7: Just assume static, maintaining the status quo.

7 years agoAuto merge of #37814 - japaric:aapcs, r=alexcrichton
bors [Sat, 19 Nov 2016 12:58:48 +0000 (04:58 -0800)]
Auto merge of #37814 - japaric:aapcs, r=alexcrichton

fix `extern "aapcs" fn`

to actually use the AAPCS calling convention

closes #37810

This is technically a [breaking-change] because it changes the ABI of
`extern "aapcs"` functions that (a) involve `f32`/`f64` arguments/return
values and (b) are compiled for arm-eabihf targets from
"aapcs-vfp" (wrong) to "aapcs" (correct).

Appendix:

What these ABIs mean?

- In the "aapcs-vfp" ABI or "hard float" calling convention: Floating
point values are passed/returned through FPU registers (s0, s1, d0, etc.)

- Whereas, in the "aapcs" ABI or "soft float" calling convention:
Floating point values are passed/returned through general purpose
registers (r0, r1, etc.)

Mixing these ABIs can cause problems if the caller assumes that the
routine is using one of these ABIs but it's actually using the other
one.

---

r? @alexcrichton We are going this `extern "aapcs" fn` thing to implement some intrinsics (floatundidf) for the eabihf targets in order to comply with LLVM's calling convention of intrinsics.

Oh, and the value of the enum came from [here](http://llvm.org/docs/doxygen/html/namespacellvm_1_1CallingConv.html).

cc @TimNN @parched

7 years agoreference: fix duplicate bullet points in feature list
Georg Brandl [Sat, 19 Nov 2016 12:57:48 +0000 (13:57 +0100)]
reference: fix duplicate bullet points in feature list

7 years agoAuto merge of #37797 - arielb1:inline-closure, r=michaelwoerister
bors [Sat, 19 Nov 2016 09:49:07 +0000 (01:49 -0800)]
Auto merge of #37797 - arielb1:inline-closure, r=michaelwoerister

instantiate closures on demand

this should fix compilation with `-C codegen-units=4` - tested locally
with `RUSTFLAGS='-C codegen-units=4' ../x.py test`

r? @michaelwoerister

7 years agoAuto merge of #37853 - TimNN:fix-travis, r=alexcrichton
bors [Sat, 19 Nov 2016 06:39:08 +0000 (22:39 -0800)]
Auto merge of #37853 - TimNN:fix-travis, r=alexcrichton

fix travis: update Cargo.lock

7 years agoAuto merge of #37787 - michaelwoerister:macro-def-ich, r=nikomatsakis
bors [Sat, 19 Nov 2016 03:21:47 +0000 (19:21 -0800)]
Auto merge of #37787 - michaelwoerister:macro-def-ich, r=nikomatsakis

ICH: Handle MacroDef HIR instances.

As of recently, `hir::MacroDef` instances are exported in crate metadata, which means we also store their ICH when doing incremental compilation. Even though exported macro definitions should not (yet) interact with incremental compilation, the ICH is also used for the general purpose crate hash, where macros should be included.

This PR implements ICH computation for `MacroDef`. In theory, the ICH of these MacroDefs is less stable than that of other HIR items, since I opted to just call the compiler-generated `Hash::hash()` for `Token::Interpolated` variants. `Token::Interpolated` contains AST data structures and it would have been a lot of effort to expand ICH computation to the AST too. Since quasi-quoting is rarely used *and* it would only make a difference if incremental compilation was extended to macros, the simpler implementation seemed like a good idea.

This fixes the problem reported in https://github.com/rust-lang/rust/issues/37756. The test still fails because of broken codegen-unit support though.

r? @nikomatsakis

7 years agoAuto merge of #37867 - brson:no-lexer-verify, r=alexcrichton
bors [Fri, 18 Nov 2016 23:04:27 +0000 (15:04 -0800)]
Auto merge of #37867 - brson:no-lexer-verify, r=alexcrichton

Don't build the lexer verifier during tidy

Tidy is not the right place to do this. Tidy is for running lints.
We should instead be running the lexer/grammar tests as part of the test
suite.

This may fix nightly breakage, but I don't understand why.

https://buildbot.rust-lang.org/builders/nightly-dist-rustc-linux/builds/715/steps/distcheck/logs/stdio

r? @alexcrichton

cc @dns2utf8

7 years agoAdd span to warning about incr. comp. vs Token::Interpolated.
Michael Woerister [Wed, 16 Nov 2016 15:18:46 +0000 (10:18 -0500)]
Add span to warning about incr. comp. vs Token::Interpolated.

7 years agoAdd test case for exported macros vs incremental compilation.
Michael Woerister [Tue, 15 Nov 2016 21:16:40 +0000 (16:16 -0500)]
Add test case for exported macros vs incremental compilation.

7 years agoRemove outdated comment about SVH.
Michael Woerister [Tue, 15 Nov 2016 20:22:15 +0000 (15:22 -0500)]
Remove outdated comment about SVH.

7 years agoICH: Hash MacroDefs in a mostly stable way.
Michael Woerister [Tue, 15 Nov 2016 20:20:39 +0000 (15:20 -0500)]
ICH: Hash MacroDefs in a mostly stable way.

7 years agoAdd error message when not finding the ICH of a DepNode.
Michael Woerister [Tue, 15 Nov 2016 16:55:34 +0000 (11:55 -0500)]
Add error message when not finding the ICH of a DepNode.

7 years agoDon't build the lexer verifier during tidy
Brian Anderson [Fri, 18 Nov 2016 20:37:25 +0000 (20:37 +0000)]
Don't build the lexer verifier during tidy

Tidy is not the right place to do this. Tidy is for running lints.
We should instead be running the lexer/grammar tests as part of the test
suite.

This may fix nightly breakage, but I don't know why.

7 years agoAuto merge of #37776 - nrc:save-double-angle, r=@brson
bors [Fri, 18 Nov 2016 19:45:53 +0000 (11:45 -0800)]
Auto merge of #37776 - nrc:save-double-angle, r=@brson

save-analysis: handle << and >> operators inside [] in types

Fixes #37700

7 years agoremove FIXMEs; issue fixed
Niko Matsakis [Fri, 18 Nov 2016 18:35:42 +0000 (13:35 -0500)]
remove FIXMEs; issue fixed

7 years ago[LLVM 4.0] Set EH personality when resuming stack unwinding
Dylan McKay [Sat, 1 Oct 2016 13:04:42 +0000 (02:04 +1300)]
[LLVM 4.0] Set EH personality when resuming stack unwinding

To resume stack unwinding, the LLVM `resume` instruction must be used.

In order to use this instruction, the calling function must have an
exception handling personality set.

LLVM 4.0 adds a new IR validation check to ensure a personality is
always set in these cases.

This was introduced in [r277360](https://reviews.llvm.org/rL277360).

7 years agoAuto merge of #37749 - keeperofdakeys:should-panic, r=alexcrichton
bors [Fri, 18 Nov 2016 16:24:00 +0000 (08:24 -0800)]
Auto merge of #37749 - keeperofdakeys:should-panic, r=alexcrichton

Improvements to the #[should_panic] feature

Add more error checking for the `#[should_panic]` attribute, and print the expected panic string when it does not match.

Fixes https://github.com/rust-lang/rust/issues/29000

Eg:
```running 3 tests
test test2 ... ok
test test1 ... FAILED
: Panic did not include expected string 'foo'
test test3 ... FAILED

failures:

---- test1 stdout ----
thread 'test1' panicked at 'bar', test.rs:7
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- test3 stdout ----
thread 'test3' panicked at 'bar', test.rs:18

```

7 years ago[LLVM 4.0] Update AlwaysInliner pass header and constructor
Jake Goulding [Sat, 24 Sep 2016 16:37:04 +0000 (12:37 -0400)]
[LLVM 4.0] Update AlwaysInliner pass header and constructor

7 years agoimprove comments
Niko Matsakis [Fri, 18 Nov 2016 14:42:47 +0000 (09:42 -0500)]
improve comments

7 years agoadd test for adding a field
Niko Matsakis [Thu, 17 Nov 2016 20:50:25 +0000 (15:50 -0500)]
add test for adding a field

7 years agoadd test for changing pub inherent method signature
Niko Matsakis [Thu, 17 Nov 2016 20:16:44 +0000 (15:16 -0500)]
add test for changing pub inherent method signature

7 years agoadd test for changing pub inherent method body
Niko Matsakis [Thu, 17 Nov 2016 20:07:17 +0000 (15:07 -0500)]
add test for changing pub inherent method body

Ideally, callers should not be affected, but they currently are.

7 years agoFix `fmt::Debug` for strings, e.g. for Chinese characters
Tobias Bucher [Fri, 18 Nov 2016 12:59:44 +0000 (13:59 +0100)]
Fix `fmt::Debug` for strings, e.g. for Chinese characters

The problem occured due to lines like

```
3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;;
4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;;
```

in `UnicodeData.txt`, which the script previously interpreted as two
characters, although it represents the whole range.

Fixes #34318.

7 years agoAuto merge of #37769 - alexcrichton:rustbuild-python, r=brson
bors [Fri, 18 Nov 2016 13:03:03 +0000 (05:03 -0800)]
Auto merge of #37769 - alexcrichton:rustbuild-python, r=brson

rustbuild: Allow configuration of python interpreter

Add a configuration key to `config.toml`, read it from `./configure`, and add
auto-detection if none of those were specified.

Closes #35760

7 years agoupdate Cargo.lock
Tim Neumann [Fri, 18 Nov 2016 10:31:44 +0000 (11:31 +0100)]
update Cargo.lock

7 years agoWarn when a #[should_panic] test has an unexpected message
Josh Driver [Fri, 18 Nov 2016 10:31:19 +0000 (21:01 +1030)]
Warn when a #[should_panic] test has an unexpected message

7 years agoinstantiate closures on demand
Ariel Ben-Yehuda [Wed, 16 Nov 2016 10:27:43 +0000 (12:27 +0200)]
instantiate closures on demand

this should fix compilation with `-C codegen-units=4` - tested locally
with `RUSTFLAGS='-C codegen-units=4' ../x.py test`

7 years agoAuto merge of #37763 - liigo:rustdoc-playground, r=alexcrichton
bors [Fri, 18 Nov 2016 09:47:01 +0000 (01:47 -0800)]
Auto merge of #37763 - liigo:rustdoc-playground, r=alexcrichton

rustdoc: add cli argument `--playground-url`

Add a new cli argument `--playground-url` for rustdoc:

`rustdoc lib.rs --playground-url="https://play.rust-lang.org/"`

`rustdoc book.md --playground-url="https://play.rust-lang.org/"`

This makes it possible for tools like https://docs.rs to generate crate docs that can submit samples code to run at https://play.rust-lang.org, even if the crate's author *forgot* putting `#![doc(html_playground_url = "https://play.rust-lang.org/")]` to crate root. By the way, I'd like to say, many crate authors are not aware of existing of `#![doc(html_playground_url = "https://play.rust-lang.org/")]`.

`--playground-url` may be reset by `--markdown-playground-url` or `#![doc(html_playground_url=...)]`, so it's backward compatible.

@alexcrichton since you implemented playground-url related features.

7 years agorustbuild: update the llvm link logic further
Josh Stone [Fri, 18 Nov 2016 05:50:59 +0000 (21:50 -0800)]
rustbuild: update the llvm link logic further

There are now four static/shared scenarios that can happen for the
supported LLVM versions:

- 3.9+: By default use `llvm-config --link-static`
- 3.9+ and `--enable-llvm-link-shared`: Use `--link-shared` instead.
- 3.8: Use `llvm-config --shared-mode` and go with its answer.
- 3.7: Just assume static, maintaining the status quo.

7 years agoAuto merge of #37846 - jseyfried:fix_proc_macro_dep, r=alexcrichton
bors [Fri, 18 Nov 2016 04:56:03 +0000 (20:56 -0800)]
Auto merge of #37846 - jseyfried:fix_proc_macro_dep, r=alexcrichton

Fix bug in proc_macro dependency loading

Fixes #37839.
r? @alexcrichton

7 years agoDon't clone in UnificationTable::probe().
Nicholas Nethercote [Thu, 17 Nov 2016 23:10:09 +0000 (10:10 +1100)]
Don't clone in UnificationTable::probe().

This speeds up compilation of rustc-benchmarks/inflate-0.1.0 by 1%.

7 years agoAuto merge of #37660 - nikomatsakis:incremental-36349, r=eddyb
bors [Fri, 18 Nov 2016 01:31:01 +0000 (17:31 -0800)]
Auto merge of #37660 - nikomatsakis:incremental-36349, r=eddyb

Separate impl items from the parent impl

This change separates impl item bodies out of the impl itself. This gives incremental more resolution. In so doing, it refactors how the visitors work, and cleans up a bit of the collect/check logic (mostly by moving things out of collect that didn't really belong there, because they were just checking conditions).

However, this is not as effective as I expected, for a kind of frustrating reason. In particular, when invoking `foo.bar()` you still wind up with dependencies on private items. The problem is that the method resolution code scans that list for methods with the name `bar` -- and this winds up touching *all* the methods, even private ones.

I can imagine two obvious ways to fix this:

- separating fn bodies from fn sigs (#35078, currently being pursued by @flodiebold)
- a more aggressive model of incremental that @michaelwoerister has been advocating, in which we hash the intermediate results (e.g., the outputs of collect) so that we can see that the intermediate result hasn't changed, even if a particular impl item has changed.

So all in all I'm not quite sure whether to land this or not. =) It still seems like it has to be a win in some cases, but not with the test cases we have just now. I can try to gin up some test cases, but I'm not sure if they will be totally realistic. On the other hand, some of the early refactorings to the visitor trait seem worthwhile to me regardless.

cc #36349 -- well, this is basically a fix for that issue, I guess

r? @michaelwoerister

NB: Based atop of @eddyb's PR https://github.com/rust-lang/rust/pull/37402; don't land until that lands.

7 years agoAdd regression test.
Jeffrey Seyfried [Fri, 18 Nov 2016 00:51:24 +0000 (00:51 +0000)]
Add regression test.

7 years agoAdd std::process::abort
Steven Fackler [Thu, 17 Nov 2016 17:31:14 +0000 (09:31 -0800)]
Add std::process::abort

This calls libc abort on Unix and fastfail on Windows.

7 years agosave-analysis: handle << and >> operators inside [] in types
Nick Cameron [Tue, 15 Nov 2016 04:03:27 +0000 (17:03 +1300)]
save-analysis: handle << and >> operators inside [] in types

Fixes #37700

7 years agoFix bug in loading proc macro dependencies.
Jeffrey Seyfried [Fri, 18 Nov 2016 00:03:10 +0000 (00:03 +0000)]
Fix bug in loading proc macro dependencies.

7 years agoAuto merge of #37424 - shiver:issue-37131, r=alexcrichton
bors [Thu, 17 Nov 2016 22:16:27 +0000 (14:16 -0800)]
Auto merge of #37424 - shiver:issue-37131, r=alexcrichton

Improved error reporting when target sysroot is missing.

Attempts to resolve #37131.
This is my first pull request on rust, so I would greatly appreciate any feedback you have on this.

Thanks!

7 years agoadd test for hashing trait impls
Niko Matsakis [Thu, 17 Nov 2016 20:12:43 +0000 (15:12 -0500)]
add test for hashing trait impls

7 years agoUse llvm::Attribute API instead of "raw value" APIs, which will be removed in LLVM...
Robin Kruppe [Wed, 16 Nov 2016 22:36:08 +0000 (23:36 +0100)]
Use llvm::Attribute API instead of "raw value" APIs, which will be removed in LLVM 4.0.

The librustc_llvm API remains mostly unchanged, except that llvm::Attribute is no longer a bitflag but represents only a *single* attribute.
The ability to store many attributes in a small number of bits and modify them without interacting with LLVM is only used in rustc_trans::abi and closely related modules, and only attributes for function arguments are considered there.
Thus rustc_trans::abi now has its own bit-packed representation of argument attributes, which are translated to rustc_llvm::Attribute when applying the attributes.

7 years agoICH: Add regression tests for various kinds of loops.
Michael Woerister [Thu, 17 Nov 2016 19:28:38 +0000 (14:28 -0500)]
ICH: Add regression tests for various kinds of loops.

7 years agoFix grammar error in lifetimes.md
Brett Cooley [Thu, 17 Nov 2016 19:23:57 +0000 (12:23 -0700)]
Fix grammar error in lifetimes.md

7 years agoAuto merge of #37837 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Thu, 17 Nov 2016 18:57:08 +0000 (10:57 -0800)]
Auto merge of #37837 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 8 pull requests

- Successful merges: #37752, #37757, #37759, #37766, #37772, #37799, #37806, #37821
- Failed merges: #37442

7 years agocanonicalize base incremental path on windows
Niko Matsakis [Thu, 17 Nov 2016 17:44:46 +0000 (12:44 -0500)]
canonicalize base incremental path on windows

This sidesteps problems with long paths because the canonical path
includes the "magic long path prefix" on Windows.

7 years agofix change_private_impl_method_cc test
Niko Matsakis [Tue, 15 Nov 2016 02:02:29 +0000 (21:02 -0500)]
fix change_private_impl_method_cc test

7 years agofix oversight in closure translation
Niko Matsakis [Mon, 14 Nov 2016 23:23:07 +0000 (18:23 -0500)]
fix oversight in closure translation

(Unrelated to this PR series)