]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agosave-analysis: redirect a module decl to the start of the defining file
Nick Cameron [Fri, 25 Nov 2016 03:50:47 +0000 (16:50 +1300)]
save-analysis: redirect a module decl to the start of the defining file

7 years agoAuto merge of #37931 - eddyb:meta-version, r=jseyfried
bors [Wed, 23 Nov 2016 23:48:44 +0000 (17:48 -0600)]
Auto merge of #37931 - eddyb:meta-version, r=jseyfried

rustc_metadata: don't break the version check when CrateRoot changes.

In #36551 I made `rustc_version` a field of `CrateRoot`, but despite it being the first field, one could still break the version check by changing `CrateRoot` so older compilers couldn't fully decode it (e.g. #37463).

This PR fixes #37803 by moving the version string back at the beginning of metadata, right after the 32-bit big-endian absolute position of `CrateRoot`, and by incrementing `METADATA_VERSION`.

7 years agoAuto merge of #37908 - nrc:save-def, r=eddyb
bors [Wed, 23 Nov 2016 20:31:45 +0000 (14:31 -0600)]
Auto merge of #37908 - nrc:save-def, r=eddyb

save-analysis: fix ICE on partially resolved path

Occurs when we produce save-analysis before type checking is complete (due to errors).

7 years agoInspect def locally instead of using a method
Nick Cameron [Wed, 23 Nov 2016 18:50:22 +0000 (07:50 +1300)]
Inspect def locally instead of using a method

7 years agoAuto merge of #36449 - canndrew:expand_is_uninhabited, r=eddyb
bors [Wed, 23 Nov 2016 17:16:22 +0000 (11:16 -0600)]
Auto merge of #36449 - canndrew:expand_is_uninhabited, r=eddyb

Expand is_uninhabited

This allows code such as this to compile:

``` rust
let x: ! = ...;
match x {};

let y: (u32, !) = ...;
match y {};
```

@eddyb You were worried about making this change. Do you have any idea about what could break? Are there any special tests that need to be written for it?

7 years agoAuto merge of #37937 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Wed, 23 Nov 2016 14:01:41 +0000 (08:01 -0600)]
Auto merge of #37937 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

- Successful merges: #37442, #37760, #37836, #37851, #37859, #37913, #37925
- Failed merges:

7 years agoRollup merge of #37940 - michaelwoerister:ich-struct-constructors, r=nikomatsakis
Guillaume Gomez [Wed, 23 Nov 2016 11:18:10 +0000 (12:18 +0100)]
Rollup merge of #37940 - michaelwoerister:ich-struct-constructors, r=nikomatsakis

ICH: Add test case for struct constructor expressions.

r? @nikomatsakis

7 years agoRollup merge of #37938 - michaelwoerister:move-myriad-closures, r=eddyb
Guillaume Gomez [Wed, 23 Nov 2016 11:18:10 +0000 (12:18 +0100)]
Rollup merge of #37938 - michaelwoerister:move-myriad-closures, r=eddyb

Move the myriad-closures.rs test case to run-pass-full test suite.

r? @eddyb

7 years agoRollup merge of #37925 - jtdowney:env-args-doc-links, r=steveklabnik
Guillaume Gomez [Wed, 23 Nov 2016 11:18:10 +0000 (12:18 +0100)]
Rollup merge of #37925 - jtdowney:env-args-doc-links, r=steveklabnik

Add some internal docs links for Args/ArgsOs

In many places the docs link to other sections and I noticed it was lacking here. Not sure if there is a standard for if inter-linking is appropriate.

7 years agoRollup merge of #37913 - GuillaumeGomez:socket-v4, r=frewsxcv
Guillaume Gomez [Wed, 23 Nov 2016 11:18:10 +0000 (12:18 +0100)]
Rollup merge of #37913 - GuillaumeGomez:socket-v4, r=frewsxcv

Add missing examples for SocketAddrV4

r? @steveklabnik

cc @frewsxcv

7 years agoRollup merge of #37851 - jneem:master, r=sanxiyn
Guillaume Gomez [Wed, 23 Nov 2016 11:18:09 +0000 (12:18 +0100)]
Rollup merge of #37851 - jneem:master, r=sanxiyn

Add a regression test for issue 23699.

This should close #23699

7 years agoRollup merge of #37836 - steveklabnik:remove-incorrect-reference-comment, r=Guillaume...
Guillaume Gomez [Wed, 23 Nov 2016 11:18:09 +0000 (12:18 +0100)]
Rollup merge of #37836 - steveklabnik:remove-incorrect-reference-comment, r=GuillaumeGomez

Clarify the reference's status.

The former wording only gave part of the picture, we want to be crystal
clear about this.

/cc @petrochenkov, who had concerns about https://github.com/rust-lang/rust/pull/37820

7 years agoRollup merge of #37760 - nnethercote:TypeWalker-SmallVector, r=arielb1
Guillaume Gomez [Wed, 23 Nov 2016 11:18:09 +0000 (12:18 +0100)]
Rollup merge of #37760 - nnethercote:TypeWalker-SmallVector, r=arielb1

Type walker small vector

These two changes avoid allocations on some hot paths and speed up a few workloads (some from rustc-benchmarks, as well as the workload from #36799) by 1--2%.

7 years agoRollup merge of #37442 - estebank:cast-deref-hint, r=jonathandturner
Guillaume Gomez [Wed, 23 Nov 2016 11:18:09 +0000 (12:18 +0100)]
Rollup merge of #37442 - estebank:cast-deref-hint, r=jonathandturner

Provide hint when cast needs a dereference

For a given code:

``` rust
vec![0.0].iter().map(|s| s as i16).collect::<Vec<i16>>();
```

display:

``` nocode
error: casting `&f64` as `i16` is invalid
 --> file3.rs:2:35
  |
2 |     vec![0.0].iter().map(|s| s as i16).collect::<Vec<i16>>();
  |                              -    ^^^
  |                              |
  |                              did you mean `*s`?
```

instead of:

``` nocode
error: casting `&f64` as `i16` is invalid
 --> <anon>:2:30
  |
2 |     vec![0.0].iter().map(|s| s as i16).collect();
  |                              ^^^^^^^^
  |
  = help: cast through a raw pointer first
```

Fixes #37338.

7 years agoAuto merge of #37924 - brson:config-bug, r=alexcrichton
bors [Wed, 23 Nov 2016 10:51:49 +0000 (04:51 -0600)]
Auto merge of #37924 - brson:config-bug, r=alexcrichton

configure: Fix string equality

7 years agoRevert libcore changes
Andrew Cann [Wed, 23 Nov 2016 09:13:12 +0000 (17:13 +0800)]
Revert libcore changes

7 years agoAuto merge of #37886 - Stebalien:set-perm, r=alexcrichton
bors [Wed, 23 Nov 2016 07:21:45 +0000 (01:21 -0600)]
Auto merge of #37886 - Stebalien:set-perm, r=alexcrichton

Add a method for setting permissions directly on an open file.

On unix like systems, the underlying file corresponding to any given path may change at any time. This function makes it possible to set the permissions of the a file corresponding to a `File` object even if its path changes.

@retep998, what's the best way to do this on Windows? I looked into `SetFileInformationByHandle` but couldn't find a way to do it atomically risking clobbering access time information.

This is a first step towards fixing #37885. This function doesn't *have* to be public but this is useful functionality that should probably be exposed.

7 years agoFix a bunch of bugs shown by the test
Nick Cameron [Wed, 23 Nov 2016 05:47:07 +0000 (18:47 +1300)]
Fix a bunch of bugs shown by the test

7 years agoAuto merge of #37681 - nrc:crate-metadata, r=@alexcrichton
bors [Wed, 23 Nov 2016 03:54:10 +0000 (21:54 -0600)]
Auto merge of #37681 - nrc:crate-metadata, r=@alexcrichton

add --crate-type metadata

r? @alexcrichton

7 years agoAdd a test
Nick Cameron [Wed, 23 Nov 2016 00:35:07 +0000 (13:35 +1300)]
Add a test

7 years agoAuto merge of #37487 - goffrie:break, r=nikomatsakis
bors [Tue, 22 Nov 2016 23:51:59 +0000 (17:51 -0600)]
Auto merge of #37487 - goffrie:break, r=nikomatsakis

Implement the `loop_break_value` feature.

This implements RFC 1624, tracking issue #37339.
- `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the
  currently deduced type of that loop, the desired type, and a list of
  break expressions currently seen. `loop` loops get a fresh type
  variable as their initial type (this logic is stolen from that for
  arrays). `while` loops get `()`.
- `break {expr}` looks up the broken loop, and unifies the type of
  `expr` with the type of the loop.
- `break` with no expr unifies the loop's type with `()`.
- When building MIR, loops no longer construct a `()` value at
  termination of the loop; rather, the `break` expression assigns the
  result of the loop.
- ~~I have also changed the loop scoping in MIR-building so that the test
  of a while loop is not considered to be part of that loop. This makes
  the rules consistent with #37360. The new loop scopes in typeck also
  follow this rule. That means that `loop { while (break) {} }` now
  terminates instead of looping forever. This is technically a breaking
  change.~~
- ~~On that note, expressions like `while break {}` and `if break {}` no
  longer parse because `{}` is interpreted as an expression argument to
  `break`. But no code except compiler test cases should do that anyway
  because it makes no sense.~~
- The RFC did not make it clear, but I chose to make `break ()` inside
  of a `while` loop illegal, just in case we wanted to do anything with
  that design space in the future.

This is my first time dealing with this part of rustc so I'm sure
there's plenty of problems to pick on here ^_^

7 years agoRebasing and review changes
Nick Cameron [Thu, 10 Nov 2016 21:00:33 +0000 (10:00 +1300)]
Rebasing and review changes

7 years agosave-analysis: fix ICE on partially resolved path
Nick Cameron [Mon, 21 Nov 2016 05:11:36 +0000 (18:11 +1300)]
save-analysis: fix ICE on partially resolved path

Occurs when we produce save-analysis before type checking is complete (due to errors).

7 years agoICH: Add test case for struct constructor expressions.
Michael Woerister [Tue, 22 Nov 2016 20:49:58 +0000 (15:49 -0500)]
ICH: Add test case for struct constructor expressions.

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 agoAdd a method for setting permissions directly on an open file.
Steven Allen [Sat, 19 Nov 2016 17:53:54 +0000 (09:53 -0800)]
Add a method for setting permissions directly on an open file.

On unix like systems, the underlying file corresponding to any given path may
change at any time. This function makes it possible to set the permissions of
the a file corresponding to a `File` object even if its path changes.

7 years agorustc_metadata: don't break the version check when CrateRoot changes.
Eduard-Mihai Burtescu [Tue, 22 Nov 2016 12:51:55 +0000 (14:51 +0200)]
rustc_metadata: don't break the version check when CrateRoot changes.

7 years agoAuto merge of #37843 - nikomatsakis:issue-33685-hard-error, r=eddyb
bors [Tue, 22 Nov 2016 12:39:42 +0000 (06:39 -0600)]
Auto merge of #37843 - nikomatsakis:issue-33685-hard-error, r=eddyb

make HR_LIFETIME_IN_ASSOC_TYPE deny-by-default

It's time to fix issue #32330.

cc #33685
cc @arielb1

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 agoUse FxHashSet instead of HashMap
Andrew Cann [Tue, 22 Nov 2016 06:39:56 +0000 (14:39 +0800)]
Use FxHashSet instead of HashMap

7 years agoMake is_uninhabited respect privacy
Andrew Cann [Wed, 9 Nov 2016 09:55:57 +0000 (17:55 +0800)]
Make is_uninhabited respect privacy

7 years agoRevert libcore changes, redefine Void instead
Andrew Cann [Wed, 9 Nov 2016 09:55:11 +0000 (17:55 +0800)]
Revert libcore changes, redefine Void instead

7 years agoRecursive types are always non-empty
Andrew Cann [Wed, 14 Sep 2016 17:41:45 +0000 (01:41 +0800)]
Recursive types are always non-empty

7 years agoExpand is_uninhabited for references
Andrew Cann [Wed, 14 Sep 2016 17:11:11 +0000 (01:11 +0800)]
Expand is_uninhabited for references

7 years agoFix previous commit
Andrew Cann [Wed, 14 Sep 2016 17:10:53 +0000 (01:10 +0800)]
Fix previous commit

7 years agoExpand `is_uninhabited` to recurse into datatypes
Andrew Cann [Wed, 14 Sep 2016 15:58:58 +0000 (23:58 +0800)]
Expand `is_uninhabited` to recurse into datatypes

7 years agoExpand is_uninhabited for ! and tuples
Andrew Cann [Tue, 13 Sep 2016 08:30:57 +0000 (16:30 +0800)]
Expand is_uninhabited for ! and tuples

7 years agoImplement the `loop_break_value` feature.
Geoffry Song [Sat, 29 Oct 2016 22:15:06 +0000 (15:15 -0700)]
Implement the `loop_break_value` feature.

This implements RFC 1624, tracking issue #37339.

- `FnCtxt` (in typeck) gets a stack of `LoopCtxt`s, which store the
  currently deduced type of that loop, the desired type, and a list of
  break expressions currently seen. `loop` loops get a fresh type
  variable as their initial type (this logic is stolen from that for
  arrays). `while` loops get `()`.
- `break {expr}` looks up the broken loop, and unifies the type of
  `expr` with the type of the loop.
- `break` with no expr unifies the loop's type with `()`.
- When building MIR, `loop` loops no longer construct a `()` value at
  termination of the loop; rather, the `break` expression assigns the
  result of the loop. `while` loops are unchanged.
- `break` respects contexts in which expressions may not end with braced
  blocks. That is, `while break { break-value } { while-body }` is
  illegal; this preserves backwards compatibility.
- The RFC did not make it clear, but I chose to make `break ()` inside
  of a `while` loop illegal, just in case we wanted to do anything with
  that design space in the future.

This is my first time dealing with this part of rustc so I'm sure
there's plenty of problems to pick on here ^_^

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 agoUse SmallVec for TypeWalker's stack.
Nicholas Nethercote [Mon, 17 Oct 2016 21:23:09 +0000 (08:23 +1100)]
Use SmallVec for TypeWalker's stack.

The change also adds the missing `SmallVec::truncate` method.

7 years agoAdd some internal docs links for Args/ArgsOs
John Downey [Mon, 21 Nov 2016 22:12:14 +0000 (16:12 -0600)]
Add some internal docs links for Args/ArgsOs

7 years agoconfigure: Fix string equality
Brian Anderson [Mon, 21 Nov 2016 22:10:51 +0000 (22:10 +0000)]
configure: Fix string equality

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 agoAdd regression test for issue 23699.
Joe Neeman [Mon, 21 Nov 2016 21:02:03 +0000 (22:02 +0100)]
Add regression test for issue 23699.

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 agoAdd missing examples for SocketAddrV4
Guillaume Gomez [Mon, 21 Nov 2016 13:07:58 +0000 (14:07 +0100)]
Add missing examples for SocketAddrV4

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 agoTests
Nick Cameron [Thu, 10 Nov 2016 05:29:27 +0000 (18:29 +1300)]
Tests

7 years agoRead in rmeta crates
Nick Cameron [Thu, 10 Nov 2016 02:57:30 +0000 (15:57 +1300)]
Read in rmeta crates

7 years agoAdd --crate-type metadata
Nick Cameron [Tue, 25 Oct 2016 22:14:02 +0000 (11:14 +1300)]
Add --crate-type metadata

With the same semantics as -Zno-trans

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 agoProvide hint when cast needs a dereference
Esteban Küber [Fri, 28 Oct 2016 02:02:27 +0000 (19:02 -0700)]
Provide hint when cast needs a dereference

For a given code:

```rust
vec![0.0].iter().map(|s| s as i16).collect::<Vec<i16>>();
```

display:

```nocode
error: casting `&f64` as `i16` is invalid
 --> foo.rs:2:35
  |
2 |     vec![0.0].iter().map(|s| s as i16).collect::<Vec<i16>>();
  |                              -    ^^^ cannot cast `&f64` as `i16`
  |                              |
  |                              did you mean `*s`?
```

instead of:

```nocode
error: casting `&f64` as `i16` is invalid
 --> <anon>:2:30
  |
2 |     vec![0.0].iter().map(|s| s as i16).collect();
  |                              ^^^^^^^^
  |
  = help: cast through a raw pointer first
```

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.