]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoAuto merge of #38046 - rkruppe:fix-32bit-rustbuild, r=alexcrichton
bors [Tue, 29 Nov 2016 03:44:44 +0000 (21:44 -0600)]
Auto merge of #38046 - rkruppe:fix-32bit-rustbuild, r=alexcrichton

Fix rustbuild on 32 bit Linux

This is cherry-picked from #37817 which seems to be stalled and currently needs to be rebased anyway.

r? @alexcrichton (who authored this change)

7 years agoAuto merge of #37791 - petrochenkov:where, r=nikomatsakis
bors [Mon, 28 Nov 2016 21:15:17 +0000 (15:15 -0600)]
Auto merge of #37791 - petrochenkov:where, r=nikomatsakis

Support `?Sized` in where clauses

Implemented as described in https://github.com/rust-lang/rust/issues/20503#issuecomment-258677026 - `?Trait` bounds are moved on type parameter definitions when possible, reported as errors otherwise.
(It'd be nice to unify bounds and where clauses in HIR, but this is mostly blocked by rustdoc now - it needs to render bounds in pleasant way and the best way to do it so far is to mirror what was written in source code.)

Fixes https://github.com/rust-lang/rust/issues/20503
r? @nikomatsakis

7 years agoAuto merge of #38024 - jseyfried:avoid_needless_proc_macro_deps, r=nrc
bors [Mon, 28 Nov 2016 13:03:43 +0000 (07:03 -0600)]
Auto merge of #38024 - jseyfried:avoid_needless_proc_macro_deps, r=nrc

Avoid loading needless proc-macro dependencies

Fixes #37958 when no proc-macros are exported; in particular, without `pub extern crate proc_macros;`, `#![feature(macro_reexport)]`, or `#![feature(use_extern_macros)]`.

I opened https://github.com/rust-lang/cargo/issues/3334 for exported proc macros.

r? @alexcrichton

7 years agoDefine VISIBILITY_HIDDEN when compiling compiler-rt
Robin Kruppe [Mon, 28 Nov 2016 11:23:57 +0000 (12:23 +0100)]
Define VISIBILITY_HIDDEN when compiling compiler-rt

This is cherry-picked from #37817 which seems to be stalled and currently needs to be rebased anyway.

r? @alexcrichton (who authored this change)

7 years agoAuto merge of #37676 - eddyb:lazy-7, r=nikomatsakis
bors [Mon, 28 Nov 2016 05:32:57 +0000 (23:32 -0600)]
Auto merge of #37676 - eddyb:lazy-7, r=nikomatsakis

[7/n] rustc: desugar UFCS in HIR and don't use DefMap for associated resolutions.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37412) | [next](https://github.com/rust-lang/rust/pull/37688)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments._

<hr>

Previously, a path like `T::Assoc::method`, while equivalent to `<<T>::Assoc>::method`, wasn't desugared in any way at the HIR level and everything inspecting it had to either deal with knowing only `T` (before typeck) or knowing only the definition of `method` (after typeck).
Such a path also had only one `NodeId` and associated resolution during typeck modified `DefMap`, in a way that would be hard for incremental recompilation to track, and inconvenient for partial type conversions from HIR to `Ty`, which are required to break faux-cycles in on-demand type collection.

The desugarings performed by this PR are as follows:
* `use a::{b,c};` is flattened to `use a as _; use a::b; use a::c;`
  * as resolution is complete, `use a as _;` doesn't do anything, except get checked for stability
* `Vec::new` (an expression) becomes `Vec<..>::new<..>`, to distinguish it from `<Vec>::new<..>`
  * the "infer all parameters" `<..>` form is internal and not even pretty-printed
  * used when there are no type parameters at all, in an expression or pattern path segment
* `T::A::B` becomes `<<T>::A>::B` in a type, and `<<T<..>>::A<..>>::B<..>` in an expression/pattern
  * one additional `hir::Ty` node is created for each prefix, starting with the fully-resolved type (`T`) and extending it with each segment (e.g. `<T>::A`)
* fully-resolved paths contain their `Def` in HIR, getting rid of the `DefMap` and absolving incremental recompilation of needing to manually look up nodes to handle that side information

Not keeping the `DefMap` around meant that associated resolutions had to be stored somewhere else:
* expressions and patterns use a new `NodeId -> Def` map in `ty::Tables`
  * compatible with the future per-body (constant / `fn` / closure) `Tables`
* types are accessible via `Ty` and the usual per-item generics / predicates / type
  * `rustdoc` and `save-analysis` are the only situations which insist on mapping syntactical types to semantical ones, or at least understand the resolution of associated types, therefore the type conversion cache, i.e. a `NodeId -> Ty` map, is exposed by typeck for this purpose
  * stability had to be split into a pass that runs on HIR and checks the results of name resolution, and impromptu checks triggered by `typeck` for associated paths, methods, fields, etc.
  * privacy using semantic types results in accurate reachability for `impl Trait`, which fixes #35870, and thorough introspection of associated types, which may allow relaxing private-in-public checking on bounds, while keeping the intended ban on projections with private type parameters

cc @petrochenkov

7 years agoAvoid loading needless proc-macro dependencies.
Jeffrey Seyfried [Sun, 27 Nov 2016 02:57:15 +0000 (02:57 +0000)]
Avoid loading needless proc-macro dependencies.

7 years agorustc_typeck: don't record associated type resolutions.
Eduard-Mihai Burtescu [Thu, 24 Nov 2016 17:42:10 +0000 (19:42 +0200)]
rustc_typeck: don't record associated type resolutions.

7 years agorustc_privacy: switch private-in-public checking to Ty.
Eduard Burtescu [Sat, 12 Nov 2016 10:24:17 +0000 (12:24 +0200)]
rustc_privacy: switch private-in-public checking to Ty.

7 years agorustc: track fields in the HIR map.
Eduard Burtescu [Wed, 9 Nov 2016 18:57:48 +0000 (20:57 +0200)]
rustc: track fields in the HIR map.

7 years agorustc_privacy: visit Ty instead of HIR types in EmbargoVisitor.
Eduard-Mihai Burtescu [Mon, 28 Nov 2016 03:09:28 +0000 (05:09 +0200)]
rustc_privacy: visit Ty instead of HIR types in EmbargoVisitor.

7 years agoAuto merge of #38019 - sourcefrog:doc-separator, r=frewsxcv
bors [Mon, 28 Nov 2016 02:22:44 +0000 (20:22 -0600)]
Auto merge of #38019 - sourcefrog:doc-separator, r=frewsxcv

Clearer description of std::path::MAIN_SEPARATOR.

7 years agorustc: rework stability to be on-demand for type-directed lookup.
Eduard Burtescu [Thu, 10 Nov 2016 17:08:21 +0000 (19:08 +0200)]
rustc: rework stability to be on-demand for type-directed lookup.

7 years agorustc: use Span's allow_internal_unstable instead of hir::BlockCheckMode.
Eduard Burtescu [Sun, 30 Oct 2016 00:42:12 +0000 (03:42 +0300)]
rustc: use Span's allow_internal_unstable instead of hir::BlockCheckMode.

7 years agorustc_typeck: save the type cache for rustdoc and save-analysis.
Eduard Burtescu [Sat, 29 Oct 2016 10:19:59 +0000 (13:19 +0300)]
rustc_typeck: save the type cache for rustdoc and save-analysis.

7 years agorustc: embed path resolutions into the HIR instead of keeping DefMap.
Eduard-Mihai Burtescu [Fri, 25 Nov 2016 11:21:19 +0000 (13:21 +0200)]
rustc: embed path resolutions into the HIR instead of keeping DefMap.

7 years agorustc: desugar `use a::{b,c};` into `use a::b; use a::c;` in HIR.
Eduard-Mihai Burtescu [Thu, 24 Nov 2016 04:11:31 +0000 (06:11 +0200)]
rustc: desugar `use a::{b,c};` into `use a::b; use a::c;` in HIR.

7 years agorustc: track hir::{TraitRef, Visibility} in the HIR map.
Eduard Burtescu [Sun, 30 Oct 2016 06:04:52 +0000 (08:04 +0200)]
rustc: track hir::{TraitRef, Visibility} in the HIR map.

7 years agorustc: desugar UFCS as much as possible during HIR lowering.
Eduard Burtescu [Thu, 27 Oct 2016 02:17:42 +0000 (05:17 +0300)]
rustc: desugar UFCS as much as possible during HIR lowering.

7 years agorustc: encode the optionality of type parameters in HIR paths.
Eduard Burtescu [Mon, 17 Oct 2016 03:02:23 +0000 (06:02 +0300)]
rustc: encode the optionality of type parameters in HIR paths.

7 years agoAuto merge of #38022 - arthurprs:micro-opt-hm, r=bluss
bors [Sun, 27 Nov 2016 23:06:58 +0000 (17:06 -0600)]
Auto merge of #38022 - arthurprs:micro-opt-hm, r=bluss

Use displacement instead of initial bucket in HashMap code

Use displacement instead of initial bucket in HashMap code. It makes the code a bit cleaner and also saves a few instructions (handy since it'll be using some to do some sort of adaptive behavior soon).

7 years agoUse displacement instead of initial bucket in HashMap code
arthurprs [Sat, 26 Nov 2016 23:57:09 +0000 (00:57 +0100)]
Use displacement instead of initial bucket in HashMap code

7 years agoAuto merge of #38027 - rkruppe:llvm-printpasses-fwdcompat, r=alexcrichton
bors [Sun, 27 Nov 2016 19:51:40 +0000 (13:51 -0600)]
Auto merge of #38027 - rkruppe:llvm-printpasses-fwdcompat, r=alexcrichton

[LLVM 4.0] LLVMRustPrintPasses

Adapt `LLVMRustPrintPasses` to LLVM 4.0 preferring `StringRef` over `char *`

cc #37609

7 years agoAuto merge of #37983 - GuillaumeGomez:tcp_listener_doc, r=frewsxcv
bors [Sun, 27 Nov 2016 16:39:41 +0000 (10:39 -0600)]
Auto merge of #37983 - GuillaumeGomez:tcp_listener_doc, r=frewsxcv

Add examples for TcpListener struct

r? @frewsxcv

7 years agoAdapt LLVMRustPrintPasses to LLVM 4.0 preferring `StringRef` over `char *`
Robin Kruppe [Sun, 27 Nov 2016 13:48:47 +0000 (14:48 +0100)]
Adapt LLVMRustPrintPasses to LLVM 4.0 preferring `StringRef` over `char *`

7 years agoAuto merge of #38007 - alygin:err-expl-fix, r=eddyb
bors [Sun, 27 Nov 2016 12:04:18 +0000 (06:04 -0600)]
Auto merge of #38007 - alygin:err-expl-fix, r=eddyb

Fix error explanation formatting

Errors E0101, E0458, E0535 and E0537 have incorrectly formatted bulleted lists in their explanations. As the result, they are not rendered as lists in the documentation.

The fix applies the correct formatting to those lists.

7 years agoAdd examples for TcpListener struct
Guillaume Gomez [Thu, 24 Nov 2016 20:21:53 +0000 (21:21 +0100)]
Add examples for TcpListener struct

7 years agoAuto merge of #38023 - arielb1:constant-evil-x2, r=eddyb
bors [Sun, 27 Nov 2016 03:49:41 +0000 (21:49 -0600)]
Auto merge of #38023 - arielb1:constant-evil-x2, r=eddyb

don't double-apply variant padding to const enums

`build_const_struct` already returns the struct with padding - don't double-apply it in the `General` case.

This should hopefully be the last time we have this sort of bug.

Fixes #38002.

Beta-nominating because regression.

r? @eddyb

7 years agodon't double-apply variant padding to const enums
Ariel Ben-Yehuda [Sun, 27 Nov 2016 00:15:07 +0000 (02:15 +0200)]
don't double-apply variant padding to const enums

Fixes #38002.

7 years agoAuto merge of #36340 - sfackler:slice-get-slice, r=alexcrichton
bors [Sun, 27 Nov 2016 00:47:06 +0000 (18:47 -0600)]
Auto merge of #36340 - sfackler:slice-get-slice, r=alexcrichton

Implement RFC 1679

cc #35729

r? @alexcrichton

7 years agoAuto merge of #38004 - GuillaumeGomez:tcp_stream_doc, r=frewsxcv
bors [Sat, 26 Nov 2016 21:37:34 +0000 (15:37 -0600)]
Auto merge of #38004 - GuillaumeGomez:tcp_stream_doc, r=frewsxcv

Add missing urls and examples to TcpStream

r? @frewsxcv

7 years agoAuto merge of #38008 - bluss:rustbuild-benches, r=alexcrichton
bors [Sat, 26 Nov 2016 18:32:19 +0000 (12:32 -0600)]
Auto merge of #38008 - bluss:rustbuild-benches, r=alexcrichton

Add rustbuild command `bench`

Add command bench to rustbuild, so that `./x.py bench <path>` can compile and run benchmarks.

`./x.py bench --stage 1 src/libcollections` and `./x.py bench --stage 1 src/libstd` should both compile well. Just `./x.py bench` runs all benchmarks for the libstd crates.

Fixes #37897

7 years agoFix error explanation formatting
Andrew Lygin [Sat, 26 Nov 2016 18:19:30 +0000 (21:19 +0300)]
Fix error explanation formatting

7 years agoFix error explanation formatting
Andrew Lygin [Fri, 25 Nov 2016 19:58:30 +0000 (22:58 +0300)]
Fix error explanation formatting

7 years agoOverload get{,_mut}{,_unchecked}
Steven Fackler [Tue, 19 Jul 2016 08:50:52 +0000 (10:50 +0200)]
Overload get{,_mut}{,_unchecked}

7 years agoClearer description of std::path::MAIN_SEPARATOR.
Martin Pool [Sat, 26 Nov 2016 17:24:38 +0000 (09:24 -0800)]
Clearer description of std::path::MAIN_SEPARATOR.

7 years agoAuto merge of #38015 - sanxiyn:rollup, r=sanxiyn
bors [Sat, 26 Nov 2016 13:40:43 +0000 (07:40 -0600)]
Auto merge of #38015 - sanxiyn:rollup, r=sanxiyn

Rollup of 7 pull requests

- Successful merges: #37962, #37963, #37967, #37978, #37985, #38001, #38010
- Failed merges:

7 years agoRollup merge of #38010 - frewsxcv:lock-creations, r=GuillaumeGomez
Seo Sanghyeon [Sat, 26 Nov 2016 13:02:15 +0000 (22:02 +0900)]
Rollup merge of #38010 - frewsxcv:lock-creations, r=GuillaumeGomez

Document how lock 'guard' structures are created.

7 years agoRollup merge of #38001 - vickenty:patch-1, r=steveklabnik
Seo Sanghyeon [Sat, 26 Nov 2016 13:02:14 +0000 (22:02 +0900)]
Rollup merge of #38001 - vickenty:patch-1, r=steveklabnik

Follow our own recommendations in the examples

Remove exclamation marks from the the example error descriptions:
> The description [...] should not contain newlines or sentence-ending punctuation

7 years agoRollup merge of #37985 - frewsxcv:completed-fixme, r=petrochenkov
Seo Sanghyeon [Sat, 26 Nov 2016 13:02:14 +0000 (22:02 +0900)]
Rollup merge of #37985 - frewsxcv:completed-fixme, r=petrochenkov

Remove completed FIXME.

https://github.com/rust-lang/rust/issues/30530

7 years agoRollup merge of #37978 - fkjogu:master, r=sfackler
Seo Sanghyeon [Sat, 26 Nov 2016 13:02:14 +0000 (22:02 +0900)]
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.

7 years agoRollup merge of #37967 - sfackler:enumset-issue, r=sfackler
Seo Sanghyeon [Sat, 26 Nov 2016 13:02:14 +0000 (22:02 +0900)]
Rollup merge of #37967 - sfackler:enumset-issue, r=sfackler

Add a tracking issue for enum_set

I totally forgot this even existed!

7 years agoRollup merge of #37963 - bluss:iterator-docs, r=alexcrichton
Seo Sanghyeon [Sat, 26 Nov 2016 13:02:14 +0000 (22:02 +0900)]
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

7 years agoRollup merge of #37962 - GuillaumeGomez:socket-v6, r=frewsxcv
Seo Sanghyeon [Sat, 26 Nov 2016 13:02:13 +0000 (22:02 +0900)]
Rollup merge of #37962 - GuillaumeGomez:socket-v6, r=frewsxcv

Add missing examples to SocketAddrV6

r? @steveklabnik

cc @frewsxcv

7 years agoAuto merge of #37961 - samestep:radices, r=frewsxcv
bors [Sat, 26 Nov 2016 05:31:42 +0000 (23:31 -0600)]
Auto merge of #37961 - samestep:radices, r=frewsxcv

Use "radices" instead of "radicum"

The correct plural of "radix" is "radices" or "radixes", not "radicum".

7 years agoAuto merge of #37960 - samestep:five, r=frewsxcv
bors [Sat, 26 Nov 2016 02:19:47 +0000 (20:19 -0600)]
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`.

7 years agoDocument how the `MutexGuard` structure is created.
Corey Farwell [Fri, 25 Nov 2016 22:48:45 +0000 (17:48 -0500)]
Document how the `MutexGuard` structure is created.

Also, end sentence with a period.

7 years agoDocument how the `RwLockWriteGuard` structure is created.
Corey Farwell [Fri, 25 Nov 2016 22:46:12 +0000 (17:46 -0500)]
Document how the `RwLockWriteGuard` structure is created.

7 years agoDocument how the `RwLockReadGuard` structure is created.
Corey Farwell [Fri, 25 Nov 2016 22:43:06 +0000 (17:43 -0500)]
Document how the `RwLockReadGuard` structure is created.

7 years agorustbuild: Add bench = false to std shim crates
Ulrik Sverdrup [Fri, 25 Nov 2016 23:26:44 +0000 (00:26 +0100)]
rustbuild: Add bench = false to std shim crates

7 years agoAuto merge of #38000 - rkruppe:llvm-dinamespace-fwdcompat, r=alexcrichton
bors [Fri, 25 Nov 2016 22:57:37 +0000 (16:57 -0600)]
Auto merge of #38000 - rkruppe:llvm-dinamespace-fwdcompat, r=alexcrichton

[LLVM 4.0] Pass new argument ExportSymbol to DIBuilder::createNameSpace

cc #37609

7 years agoAdd missing urls and examples to TcpStream
Guillaume Gomez [Fri, 25 Nov 2016 17:54:42 +0000 (18:54 +0100)]
Add missing urls and examples to TcpStream

7 years agorustbuild: Point to core and collections's external benchmarks.
Ulrik Sverdrup [Fri, 25 Nov 2016 21:13:59 +0000 (22:13 +0100)]
rustbuild: Point to core and collections's external benchmarks.

7 years agorustbuild: Add bench subcommand
Ulrik Sverdrup [Fri, 25 Nov 2016 21:13:59 +0000 (22:13 +0100)]
rustbuild: Add bench subcommand

Add command `./x.py bench`; use `./x.py bench --help -v` to list all
available benchmark targets.

7 years agoAuto merge of #37987 - plietar:cross-proc-macro, r=jseyfried
bors [Fri, 25 Nov 2016 19:48:08 +0000 (13:48 -0600)]
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

7 years agoFollow our own recommendations in the examples
Vickenty Fesunov [Fri, 25 Nov 2016 16:59:04 +0000 (17:59 +0100)]
Follow our own recommendations in the examples

Remove exclamation marks from the the example error descriptions:
> The description [...] should not contain newlines or sentence-ending punctuation

7 years agoPass new argument ExportSymbol to DIBuilder::createNameSpace
Robin Kruppe [Fri, 25 Nov 2016 16:23:25 +0000 (17:23 +0100)]
Pass new argument ExportSymbol to DIBuilder::createNameSpace

7 years agoAuto merge of #37982 - rkruppe:llvm-diagnostic-fwdcompat, r=alexcrichton
bors [Fri, 25 Nov 2016 15:01:33 +0000 (09:01 -0600)]
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

7 years agoAuto merge of #37979 - nnethercote:Ty-super_fold_with, r=eddyb
bors [Fri, 25 Nov 2016 06:22:49 +0000 (00:22 -0600)]
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)
```

7 years agoAuto merge of #37974 - japaric:abort, r=alexcrichton
bors [Fri, 25 Nov 2016 01:03:07 +0000 (19:03 -0600)]
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

7 years agoDelay error reporting of filename mismatch.
Paul Lietar [Thu, 24 Nov 2016 22:12:36 +0000 (22:12 +0000)]
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

7 years agoSupport `?Sized` in where clauses
Vadim Petrochenkov [Sat, 22 Oct 2016 00:33:36 +0000 (03:33 +0300)]
Support `?Sized` in where clauses

7 years agoAuto merge of #37951 - jseyfried:improve_macro_resolution_perf, r=nrc
bors [Thu, 24 Nov 2016 21:31:47 +0000 (15:31 -0600)]
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

7 years agoRemove completed FIXME.
Corey Farwell [Thu, 24 Nov 2016 21:26:21 +0000 (16:26 -0500)]
Remove completed FIXME.

https://github.com/rust-lang/rust/issues/30530

7 years agoAuto merge of #37944 - bluss:adaptors-are-empty, r=alexcrichton
bors [Thu, 24 Nov 2016 17:56:11 +0000 (11:56 -0600)]
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.

7 years agoSupport LLVM 4.0 in OptimizationDiagnostic FFI
Robin Kruppe [Thu, 24 Nov 2016 16:33:47 +0000 (17:33 +0100)]
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

7 years agoAuto merge of #37770 - pnkfelix:print-type-sizes, r=arielb1
bors [Thu, 24 Nov 2016 14:26:36 +0000 (08:26 -0600)]
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.

7 years agoAvoid more unnecessary mk_ty calls in Ty::super_fold_with.
Nicholas Nethercote [Thu, 24 Nov 2016 10:10:08 +0000 (21:10 +1100)]
Avoid more unnecessary mk_ty calls in Ty::super_fold_with.

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

7 years agoAuto merge of #37943 - bluss:exact-is-empty, r=alexcrichton
bors [Thu, 24 Nov 2016 09:37:44 +0000 (03:37 -0600)]
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.

7 years agoTests of `-Z print-type-sizes` functionality.
Felix S. Klock II [Thu, 24 Nov 2016 09:28:29 +0000 (10:28 +0100)]
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.

7 years agoRevisions from review comments, squashed.
Felix S. Klock II [Tue, 15 Nov 2016 16:48:07 +0000 (17:48 +0100)]
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.

7 years agoAdd `-Z print-type-sizes`, a tool for digging into how variants are laid out.
Felix S. Klock II [Mon, 14 Nov 2016 16:46:20 +0000 (17:46 +0100)]
Add `-Z print-type-sizes`, a tool for digging into how variants are laid out.

7 years agoDefine `bound` argument in std::sync::mpsc::sync_channel
fkjogu [Thu, 24 Nov 2016 08:49:30 +0000 (09:49 +0100)]
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.

7 years agoAuto merge of #37890 - eddyb:rustdoc-1, r=nrc
bors [Thu, 24 Nov 2016 06:26:44 +0000 (00:26 -0600)]
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.

7 years agoAuto merge of #37849 - xen0n:compiler-rt-bump, r=alexcrichton
bors [Thu, 24 Nov 2016 03:03:47 +0000 (21:03 -0600)]
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

7 years agostd: make compilation of libpanic_unwind optional via a Cargo feature
Jorge Aparicio [Thu, 24 Nov 2016 02:49:54 +0000 (21:49 -0500)]
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

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 agorustdoc: we can now assume DocContext always has a TyCtxt.
Eduard-Mihai Burtescu [Sun, 20 Nov 2016 01:42:54 +0000 (03:42 +0200)]
rustdoc: we can now assume DocContext always has a TyCtxt.

7 years agorustdoc: sidestep the main pipeline for test collection.
Eduard-Mihai Burtescu [Sun, 20 Nov 2016 01:11:20 +0000 (03:11 +0200)]
rustdoc: sidestep the main pipeline for test collection.

7 years agorustdoc: use libsyntax ast::Attribute instead of "cleaning" them.
Eduard-Mihai Burtescu [Wed, 23 Nov 2016 23:40:52 +0000 (01:40 +0200)]
rustdoc: use libsyntax ast::Attribute instead of "cleaning" them.

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 agoAdd a tracking issue for enum_set
Steven Fackler [Wed, 23 Nov 2016 18:55:44 +0000 (10:55 -0800)]
Add a tracking issue for enum_set

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 agoAdd missing examples to SocketAddrV6
Guillaume Gomez [Wed, 23 Nov 2016 16:14:41 +0000 (17:14 +0100)]
Add missing examples to SocketAddrV6

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 agoUse "radices" instead of "radicum"
Sam Estep [Wed, 23 Nov 2016 13:49:35 +0000 (08:49 -0500)]
Use "radices" instead of "radicum"

7 years agoUse literal 5 instead of five in book section 4.1
Sam Estep [Wed, 23 Nov 2016 13:41:50 +0000 (08:41 -0500)]
Use literal 5 instead of five in book section 4.1

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 agocore: Fix example for .map()
Ulrik Sverdrup [Wed, 23 Nov 2016 10:33:39 +0000 (11:33 +0100)]
core: Fix example for .map()

Make the example use DoubleEndedIterator for map, like it said it would.

7 years agocore: Iterator docs, collect is not an adaptor
Ulrik Sverdrup [Wed, 23 Nov 2016 10:33:08 +0000 (11:33 +0100)]
core: Iterator docs, collect is not an adaptor

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.