Commit Graph

52724 Commits

Author SHA1 Message Date
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
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
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
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
bors
ea6b3ddee9 Auto merge of #33257 - steveklabnik:rollup, r=steveklabnik
Rollup of 7 pull requests

- Successful merges: #32991, #33056, #33095, #33152, #33212, #33218, #33234
- Failed merges: #32912
2016-04-28 07:59:02 -07:00
Steve Klabnik
b9dd8aa4c2 Rollup merge of #33234 - TomasHubelbauer:TomasHubelbauer-patch-1, r=GuillaumeGomez
Fix use of the `move` command in the Windows shell

`move` works both in `cmd` and in Powershell. `mv` works only in Powershell and the book says nothing about which shell is recommended so this could confuse beginners.

Closes #33219.
2016-04-28 09:51:44 -04:00
Steve Klabnik
68f7fc52fd Rollup merge of #33218 - oli-obk:interned_str_cmp, r=nikomatsakis
allow InternedString to be compared to &str directly
2016-04-28 09:51:44 -04:00
Steve Klabnik
7c2a98570c Rollup merge of #33212 - bombless:scope-of-function-body, r=nikomatsakis
Improve error message about regions of function body

"scope of parameters for functions" is harder for me to read than "scope of function body", I hope others feel the same, as in <https://play.rust-lang.org/?gist=b4df68b395b807698bd2ba98cf3d5ce3&version=stable&backtrace=0&run=1>
 Thank @Aatch for the help :)
2016-04-28 09:51:44 -04:00
Steve Klabnik
c72a771dd8 Rollup merge of #33152 - bwinterton:master, r=steveklabnik
Make HashSet::Insert documentation more consistent

I have made the HashSet::Insert documentation more consistent in the use of the term 'value' vs 'key'. Also clarified that if _this_ value is present true is returned, instead of the ambiguous 'a value present'.

r? @steveklabnik
2016-04-28 09:51:44 -04:00
Steve Klabnik
32db236342 Rollup merge of #33095 - xogeny:xogeny-patch-1, r=steveklabnik
Tweaks to sections related to Ownership

Reading through these sections, I thought the intro text could be improved slightly.  So
here is a PR that addresses what was bugging me about it. :-)

Main issue was the wording of the opening sentence ("guide" is not clearly defined and the
wording was a bit too terse in my opinion).  I also took issue with the term "one of the most
unique".  Uniqueness is a `bool`, not an `f64`. :-)

r? @steveklabnik
2016-04-28 09:51:44 -04:00
Steve Klabnik
385a54f4d4 Rollup merge of #33056 - GuillaumeGomez:as_mut_ptr_example, r=steveklabnik
Improve as_mut ptr method example

r? @steveklabnik
2016-04-28 09:51:43 -04:00
Steve Klabnik
3c14116f64 Rollup merge of #32991 - kindlychung:patch-2, r=steveklabnik
make the borrowing example more concrete
2016-04-28 09:51:43 -04:00
bors
4751e45521 Auto merge of #33208 - nrc:save-json, r=pnkfelix
save-analysis: dump in JSON format

cc #18582
2016-04-28 05:47:57 -07:00
bors
0f9ba99291 Auto merge of #33161 - jseyfried:parse_tuple_struct_field_vis, r=nikomatsakis
Parse `pub(restricted)` visibilities on tuple struct fields

Parse `pub(restricted)` on tuple struct fields (cc #32409).

r? @nikomatsakis
2016-04-28 03:38:04 -07:00
bors
009a64916e Auto merge of #32980 - Aatch:better-mir-building, r=nagisa
Various improvements to MIR and LLVM IR Construction

Primarily affects the MIR construction, which indirectly improves LLVM
IR generation, but some LLVM IR changes have been made too.

* Handle "statement expressions" more intelligently. These are
  expressions that always evaluate to `()`. Previously a temporary would
  be generated as a destination to translate into, which is unnecessary.

  This affects assignment, augmented assignment, `return`, `break` and
  `continue`.
* Avoid inserting drops for non-drop types in more places. Scheduled
  drops were already skipped for types that we knew wouldn't need
  dropping at construction time. However manually-inserted drops like
  those for `x` in `x = y;` were still generated. `build_drop` now takes
  a type parameter like its `schedule_drop` counterpart and checks to
  see if the type needs dropping.

* Avoid generating an extra temporary for an assignment where the types
  involved don't need dropping. Previously an expression like
  `a = b + 1;` would result in a temporary for `b + 1`. This is so the
  RHS can be evaluated, then the LHS evaluated and dropped and have
  everything work correctly. However, this isn't necessary if the `LHS`
  doesn't need a drop, as we can just overwrite the existing value.

* Improves lvalue analysis to allow treating an `Rvalue::Use` as an
  operand in certain conditions. The reason for it never being an
  operand is so it can be zeroed/drop-filled, but this is only true for
  types that need dropping.

The first two changes result in significantly fewer MIR blocks being
generated, as previously almost every statement would end up generating
a new block due to the drop of the `()` temporary being generated.
2016-04-28 01:26:45 -07:00