Commit Graph

59049 Commits

Author SHA1 Message Date
bors
d5814b03e6 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).
2016-11-23 14:31:45 -06:00
Steven Fackler
8560991cb0 Add a tracking issue for enum_set 2016-11-23 10:55:44 -08:00
Nick Cameron
b1f86fb7c3 Inspect def locally instead of using a method 2016-11-24 07:50:22 +13:00
bors
d515586465 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?
2016-11-23 11:16:22 -06:00
Guillaume Gomez
559141c827 Add missing examples to SocketAddrV6 2016-11-23 17:14:41 +01:00
bors
127a83df66 Auto merge of #37937 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 7 pull requests

- Successful merges: #37442, #37760, #37836, #37851, #37859, #37913, #37925
- Failed merges:
2016-11-23 08:01:41 -06:00
Sam Estep
b15e6a6a00 Use "radices" instead of "radicum" 2016-11-23 08:49:35 -05:00
Sam Estep
49c6b3c23f Use literal 5 instead of five in book section 4.1 2016-11-23 08:41:50 -05:00
Guillaume Gomez
d2c600a2c9 Rollup merge of #37940 - michaelwoerister:ich-struct-constructors, r=nikomatsakis
ICH: Add test case for struct constructor expressions.

r? @nikomatsakis
2016-11-23 12:18:10 +01:00
Guillaume Gomez
90a2671a3c 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
2016-11-23 12:18:10 +01:00
Guillaume Gomez
cfc7fce2f0 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.
2016-11-23 12:18:10 +01:00
Guillaume Gomez
881115c896 Rollup merge of #37913 - GuillaumeGomez:socket-v4, r=frewsxcv
Add missing examples for SocketAddrV4

r? @steveklabnik

cc @frewsxcv
2016-11-23 12:18:10 +01:00
Guillaume Gomez
761c738876 Rollup merge of #37851 - jneem:master, r=sanxiyn
Add a regression test for issue 23699.

This should close #23699
2016-11-23 12:18:09 +01:00
Guillaume Gomez
067ffddbbb 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
2016-11-23 12:18:09 +01:00
Guillaume Gomez
496a411e4e 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%.
2016-11-23 12:18:09 +01:00
Guillaume Gomez
464cce99f1 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.
2016-11-23 12:18:09 +01:00
bors
9fba8df211 Auto merge of #37924 - brson:config-bug, r=alexcrichton
configure: Fix string equality
2016-11-23 04:51:49 -06:00
Ulrik Sverdrup
557369ed2e core: Fix example for .map()
Make the example use DoubleEndedIterator for map, like it said it would.
2016-11-23 11:39:53 +01:00
Ulrik Sverdrup
1c6048d0f4 core: Iterator docs, collect is not an adaptor 2016-11-23 11:39:53 +01:00
Andrew Cann
2121118f54 Revert libcore changes 2016-11-23 17:13:12 +08:00
bors
ccdc26fd42 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.
2016-11-23 01:21:45 -06:00
Nick Cameron
68312e3e20 Fix a bunch of bugs shown by the test 2016-11-23 18:47:07 +13:00
bors
5196ca8518 Auto merge of #37681 - nrc:crate-metadata, r=@alexcrichton
add --crate-type metadata

r? @alexcrichton
2016-11-22 21:54:10 -06:00
Jeffrey Seyfried
cbe478766c macros: improve performance of legacy name resolution. 2016-11-23 01:51:37 +00:00
Ulrik Sverdrup
74cde120e5 core, collections: Implement better .is_empty() for slice and vec iterators
These iterators can use a pointer comparison instead of computing the length.
2016-11-23 02:31:41 +01:00
Nick Cameron
9ea1544b80 Add a test 2016-11-23 13:35:07 +13:00
bors
1cabe21512 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 ^_^
2016-11-22 17:51:59 -06:00
Nick Cameron
af1b19555c Rebasing and review changes 2016-11-23 12:50:39 +13:00
Nick Cameron
3295afa6e2 save-analysis: fix ICE on partially resolved path
Occurs when we produce save-analysis before type checking is complete (due to errors).
2016-11-23 11:53:27 +13:00
Ulrik Sverdrup
22739a148e core: Forward ExactSizeIterator methods for important iterator adaptors 2016-11-22 23:51:02 +01:00
Michael Woerister
12f3caf6a8 ICH: Add test case for struct constructor expressions. 2016-11-22 15:49:58 -05:00
Michael Woerister
c0464eef17 Move the myriad-closures.rs test case to run-pass-full test suite. 2016-11-22 15:16:54 -05:00
Steven Allen
1aaca5f290 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.
2016-11-22 08:42:28 -08:00
Eduard-Mihai Burtescu
f4c68d2825 rustc_metadata: don't break the version check when CrateRoot changes. 2016-11-22 14:51:55 +02:00
bors
3bf2be9cee 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
2016-11-22 06:39:42 -06:00
bors
0f7c75b74f 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
2016-11-22 03:29:46 -06:00
Andrew Cann
2afec4dad1 Use FxHashSet instead of HashMap 2016-11-22 14:39:56 +08:00
Andrew Cann
d756f61a5a Make is_uninhabited respect privacy 2016-11-22 13:22:31 +08:00
Andrew Cann
a6cc398207 Revert libcore changes, redefine Void instead 2016-11-22 13:21:21 +08:00
Andrew Cann
5b20c6aec7 Recursive types are always non-empty 2016-11-22 13:21:21 +08:00
Andrew Cann
f1bdd4fae2 Expand is_uninhabited for references 2016-11-22 13:21:21 +08:00
Andrew Cann
75140512eb Fix previous commit 2016-11-22 13:21:21 +08:00
Andrew Cann
d6482510f4 Expand is_uninhabited to recurse into datatypes 2016-11-22 13:21:21 +08:00
Andrew Cann
69bb5fa852 Expand is_uninhabited for ! and tuples 2016-11-22 13:21:21 +08:00
Geoffry Song
9d42549df4
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 ^_^
2016-11-21 20:20:42 -08:00
bors
1c11ea3aed 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
2016-11-21 21:15:48 -06:00
Jeffrey Seyfried
fa8c53bae4 Start warning cycle. 2016-11-22 01:52:04 +00:00
Jeffrey Seyfried
808a7ca805 Fix fallout in tests. 2016-11-22 01:48:14 +00:00
Jeffrey Seyfried
30ac06fd73 Add a regression test and organize tests. 2016-11-22 01:48:13 +00:00
Jeffrey Seyfried
5675d9d280 Clean up directory ownership semantics. 2016-11-22 01:48:10 +00:00