Commit Graph

58977 Commits

Author SHA1 Message Date
Seo Sanghyeon
eeac361f52 Rollup merge of #37978 - fkjogu:master, r=sfackler
Define `bound` argument in std::sync::mpsc::sync_channel in the documentation

The `bound` argument in `std::sync::mpsc::sync:channel(bound: usize)` was not defined in the documentation.
2016-11-26 22:02:14 +09:00
Seo Sanghyeon
6ffcdff06c Rollup merge of #37967 - sfackler:enumset-issue, r=sfackler
Add a tracking issue for enum_set

I totally forgot this even existed!
2016-11-26 22:02:14 +09:00
Seo Sanghyeon
5aceedf4d8 Rollup merge of #37963 - bluss:iterator-docs, r=alexcrichton
Fix two small issues in iterator docs

- `collect()` is a regular method, not an adaptor (does not return an Iterator). I just randomly picked `filter` as a third common adaptor to mention instead.
- Fix example in `Map`'s docs so that it uses the DoubleEndedIterator implementation
2016-11-26 22:02:14 +09:00
Seo Sanghyeon
a809749fdf Rollup merge of #37962 - GuillaumeGomez:socket-v6, r=frewsxcv
Add missing examples to SocketAddrV6

r? @steveklabnik

cc @frewsxcv
2016-11-26 22:02:13 +09:00
bors
d64b703065 Auto merge of #37960 - samestep:five, r=frewsxcv
Use literal 5 instead of five in book section 4.1

The other two code snippets in this sentence are valid code, so it makes more sense to use the literal `5` rather than the invalid symbol `five`.
2016-11-25 20:19:47 -06:00
bors
2217bd771c Auto merge of #38000 - rkruppe:llvm-dinamespace-fwdcompat, r=alexcrichton
[LLVM 4.0] Pass new argument ExportSymbol to DIBuilder::createNameSpace

cc #37609
2016-11-25 16:57:37 -06:00
bors
dad5cdea2a Auto merge of #37987 - plietar:cross-proc-macro, r=jseyfried
Delay error reporting of filename mismatch.

When cross compiling with procedural macros, the crate loader starts by
looking for a target crate, before trying with a host crate.

Rather than emitting an error immediately if the host and target
extension differ, the compiler should delay it until both attempts have
failed.

Fixes #37899
2016-11-25 13:48:08 -06:00
Robin Kruppe
2e6d49de07 Pass new argument ExportSymbol to DIBuilder::createNameSpace 2016-11-25 17:23:25 +01:00
bors
ebc0373909 Auto merge of #37982 - rkruppe:llvm-diagnostic-fwdcompat, r=alexcrichton
[LLVM 4.0] OptimizationDiagnostic FFI forward compatibility

- getMsg() changed to return std::string by-value. Fix: copy the data to a rust String during unpacking.
- getPassName() changed to return StringRef

cc #37609
2016-11-25 09:01:33 -06:00
bors
c78cc52afd Auto merge of #37979 - nnethercote:Ty-super_fold_with, r=eddyb
Avoid more unnecessary mk_ty calls in Ty::super_fold_with.

This speeds up several rustc-benchmarks by 1--5%.

This PR is the lovechild of #37108 and #37705.
```
futures-rs-test  4.059s vs  4.011s --> 1.012x faster (variance: 1.016x, 1.026x)
helloworld       0.236s vs  0.239s --> 0.986x faster (variance: 1.051x, 1.014x)
html5ever-2016-  3.831s vs  3.824s --> 1.002x faster (variance: 1.020x, 1.019x)
hyper.0.5.0      4.928s vs  4.936s --> 0.998x faster (variance: 1.003x, 1.012x)
inflate-0.1.0    4.135s vs  4.104s --> 1.007x faster (variance: 1.026x, 1.028x)
issue-32062-equ  0.309s vs  0.303s --> 1.017x faster (variance: 1.019x, 1.084x)
issue-32278-big  1.818s vs  1.797s --> 1.011x faster (variance: 1.011x, 1.008x)
jld-day15-parse  1.304s vs  1.271s --> 1.026x faster (variance: 1.018x, 1.012x)
piston-image-0. 10.938s vs 10.921s --> 1.002x faster (variance: 1.025x, 1.016x)
reddit-stress    2.327s vs  2.208s --> 1.054x faster (variance: 1.016x, 1.006x)
regex-0.1.80     8.796s vs  8.727s --> 1.008x faster (variance: 1.012x, 1.019x)
regex.0.1.30     2.294s vs  2.249s --> 1.020x faster (variance: 1.013x, 1.026x)
rust-encoding-0  1.914s vs  1.886s --> 1.015x faster (variance: 1.027x, 1.026x)
```
2016-11-25 00:22:49 -06:00
bors
2e7176f98b Auto merge of #37974 - japaric:abort, r=alexcrichton
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

r? @alexcrichton
2016-11-24 19:03:07 -06:00
Paul Lietar
2cdde5aef4 Delay error reporting of filename mismatch.
When cross compiling with procedural macros, the crate loader starts by
looking for a target crate, before trying with a host crate.

Rather than emitting an error immediately if the host and target
extension differ, the compiler should delay it until both attempts have
failed.

Fixes #37899

r? @jseyfried
2016-11-24 22:26:35 +00:00
bors
d9bdc636da Auto merge of #37951 - jseyfried:improve_macro_resolution_perf, r=nrc
macros: improve resolution performance

Avoid quadratic legacy macro name resolution in more cases.
r? @nrc
2016-11-24 15:31:47 -06:00
bors
a31ad75bde Auto merge of #37944 - bluss:adaptors-are-empty, r=alexcrichton
Forward ExactSizeIterator::len and is_empty for important iterator adaptors

Forward ExactSizeIterator::len and is_empty for important iterator adaptors

Because some iterators will provide improved version of len and/or is_empty,
adaptors should forward to those implementations if possible.
2016-11-24 11:56:11 -06:00
Robin Kruppe
730400167a Support LLVM 4.0 in OptimizationDiagnostic FFI
- getMsg() changed to return std::string by-value. Fix: copy the data to a rust String during unpacking.
- getPassName() changed to return StringRef
2016-11-24 17:33:47 +01:00
bors
ddf011d773 Auto merge of #37770 - pnkfelix:print-type-sizes, r=arielb1
Add debug flag `-Z print-type-sizes` for instrumention type/variant sizes

Add debug flag `-Z print-type-sizes` for instrumention type/variant sizes

This is meant to help with things like #36799 in a very local way; namely, once you have a hypothesis as to which types have a large population or are "too large", you can use `-Z print-type-sizes` to learn how large each type is, and how much each variant in an enum contributes to the size of that overall enum.
2016-11-24 08:26:36 -06:00
Nicholas Nethercote
4d0618ee30 Avoid more unnecessary mk_ty calls in Ty::super_fold_with.
This speeds up several rustc-benchmarks by 1--5%.
2016-11-24 21:11:05 +11:00
bors
217f57c0b5 Auto merge of #37943 - bluss:exact-is-empty, r=alexcrichton
Implement better .is_empty() for slice and vec iterators

These iterators can use a pointer comparison instead of computing the length.
2016-11-24 03:37:44 -06:00
Felix S. Klock II
75825fe1df Tests of -Z print-type-sizes functionality.
Note that the tests have been updated to initialize the local
variables; originally it was enough just to declare them.

Back when I started this, the `layout_cache` contained entries even
just for types that had been declared but not initialized. Apparently
things have changed in the interim so that if I want one of those
layouts to be computed, I need to actually initialize the value.

(Incidentally, this shows a weakness in the strategy of just walking
the `layout_cache`; the original strategy of using a MIR visitor would
probably have exhibited more robustness in terms of consistent output,
but it had other weaknesses so I chose not to reimplement it. At
least, not yet.)

----

Also, I have updated tests to avoid target-specific alignments.
2016-11-24 10:30:18 +01:00
Felix S. Klock II
70e5ca2ab4 Revisions from review comments, squashed.
Biggest change: Revised print-type-sizes output to include breakdown
of layout.

Includes info about field sizes (and alignment + padding when padding
is injected; the injected padding is derived from the offsets computed
by layout module).

Output format is illustrated in commit that has the ui tests.

Note: there exists (at least) one case of variant w/o name: empty
enums.  Namely, empty enums use anonymous univariant repr. So for such
cases, print the number of the variant instead of the name.

----

Also, eddyb suggested of reading from `layout_cache` post-trans.

(For casual readers: the compiler source often uses the word "cache"
for tables that are in fact not periodically purged, and thus are
useful as the basis for data like this.)

Some types that were previously not printed are now included in the
output. (See e.g. the tests `print_type_sizes/generics.rs` and
`print_type_sizes/variants.rs`)

----

Other review feedback:

switch to an exhaustive match when filtering in just structural types.
switch to hashset for layout info and move sort into print method.

----

Driveby change: Factored session::code_stats into its own module

----

incorporate njn feedback re output formatting.
2016-11-24 10:30:18 +01:00
Felix S. Klock II
9383fcf07f Add -Z print-type-sizes, a tool for digging into how variants are laid out. 2016-11-24 10:30:18 +01:00
fkjogu
a3e03e42e1 Define bound argument in std::sync::mpsc::sync_channel
The `bound` argument in `std::sync::mpsc::sync:channel(bound: usize)` was not defined in the documentation.
2016-11-24 09:49:30 +01: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
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