Commit graph

44723 commits

Author SHA1 Message Date
bors
5e6b534362 Auto merge of #27087 - nikomatsakis:closure-exploration, r=nrc
Refactors the "desugaring" of closures to expose the types of the upvars. This is necessary to be faithful with how actual structs work. The reasoning of the particular desugaring that I chose is explained in a fairly detailed comment.

As a side-effect, recursive closure types are prohibited unless a trait object intermediary is used. This fixes #25954 and also eliminates concerns about unrepresentable closure types that have infinite size, I believe. I don't believe this can cause regressions because of #25954.

(As for motivation, besides #25954 etc, this work is also intended as refactoring in support of incremental compilation, since closures are one of the thornier cases encountered when attempting to split node-ids into item-ids and within-item-ids. The goal is to eliminate the "internal def-id" distinction in astdecoding. However, I have to do more work on trans to really make progress there.)

r? @nrc
2015-07-24 16:36:32 +00:00
bors
0fb8ab04bc Auto merge of #27136 - dhuseby:fixing_freebsd_linking, r=alexcrichton
freebsd linking fix.
2015-07-24 14:17:48 +00:00
Niko Matsakis
71d44189e0 minor rebase fixes 2015-07-24 08:24:35 -04:00
bors
9413a926fc Auto merge of #27215 - pnkfelix:fsk-placer-take-5-just-in, r=nikomatsakis
Macro desugaring of `in PLACE { BLOCK }` into "simpler" expressions following the in-development "Placer" protocol.

Includes Placer API that one can override to integrate support for `in` into one's own type.  (See [RFC 809].)

[RFC 809]: https://github.com/rust-lang/rfcs/blob/master/text/0809-box-and-in-for-stdlib.md

Part of #22181

Replaced PR #26180.

Turns on the `in PLACE { BLOCK }` syntax, while leaving in support for the old `box (PLACE) EXPR` syntax (since we need to support that at least until we have a snapshot with support for `in PLACE { BLOCK }`.

(Note that we are not 100% committed to the `in PLACE { BLOCK }` syntax.  In particular I still want to play around with some other alternatives.  Still, I want to get the fundamental framework for the protocol landed so we can play with implementing it for non `Box` types.)

----

Also, this PR leaves out support for desugaring-based `box EXPR`.  We will hopefully land that in the future, but for the short term there are type-inference issues injected by that change that we want to resolve separately.
2015-07-24 10:12:20 +00:00
Niko Matsakis
d075faa2ed nits 2015-07-24 04:53:43 -04:00
Niko Matsakis
f8931a7933 Add regression test for #25368. Fixes #25368. 2015-07-24 04:53:43 -04:00
Niko Matsakis
37aad77ce2 Add regression test for #25954 (cyclic closure type), which is now
impossible.
2015-07-24 04:53:43 -04:00
Niko Matsakis
7ba288dced Unify the upvar variables found in closures with the actual types of the
upvars after analysis is done. Remove the `closure_upvars` helper and
just consult this list of type variables directly.
2015-07-24 04:53:41 -04:00
Niko Matsakis
a551697134 Don't be so eager to call unresolved inference variables an error. MC
is being used now before the final regionck stage and in some cases SOME
amount of unresolved inference is OK. In fact, we could probably just
allow inference variables as well with only minimal pain.
2015-07-24 04:53:19 -04:00
Niko Matsakis
4172c8237b Add some debugging to help identify when errors get reported. 2015-07-24 04:53:19 -04:00
Niko Matsakis
6b49f4ded7 Run the analysis process only once per closure, on the way up the tree.
This was the intention before but silly coding caused it to run twice if
there are nested closures.
2015-07-24 04:53:19 -04:00
Niko Matsakis
1e2677be72 Introduce ClosureSubsts rather than just having random fields in the
TyClosure variant; thread this through wherever closure substitutions
are expected, which leads to a net simplification. Simplify trans
treatment of closures in particular.
2015-07-24 04:53:17 -04:00
Niko Matsakis
69d62e04e5 introduce a Vec<Ty> to TyClosure for storing upvar types 2015-07-24 04:50:45 -04:00
bors
607f74df2a Auto merge of #27227 - eternaleye:patch-1, r=alexcrichton
Currently, `rustc` generates nondeterministic archives, which contain system timestamps. These don't really serve any useful purpose, and enabling deterministic archives moves us a little closer to completely deterministic builds. For a small toy library using `std::ops::{Deref,DerefMut}`, this change actually results in a bit-for-bit identical build every time.
2015-07-24 07:37:03 +00:00
bors
c9ef1a5c19 Auto merge of #27208 - alexcrichton:msvc-less-dllimport, r=brson
Currently you can hit a link error on MSVC by only referencing static items from
a crate (no functions for example) and then link to the crate statically (as all
Rust crates do 99% of the time). A detailed investigation can be found [on
github][details], but the tl;dr is that we need to stop applying dllimport so
aggressively.

This commit alters the application of dllimport on constants to only cases where
the crate the constant originated from will be linked as a dylib in some output
crate type. That way if we're just linking rlibs (like the motivation for this
issue) we won't use dllimport. For the compiler, however, (which has lots of
dylibs) we'll use dllimport.

[details]: https://github.com/rust-lang/rust/issues/26591#issuecomment-123513631

cc #26591
2015-07-24 05:13:39 +00:00
bors
68e0d13bfd Auto merge of #26583 - eefriedman:lint-ffi, r=nrc
Makes the lint a bit more accurate, and improves the quality of the diagnostic
messages by explicitly returning an error message.
2015-07-24 02:40:42 +00:00
Dave Huseby
a04b8391e0 switching to gnu archive format 2015-07-23 18:32:07 -07:00
Dave Huseby
02b394cef8 fixes #27124 for freebsd 2015-07-23 18:32:07 -07:00
Eli Friedman
6fa17b43d3 Rewrite the improper_ctypes lint.
Makes the lint a bit more accurate, and improves the quality of the diagnostic
messages by explicitly returning an error message.

The new lint is also a little more aggressive: specifically, it now
rejects tuples, and it recurses into function pointers.
2015-07-23 17:03:04 -07:00
bors
69ca012564 Auto merge of #27224 - alexcrichton:configure-lto-right, r=brson
The LTO pass in the compiler forgot to call the `LLVMRustAddBuilderLibraryInfo`
function and configure other options such as merge_functions, vectorize_slp,
etc. This ended up causing linker errors on MSVC targets because the optimizer
didn't have the right knowledge that some system functions are missing on these
platforms.

This commit consolidates creation of PassManagerBuilder instances to one
function which is then called when needed. This ensures that the pass manager is
always correctly configured with the various target-specific information that
LLVM needs.

Overall, this fixes `-C lto -C opt-level=3` on 32-bit MSVC targets.
2015-07-23 23:38:36 +00:00
Felix S. Klock II
d066a7b506 update compile-fail/pushpop-unsafe-rejects.rs to reflect switch from saturated to checked arith. 2015-07-23 23:39:28 +02:00
Felix S. Klock II
2d68d09b46 review feedback: common-subexpression-elim across functions in pushpop_safe impl. 2015-07-23 23:39:28 +02:00
Felix S. Klock II
44bb0dd4a3 review feedback: Use checked-arith instead of saturated-arith for push_unsafe! and pop_unsafe!. 2015-07-23 23:39:25 +02:00
bors
c85ba3e9cb Auto merge of #27226 - eefriedman:leftover-negation-lint, r=alexcrichton
r? @pnkfelix
2015-07-23 19:11:51 +00:00
bors
7911d9979f Auto merge of #27221 - dotdash:no_empty_clean, r=luqmana
When compiling libsyntax this removes about 30k basic blocks that only
contain a single unconditional jump and reduces the peak memory usage by
about 10MB (from 681MB down to 671MB).
2015-07-23 15:59:20 +00:00
Felix S. Klock II
565df576e8 Update suggestion from parenthesized-box-expr-message to reflect new output spacing. 2015-07-23 16:02:27 +02:00
Felix S. Klock II
5682e2a1aa fix pretty printing tests by opting into the features that the expanded code needs. 2015-07-23 16:02:27 +02:00
Felix S. Klock II
225298c377 fix doc-tests by opting into placement_in_syntax feature where necessary. 2015-07-23 16:02:26 +02:00
Felix S. Klock II
73df224f05 Review feedback: add unstable marker to Placer API and put in bound that now works. 2015-07-23 16:02:26 +02:00
bors
2e5b165e18 Auto merge of #27203 - marcusklaas:fix-range-span, r=alexcrichton
Right trims the span for certain range expressions.

Closes https://github.com/rust-lang/rust/issues/27162.
2015-07-23 12:52:21 +00:00
bors
d6a6178637 Auto merge of #26588 - eefriedman:foreign-lifetime, r=nrc
Pretty straightforward; just need to make sure to explicitly handle
the generic parameters of each ast::ForeignItemFn.

Fixes #26587.
2015-07-23 09:16:08 +00:00
eternaleye
4e67f9c611 Write deterministic archives
Currently, `rustc` generates nondeterministic archives, which contain system timestamps. These don't really serve any useful purpose, and enabling deterministic archives moves us a little closer to completely deterministic builds. For a small toy library using `std::ops::{Deref,DerefMut}`, this change actually results in a bit-for-bit identical build every time.
2015-07-22 23:54:59 -07:00
Eli Friedman
b2213498c4 Resolve lifetime parameters for foreign functions.
Pretty straightforward; just need to make sure to explicitly handle
the generic parameters of each ast::ForeignItemFn.

Fixes #26587.
2015-07-22 22:37:20 -07:00
bors
8d91bbd90a Auto merge of #27192 - dotdash:inline_eq_slice, r=luqmana
eq_slice_() used to be a common implementation for two function that
both called it, but of those only eq_slice() is left, so we can as well
directly inline the code.
2015-07-23 02:24:06 +00:00
Eli Friedman
312f886d03 Remove orphaned unsigned_negation lint reference. 2015-07-22 17:47:01 -07:00
bors
cb4f102e38 Auto merge of #27191 - pnkfelix:sidestep-unary-negate-warning, r=alexcrichton
Work around unary negation to-be-feature-gated warning by replacing references to `-1` as a `ast::NodeId` with `ast::DUMMY_NODE_ID`, which seems like a better notation to use (it is currently also `-1`.

(AFAICT the code is not *relying* on the value `-1` anywhere, it really just needed a dummy value for when the input is `None`.)
2015-07-22 23:37:37 +00:00
Alex Crichton
70e8220166 trans: Consolidate creating pass manager builders
The LTO pass in the compiler forgot to call the `LLVMRustAddBuilderLibraryInfo`
function and configure other options such as merge_functions, vectorize_slp,
etc. This ended up causing linker errors on MSVC targets because the optimizer
didn't have the right knowledge that some system functions are missing on these
platforms.

This commit consolidates creation of PassManagerBuilder instances to one
function which is then called when needed. This ensures that the pass manager is
always correctly configured with the various target-specific information that
LLVM needs.

Overall, this fixes `-C lto -C opt-level=3` on 32-bit MSVC targets.
2015-07-22 16:22:51 -07:00
Felix S. Klock II
1905a49875 address review feedback: remove dupe feature opt-in. 2015-07-22 23:25:52 +02:00
Felix S. Klock II
abad7d6bba placate make tidy. 2015-07-22 23:23:36 +02:00
Björn Steinbrink
a66af8788d Avoid creating basic blocks for empty cleanup scopes
When compiling libsyntax this removes about 30k basic blocks that only
contain a single unconditional jump and reduces the peak memory usage by
about 10MB (from 681MB down to 671MB).
2015-07-22 23:15:01 +02:00
bors
4234c4487a Auto merge of #27188 - pnkfelix:sidestep-warning-for-E0045, r=alexcrichton
Sidestep warning about repeated E0045 `span_err!` invocation.

(That is, take the two expressions with the same message and unify them into one subroutine.)
2015-07-22 20:44:39 +00:00
bors
5542830665 Auto merge of #27219 - steveklabnik:rollup, r=steveklabnik
- Successful merges: #27084, #27127, #27131, #27140, #27146, #27147, #27151, #27154, #27155, #27156, #27157, #27158, #27163, #27164, #27166, #27167, #27170, #27175, #27183, #27201, #27202
- Failed merges: #26778
2015-07-22 16:58:56 +00:00
Steve Klabnik
5f04b1b384 Rollup merge of #27202 - apasel422:issue-21174, r=alexcrichton 2015-07-22 12:56:52 -04:00
Steve Klabnik
5665efd60e Rollup merge of #27201 - Ticki:master, r=steveklabnik
Just some small changes.
2015-07-22 12:56:52 -04:00
Steve Klabnik
7cacf83009 Rollup merge of #27183 - Dangthrimble:master, r=steveklabnik
Updated "Installing Rust" and "After installation" to provide additional guidance to Windows users on including Rust in the Path system variable.

r? @steveklabnik
2015-07-22 12:56:52 -04:00
Steve Klabnik
068e7d7039 Rollup merge of #27175 - steveklabnik:channels_plus_travis, r=alexcrichton
This should help people configure travis to test all three channels.
2015-07-22 12:56:52 -04:00
Steve Klabnik
a39a36aec9 Rollup merge of #27170 - steveklabnik:doc_std_io_intoinnererror, r=alexcrichton
Mostly adding examples.

r? @alexcrichton
2015-07-22 12:56:51 -04:00
Steve Klabnik
932f0bb5c3 Rollup merge of #27167 - steveklabnik:doc_std_io_take, r=alexcrichton
Better and more consistent links to their creators.
2015-07-22 12:56:51 -04:00
Steve Klabnik
6397ecb3ca Rollup merge of #27166 - steveklabnik:doc_std_io_linewriter, r=alexcrichton
Beef up the struct docs, add examples for the methods.

r? @alexcrichton
2015-07-22 12:56:51 -04:00
Steve Klabnik
47f1286d56 Rollup merge of #27164 - steveklabnik:doc_io_utils, r=alexcrichton
These provide various special readers, so point their docs to their
constructor functions in a manner consistent with everything else.

r? @alexcrichton
2015-07-22 12:56:50 -04:00