Commit Graph

52735 Commits

Author SHA1 Message Date
Nick Cameron
7ee02d9f4d Use the compiler API to run pretty printing.
This commit still does a lot of building in pretty because we always run after parsing.
2016-05-03 10:49:47 +12:00
Nick Cameron
a4000cbbf8 Make pretty printer take Session by ref 2016-05-03 10:48:22 +12:00
bors
d80497e628 Auto merge of #33308 - ollie27:wingnu_jemalloc, r=alexcrichton
Fix alloc_jemalloc on windows gnu targets

jemalloc prefixes the symbols by default on Windows so we need to account
for that to avoid link errors such as: `undefined reference to 'mallocx'`
when using alloc_jemalloc.
2016-05-02 09:16:23 -07:00
bors
0eb575c702 Auto merge of #33303 - Aatch:mir-coercion-cast, r=arielb1
[MIR] Handle coercion casts properly when building the MIR

Coercion casts (`expr as T` where the type of `expr` can be coerced to
`T`) are essentially no-ops, as the actual work is done by a coercion.
Previously a check for type equality was used to avoid emitting the
redundant cast in the MIR, but this failed for coercion casts of
function items that had lifetime parameters. The MIR trans code doesn't
handle `FnPtr -> FnPtr` casts and produced an error.

Also fixes a bug with type ascription expressions not having any
adjustments applied.

Fixes #33295

/cc @eddyb
2016-05-02 06:58:11 -07:00
bors
e1a575cb07 Auto merge of #33289 - birkenfeld:chain-find, r=bluss
Implement find() on Chain iterators

This results in a roughly 2x speedup compared to the default impl
"inherited" from Iterator.

Benchmark: https://gist.github.com/birkenfeld/aa9b92cb7d55666dd4821207527eaf5b
2016-05-02 04:46:58 -07:00
bors
d3c2c71988 Auto merge of #33284 - nagisa:mir-fix-constfn-pats, r=alexcrichton
Fix patterns of the constants that are const methods
2016-05-02 02:33:33 -07:00
bors
700d3e2374 Auto merge of #33190 - jseyfried:improve_diagnostics, r=nrc
resolve: improve diagnostics and lay groundwork for resolving before ast->hir

This PR improves diagnostics in `resolve` and lays some groundwork for resolving before ast->hir.

More specifically,
 - It removes an API in `resolve` intended for external refactoring tools (see #27493) that appears not to be in active use. The API is incompatible with resolving before ast->hir, but could be rewritten in a more compatible and less intrusive way.
 - It improves the diagnostics for pattern bindings that conflict with `const`s.
 - It improves the diagnostics for modules used as expressions (fixes #33186).
 - It refactors away some uses of the hir map, which is unavavailable before ast->hir lowering.

r? @eddyb
2016-05-01 20:39:33 -07:00
bors
855fb61922 Auto merge of #33296 - jseyfried:non_idempotent_lowering, r=nrc
Remove the requirement that ast->hir lowering be reproducible

This PR changes the ast->hir lowerer to be non-reproducible, and it removes the lowering context's id cache.

If the `hir` of an `ast` node needs to be reproduced, we can use the hir map instead of the lowerer -- for example, `tcx.map.expect_expr(expr.id)` instead of `lower_expr(lcx, expr)`.

r? @nrc
2016-05-01 18:28:24 -07:00
Jeffrey Seyfried
ef69ef81e3 Remove outdated comment 2016-05-02 00:43:02 +00:00
Jeffrey Seyfried
522b6ed8a7 Avoid keeping MTWT tables for save-analysis 2016-05-02 00:19:22 +00:00
Jeffrey Seyfried
298a1c056f Cleanup formatting 2016-05-02 00:19:19 +00:00
Jeffrey Seyfried
b8dc2a7c76 Remove the lowering context's id caching system 2016-05-01 23:49:12 +00:00
Jeffrey Seyfried
ca88c44a90 Avoid using the lowering context in librustc_save_analysis 2016-05-01 23:30:18 +00:00
Jeffrey Seyfried
02df9f32b1 Remove idempotent lowering test 2016-05-01 23:30:14 +00:00
bors
adda14a033 Auto merge of #33298 - drbo:patch-1, r=alexcrichton
Note that later versions of G++ are okay

G++ 4.7 is the minimum requirement, but later versions are also okay.
2016-05-01 16:17:29 -07:00
bors
a4b0481d1c Auto merge of #33317 - michaelwoerister:fix-partitioning-tests-race, r=alexcrichton
Fix a race condition caused by concurrently executed codegen unit tests.

This hopefully fixes issue #33315.

This short-term solution just makes sure that every test uses its own directory so they can't get into conflict with each other.

As a more long-term solution, I'd probably prefer to make the partitioning scheme specifiable via `-Ccodegen-units` (e.g. like `-Ccodegen-units=per-module`) so that we don't have to rely on `-Zincremental` in these test cases.

r? @alexcrichton
2016-05-01 12:59:25 -07:00
Michael Woerister
a4128e5950 Fix a race condition caused by concurrently executed codegen unit tests. 2016-05-01 13:53:39 -04:00
Oliver Middleton
e8cbcef86e Fix alloc_jemalloc on windows gnu targets
jemalloc prefixes the symbols by default on Windows so we need to account
for that to avoid link errors such as: `undefined reference to `mallocx'`
when using alloc_jemalloc.
2016-05-01 13:16:06 +01:00
James Miller
3906aef5c6 Handle coercion casts properly when building the MIR
Coercion casts (`expr as T` where the type of `expr` can be coerced to
`T`) are essentially no-ops, as the actual work is done by a coercion.
Previously a check for type equality was used to avoid emitting the
redundant cast in the MIR, but this failed for coercion casts of
function items that had lifetime parameters. The MIR trans code doesn't
handle `FnPtr -> FnPtr` casts and produced an error.

Also fixes a bug with type ascription expressions not having any
adjustments applied.

Fixes #33295
2016-05-01 17:56:07 +12:00
Jeffrey Seyfried
0649942a46 Panic on relowering an AST node with a cached node id 2016-04-30 21:33:27 +00:00
Demetri Obenour
08207c9b52 Note that later versions of G++ are okay
G++ 4.7 is the minimum requirement, but later versions are also okay.
2016-04-30 17:21:18 -04:00
bors
2a815a26c8 Auto merge of #33276 - bwinterton:btreeset-insert-doc-fix, r=GuillaumeGomez
Make BTreeSet::Insert docs more consistent

Made the BTreeSet::Insert documentation consistent with the HashSet::Insert documentation by using the term 'value' instead of 'key'.

r? @steveklabnik
2016-04-30 08:59:46 -07:00
bors
9e17622449 Auto merge of #33279 - brson:insert-diatribe-against-github-here, r=alexcrichton
configure: Add a sanity check for tarballs without submodules

Because GitHub publishes broken tarballs on our behalf that we can't
disable, this adds a check that src/liblibc exists, and then
complains if not.

Tested.
2016-04-30 04:55:28 -07:00
Georg Brandl
e6201cfb5c Implement find() on Chain iterators
This results in a roughly 2x speedup compared to the default impl
"inherited" from Iterator.
2016-04-30 11:16:35 +02:00
bors
b0aefff714 Auto merge of #32846 - jseyfried:allow_unconfigured_gated_expanded_items, r=nrc
Avoid gated feature checking unconfigured expanded items

Avoid gated feature checking unconfigured macro-expanded items (fixes #32840).
Unconfigured items that are not macro-expanded are already not gated feature checked.
r? @nrc
2016-04-30 02:07:33 -07:00
bors
46504e9a9d Auto merge of #33148 - sfackler:entry-key, r=alexcrichton
Add Entry::key

This method was present on both variants of Entry, but not the enum

cc #32281

r? @alexcrichton
2016-04-29 18:11:25 -07:00
Simonas Kazlauskas
04f8ba2ece Impl int/uint::MIN/MAX in terms of min/max_value 2016-04-30 03:40:34 +03:00
Simonas Kazlauskas
5f956103c8 Fix patterns of the constants that are const meth
See the regression test for the sample code this fixes
2016-04-30 03:40:09 +03:00
bors
9b63263d0d Auto merge of #33229 - timothy-mcroy:master, r=guillaumegomez
Explain E0434
2016-04-29 12:59:39 -07:00
Brian Anderson
6bc9318318 configure: Add a sanity check for tarballs without submodules
Because GitHub publishes broken tarballs on our behalf that we can't
disable, this adds a check that src/liblibc exists, and then
complains if not.
2016-04-29 19:39:22 +00:00
Jeffrey Seyfried
a70e42a953 Remove use of ast_map.expect_item() and improve diagnostics (fixes #33186) 2016-04-29 18:34:49 +00:00
Jeffrey Seyfried
5a4e0b14e3 Remove use of ast_map.span_if_local() and improve diagnostics 2016-04-29 18:34:40 +00:00
Jeffrey Seyfried
60c8f7dbf5 Revert #27493 2016-04-29 18:34:13 +00:00
bors
8b1dcf40f2 Auto merge of #33232 - jseyfried:resolve_ast_groundwork, r=nrc
resolve: cleanup and groundwork for resolving the AST

Cleanup `resolve` and refactor away uses of the hir map (incorrectly named `ast_map`).
r? @nrc
2016-04-29 09:02:36 -07:00
Brayden Winterton
3c1d08744d Make Btreeset::Insert docs more consistent 2016-04-29 09:59:39 -06:00
bors
e07e34c4b0 Auto merge of #33272 - Manishearth:rollup, r=Manishearth
Rollup of 4 pull requests

- Successful merges: #33239, #33248, #33253, #33258
- Failed merges:
2016-04-29 06:49:45 -07:00
Manish Goregaokar
f30058facf Rollup merge of #33258 - birkenfeld:fmt-dollar-syntax, r=brson
Clarify std::fmt width docs w.r.t. dollar syntax and give example.

The previous version only said "the `2$` syntax", which while introduced in the grammar is not very self-explanatory.
2016-04-29 19:17:59 +05:30
Manish Goregaokar
3a0efffc9d Rollup merge of #33253 - ergenekonyigit:master, r=alexcrichton
rustdoc: fixed some RFCs

r? @alexcrichton
2016-04-29 19:17:58 +05:30
Manish Goregaokar
13c1956f7c Rollup merge of #33248 - jseyfried:fix_save_analysis_bug, r=nrc
rustc_save_analysis: fix a bug in which glob imports are not dumped

This fixes #33213, a bug that prevents glob imports from being included in the save-analysis data.
r? @nrc
2016-04-29 19:17:57 +05:30
bors
c0c08e2d77 Auto merge of #33093 - alexcrichton:rustbuild-rmake, r=nikomatsakis
test: Move run-make tests into compiletest

Forcing them to be embedded in makefiles precludes being able to run them in
rustbuild, and adding them to compiletest gives us a great way to leverage
future enhancements to our "all encompassing test suite runner" as well as just
moving more things into Rust.

All tests are still Makefile-based in the sense that they rely on `make` being
available to run them, but there's no longer any Makefile-trickery to run them
and rustbuild can now run them out of the box as well.
2016-04-28 23:34:00 -07:00
Alex Crichton
126e09e5e5 test: Move run-make tests into compiletest
Forcing them to be embedded in makefiles precludes being able to run them in
rustbuild, and adding them to compiletest gives us a great way to leverage
future enhancements to our "all encompassing test suite runner" as well as just
moving more things into Rust.

All tests are still Makefile-based in the sense that they rely on `make` being
available to run them, but there's no longer any Makefile-trickery to run them
and rustbuild can now run them out of the box as well.
2016-04-28 21:46:40 -07:00
Jeffrey Seyfried
e9c42257d5 Fix #33213, a bug in which glob imports are not included in save-analysis data 2016-04-28 22:04:39 +00:00
bors
8da2bcac5d Auto merge of #33171 - michaelwoerister:collector-drop-glue, r=nikomatsakis
Some preliminary work towards making trans "collector driven".

The `trans::collector` already collects all translation items and `trans::partitioning` distributes these translation items into codegen units. The changes in this PR provide the following extensions to this functionality:

1. Drop-glue is handled more accurately now, knowing about the difference between `DropGlueKind::Ty` and `DropGlueKind::TyContents`.
2. The partitioning module now supports the `FixedUnitCount` strategy which more or less corresponds to the partitioning one gets via supplying `-Ccodegen-units` today.
3. The partitioning scheme also takes care of assigned LLVM declarations to codegen units, not just definitions (declarations for external items not yet implemented).

It's debatable whether declarations should be handled by the partitioning scheme or whether they should just be emitted on demand.
2016-04-28 14:37:30 -07:00
Michael Woerister
0fc9f9a200 Make the codegen unit partitioner also emit item declarations. 2016-04-28 16:53:00 -04:00
bors
115c6c810c Auto merge of #33217 - aochagavia:fileloader, r=nrc
rustc_driver: Allow running the compiler with a FileLoader

cc @nrc. I chose to implement this in such a way that it doesn't break anything. Please let me know if you want me to change anything.
2016-04-28 12:27:27 -07:00
Michael Woerister
7f04d35cc6 Add FixedUnitCount codegen unit partitioning strategy. 2016-04-28 14:36:34 -04:00
Michael Woerister
c61f22932d Let the translation item collector make a distinction between drop-glue kinds 2016-04-28 14:36:34 -04:00
bors
02acf0917f Auto merge of #33211 - alexcrichton:android-back-in-time, r=nagisa
std: Add compatibility with android-9

The Gecko folks currently use Android API level 9 for their builds, so they're
requesting that we move back our minimum supported API level from 18 to 9. Turns
out, ABI-wise at least, there's not that many changes we need to take care of.
The `ftruncate64` API appeared in android-12 and the `log2` and `log2f` APIs
appeared in android-18. We can have a simple shim for `ftruncate64` which falls
back on `ftruncate` and the `log2` function can be approximated with just
`ln(f) / ln(2)`.

This should at least get the standard library building on API level 9, although
the tests aren't quite happening there just yet. As we seem to be growing a
number of Android compatibility shims, they're now centralized in a common
`sys::android` module.
2016-04-28 10:17:44 -07:00
Timothy McRoy
0cfb5a0bb6 Add detailed error message for E0434 #32777 2016-04-28 10:56:32 -05:00
Georg Brandl
815987b4ce Clarify std::fmt width docs w.r.t. dollar syntax and give example. 2016-04-28 17:50:12 +02:00