Commit Graph

59108 Commits

Author SHA1 Message Date
Esteban Küber
b7982bbbe0 review comments 2016-11-23 23:44:17 -08:00
bors
29abe6f9e8 Auto merge of #37890 - eddyb:rustdoc-1, r=nrc
rustdoc: separate test collection from the main "clean"-ing pipeline.

While reusing the documentation "clean"-ing infrastructure for collecting code examples to test may have seemed appealing at some point, doing the same through a HIR visitor is barely any harder.
At the same time, supporting both "regular documentation" and "test collection" modes in `rustdoc::clean` has its cost, requiring any use of a `TyCtxt` to be speculative, and provide some sort of fallback.

This simplification is the first step towards bringing rustdoc closer to the compiler, and perhaps even unifying the "local crate" (based on the HIR AST) and "inlinined across crates" (based on crate metadata and typesystem information) implementations of rustdoc.

Sadly, not all possible changes to rustdoc will be uncontroversial, so I'm starting small with this patch.
2016-11-24 00:26:44 -06:00
bors
696fab844a Auto merge of #37849 - xen0n:compiler-rt-bump, r=alexcrichton
Update compiler-rt to fix MIPS64 infinite recursion

Fixes #37823.

Test fixes are coming in a separate PR later.

r? @alexcrichton
2016-11-23 21:03:47 -06:00
Jorge Aparicio
ba07a1b58d std: make compilation of libpanic_unwind optional via a Cargo feature
with this feature disabled, you can (Cargo) compile std with
"panic=abort"

rustbuild will build std with this feature enabled, to maintain the
status quo

fixes #37252
2016-11-23 21:49:54 -05:00
bors
1e45b63052 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`.
2016-11-23 17:48:44 -06:00
Eduard-Mihai Burtescu
4be7786330 rustdoc: we can now assume DocContext always has a TyCtxt. 2016-11-24 01:40:56 +02:00
Eduard-Mihai Burtescu
e68ad42dfa rustdoc: sidestep the main pipeline for test collection. 2016-11-24 01:40:56 +02:00
Eduard-Mihai Burtescu
12c5f8cb75 rustdoc: use libsyntax ast::Attribute instead of "cleaning" them. 2016-11-24 01:40:52 +02:00
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
Esteban Küber
eb53ca3aad Show multiline spans in full if short enough
When dealing with multiline spans that span few lines, show the complete
span instead of restricting to the first character of the first line.

For example, instead of:

```
% ./rustc foo.rs
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
  --> foo.rs:13:9
   |
13 |    foo(1 + bar(x,
   |        ^ trait `{integer}: std::ops::Add<()>` not satisfied
   |
```

show

```
% ./rustc foo.rs
error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied
  --> foo.rs:13:9
   |
13 |      foo(1 + bar(x,
   |  ________^ starting here...
14 | |            y),
   | |_____________^ ...ending here: trait `{integer}: std::ops::Add<()>` not satisfied
   |
```
2016-11-22 13:42:36 -08: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