Commit Graph

67787 Commits

Author SHA1 Message Date
Alex Crichton
929215db7c Rollup merge of #44671 - GuillaumeGomez:run-button, r=steveklabnik
Fix run button

r? @QuietMisdreavus

Before:

![before](https://user-images.githubusercontent.com/3050060/30538927-612c6a44-9c70-11e7-9ca2-f3860d880b95.png)

After:

![after](https://user-images.githubusercontent.com/3050060/30538929-6416ea0e-9c70-11e7-990a-7e4fbf5d7319.png)

Quite urgent.
2017-09-18 11:04:28 -05:00
Alex Crichton
4af3073c71 Rollup merge of #44668 - iwillspeak:into-iterator-docs, r=steveklabnik
Add Example of `IntoIterator` as Trait Bound to Docs

Part of #44600.
2017-09-18 11:04:27 -05:00
Alex Crichton
3bbe15376c Rollup merge of #44661 - GuillaumeGomez:more-links, r=QuietMisdreavus
Add more links and put the link character to the left

r? @QuietMisdreavus

And of course, a few screenshots:

<img width="1440" alt="screen shot 2017-09-17 at 22 08 46" src="https://user-images.githubusercontent.com/3050060/30524496-44a50208-9bf5-11e7-942e-a3707ba125c3.png">
<img width="1440" alt="screen shot 2017-09-17 at 22 09 47" src="https://user-images.githubusercontent.com/3050060/30524502-49068dbc-9bf5-11e7-8e59-ec38664e0e0f.png">
<img width="1440" alt="screen shot 2017-09-17 at 22 10 56" src="https://user-images.githubusercontent.com/3050060/30524503-491c8c34-9bf5-11e7-9ce5-f1bd5ef8600b.png">
2017-09-18 11:04:26 -05:00
Alex Crichton
64c9fd6832 Rollup merge of #44657 - Ixrec:patch-1, r=eddyb
Replace str's transmute() calls with pointer casts

After the following conversation in #rust-lang:
```
[14:43:50] <Ixrec> TIL the implementation of from_utf_unchecked is literally just "mem::transmute(x)"
[14:43:59] <Ixrec> no wonder people keep saying transmute is overpowered
[15:15:30] <eddyb> Ixrec: it should be a pointer cast lol
[15:15:46] <eddyb> unless it doesn't let you
[16:50:34] <Ixrec> https://play.rust-lang.org/?gist=d1e6b629ad9ec1baf64ce261c63845e6&version=stable seems like it does let me
[16:52:35] <eddyb> Ixrec: yeah that's the preferred impl
[16:52:46] <eddyb> Ixrec: it just wasn't in 1.0
[16:52:50] <eddyb> IIRC
[16:53:00] <eddyb> (something something fat pointers)
```
Since I already wrote half of the preferred impls in the playground, might as well make an actual PR.
2017-09-18 11:04:25 -05:00
Alex Crichton
d5b0cbbeea Rollup merge of #44651 - bluss:document-thread-name-no-nuls, r=steveklabnik
Document thread builder panics for nul bytes in thread names

This seems to have been undocumented. Mention this where the name is set
(Builder::name) and where the panic could happen (Builder::spawn).

Thread::new is private and I think the builder is the only user where
this matters. A short comment was added to "document" Thread::new too.
2017-09-18 11:04:24 -05:00
Alex Crichton
fa9dd27168 Rollup merge of #44640 - budziq:stabilize_splice, r=dtolnay
Stabilized vec_splice and modified splice tracking issue

This stabilizes the vec_splice (Vec part of splice RFC)
Fixes #32310.
2017-09-18 11:04:23 -05:00
Alex Crichton
156698ea60 Rollup merge of #44548 - oyvindln:rustc_help_fix, r=arielb1
Add proper help line for `-C inline threshold`

Looks like someone accidentally some words when adding this.

This also remove a period on a different help line for consistency, as no options have a period.
2017-09-18 11:04:22 -05:00
Alex Crichton
8dae2b0aef Rollup merge of #44537 - oli-obk:memchr, r=alexcrichton
More `align_offset` things

cc #44488
2017-09-18 11:04:21 -05:00
Alex Crichton
fbf3b8ab8e Rollup merge of #44466 - clarcharr:cow_error, r=alexcrichton
Add Cow<str> -> Box<Error> impls.

Considering how impls exist for `String` and `&str`, it makes sense to also add an impl for `Cow<str>` as well.

This would allow converting `String::from_utf8_lossy` directly into a `Box<Error>` or `io::Error` without having to add an extra `into_ownd()`.
2017-09-18 11:04:20 -05:00
Alex Crichton
9ad5473672 Rollup merge of #44364 - michaelwoerister:hash-all-the-things2, r=nikomatsakis
incr.comp.: Compute fingerprint for all query results.

This PR enables query result fingerprinting in incremental mode. This is an essential piece of infrastructure for red/green tracking. We don't do anything with the fingerprints yet but merging the infrastructure should protect it from bit-rotting and will make it easier to start measuring its performance impact (and thus let us determine if we should switch to a faster hashing algorithm rather sooner than later).

Note, this PR also includes the changes from https://github.com/rust-lang/rust/pull/43887 which I'm therefore closing. No need to re-review the first commit though.

r? @nikomatsakis
2017-09-18 11:04:19 -05:00
Guillaume Gomez
90ce24ab69 Fix run button 2017-09-18 14:44:28 +02:00
Michael Woerister
4961a8e2bd incr.comp.: Fix ICE caused by trying to hash INVALID_CRATE_NUM. 2017-09-18 13:14:38 +02:00
Michael Woerister
74d6b850fd incr.comp.: Fix rebase fallout. 2017-09-18 12:14:52 +02:00
Michael Woerister
d5b1fee6fd incr.comp.: Remove tcx from StableHashingContext. 2017-09-18 11:29:47 +02:00
Michael Woerister
ba6f93ca76 incr.comp.: Make the StableHashingContext mostly independent of the tcx. 2017-09-18 11:28:31 +02:00
Michael Woerister
e567afbc58 incr.comp.: Initialize IGNORED_ATTRS in StableHashingContext lazily. 2017-09-18 11:27:41 +02:00
Michael Woerister
dd501735ac incr.comp.: Initialize the CachingCodemapView in StableHashingContext lazily. 2017-09-18 11:27:41 +02:00
Michael Woerister
67c84e05e7 incr.comp.: Use StableHash impls instead of functions for hashing most maps. 2017-09-18 11:27:10 +02:00
Michael Woerister
b9816c5fab incr.comp.: Already hash HIR bodies during metadata export so they don't have to be hashed in downstream crates. 2017-09-18 11:26:11 +02:00
Michael Woerister
e3f913167c Fix issues uncovered by rebasing:
- Don't hash traits in scope as part of HIR hashing any more.
- Some queries returned DefIndexes from other crates.
- Provide a generic way of stably hashing maps (not used everywhere yet).
2017-09-18 11:25:34 +02:00
Michael Woerister
3cc3ae22bd incr.comp.: Move result fingerprinting to DepGraph::with_task().
This makes sure that we don't introduce strange cases where we have
nodes outside the query system that could break red/green tracking
and it will allow to keep red/green neatly encapsulated within the
DepGraph implementation.
2017-09-18 11:25:34 +02:00
Michael Woerister
e6c9a53d1a incr.comp.: Compute hashes of all query results. 2017-09-18 11:23:08 +02:00
Michael Woerister
3cf28f3002 Use DefId instead of NodeId as identifier in resolve_lifetime::Region.
These Region values end up in crate metadata so they should not use NodeId.
2017-09-18 11:17:02 +02:00
bors
3a7b960731 Auto merge of #44441 - tamird:cargo-bitflags, r=alexcrichton
Remove rustc_bitflags; use the bitflags crate

r? @alexcrichton
2017-09-18 07:00:28 +00:00
Will Speak
ebd0e4f199 Add Example of IntoIterator as Trait Bound to Docs
Part of #44600.
2017-09-18 07:41:38 +01:00
bors
caad2560bf Auto merge of #43628 - oli-obk:orbital_standard_library, r=alexcrichton
Run the miri test suite on the aux builder and travis

Reopen of #38350

see https://github.com/rust-lang/rust/pull/43340#issuecomment-316940762 for earlier discussion

Rationale for running miri's test suite in rustc's CI is that miri currently contains many features that we want in const eval in the future, and these features would break if the test suite is not run.

fixes #44077

r? @nikomatsakis

cc @eddyb
2017-09-18 01:50:29 +00:00
bors
e8a76d8acc Auto merge of #44529 - alexcrichton:trans-query, r=michaelwoerister
Refactor translation unit partitioning/collection as a query

This commit is targeted at #44486 with the ultimate goal of making the `collect_and_partition_translation_items` function a query. This mostly just involved query-ifying a few other systems along with plumbing the tcx instead of `SharedCrateContext` in a few locations.

Currently this only tackles the first bullet of #44486 and doesn't add a dedicated query for a particular codegen unit. I wasn't quite sure how to do that yet but figured this was good to put up.

Closes #44486
2017-09-17 22:05:31 +00:00
Guillaume Gomez
e47279f512 Add more links and put the link character to the left 2017-09-17 22:11:37 +02:00
Oliver Schneider
01555b1da1
Rebase fallout 2017-09-17 21:45:54 +02:00
Oliver Schneider
a9df19b42f
Update miri submodule 2017-09-17 21:42:35 +02:00
Oliver Schneider
68fc65eaf2
Prevent distribution if miri is enabled 2017-09-17 21:41:45 +02:00
Oliver Schneider
13921dafbf
-Zmir-emit-validate is in stage 0 2017-09-17 21:41:45 +02:00
Oliver Schneider
ab018c76e1
Add a file to trivially disable tool building or testing 2017-09-17 21:41:45 +02:00
Oliver Schneider
f0b5402283
Improve documentation 2017-09-17 21:40:13 +02:00
Oliver Schneider
f381744d91
Get the miri test suite to run inside the rustc dev environment 2017-09-17 21:40:13 +02:00
Oliver Schneider
2787a285bd
Add <*const T>::align_offset and use it in memchr 2017-09-17 21:30:58 +02:00
Tamir Duberstein
231d9e7e5d
Remove rustc_bitflags; use the bitflags crate 2017-09-17 14:19:24 -04:00
Alex Crichton
6d614ddc2e rustc: Move codegen to a query
This commit moves the actual code generation in the compiler behind a query
keyed by a codegen unit's name. This ended up entailing quite a few internal
refactorings to enable this, along with a few cut corners:

* The `OutputFilenames` structure is now tracked in the `TyCtxt` as it affects a
  whole bunch of trans and such. This is now behind a query and threaded into
  the construction of the `TyCtxt`.

* The `TyCtxt` now has a channel "out the back" intended to send data to worker
  threads in rustc_trans. This is used as a sort of side effect of the codegen
  query but morally what's happening here is the return value of the query
  (currently unit but morally a path) is only valid once the background threads
  have all finished.

* Dispatching work items to the codegen threads was refactored to only rely on
  data in `TyCtxt`, which mostly just involved refactoring where data was
  stored, moving it from the translation thread to the controller thread's
  `CodegenContext` or the like.

* A new thread locals was introduced in trans to work around the query
  system. This is used in the implementation of `assert_module_sources` which
  looks like an artifact of the old query system and will presumably go away
  once red/green is up and running.
2017-09-17 10:25:50 -07:00
Tamir Duberstein
e788fa7b6c
bootstrap: plumb verbosity into submodule ops
Fix some lints while I'm here.
2017-09-17 13:15:06 -04:00
bors
cfcac37204 Auto merge of #44607 - alexcrichton:rustbuild-no-j, r=Mark-Simulacrum
rustbuild: Don't pass `-j` if called by `make`

In these situations Cargo just prints out a warning about ignoring the flag
anyway, so let `make` take care of jobs and whatnot instead of getting warnings
printed.
2017-09-17 17:15:01 +00:00
Tamir Duberstein
4a8933f4a7
Use double quotes to appease some TOML parsers 2017-09-17 13:14:37 -04:00
Alex Crichton
3021c1d0bf rustc: Attach an mpsc channel to TyCtxt
This commit attaches a channel to the LLVM workers to the `TyCtxt` which will
later be used during the codegen query to actually send work to LLVM workers.
Otherwise this commit is just plumbing this channel throughout the compiler to
ensure it reaches the right consumers.
2017-09-17 09:41:44 -07:00
Alex Crichton
2eada58706 rustc: Remove another global map from trans
This commit removes the `crate_trans_items` field from the `CrateContext` of
trans. This field, a big map, was calculated during partioning and was a set of
all translation items. This isn't quite incremental-friendly because the map may
change a lot but not have much effect on downstream consumers.

Instead a new query was added for the one location this map was needed, along
with a new comment explaining what the location is doing!
2017-09-17 09:41:43 -07:00
Alex Crichton
19727c84dd rustc: Move a comment to the right spot in trans
I believe this comment here is mostly talking about the `ptrcast` function call
below, so move the comment down to that block.
2017-09-17 09:41:43 -07:00
Alex Crichton
afb85cfd33 rustc: Mostly remove ExportedSymbols
This is a big map that ends up inside of a `CrateContext` during translation for
all codegen units. This means that any change to the map may end up causing an
incremental recompilation of a codegen unit! In order to reduce the amount of
dependencies here between codegen units and the actual input crate this commit
refactors dealing with exported symbols and such into various queries.

The new queries are largely based on existing queries with filled out
implementations for the local crate in addition to external crates, but the main
idea is that while translating codegen untis no unit needs the entire set of
exported symbols, instead they only need queries about particulare `DefId`
instances every now and then.

The linking stage, however, still generates a full list of all exported symbols
from all crates, but that's going to always happen unconditionally anyway, so no
news there!
2017-09-17 09:41:43 -07:00
Alex Crichton
8821affd15 rustc: Move some attr methods to queries
Otherwise we may emit double errors related to the `#[export_name]` attribute,
for example, and using a query should ensure that it's only emitted at most
once.
2017-09-17 09:41:43 -07:00
Alex Crichton
132bde7cf1 rustc: Make trans collect/partition a query
This commit moves the `collect_and_partition_translation_items` function into a
query on `TyCtxt` instead of a free function in trans, allowing us to track
dependencies and such of the function.
2017-09-17 09:41:43 -07:00
Alex Crichton
dba3ddd8d4 rustc: Calculate ExportedSymbols in a query
This commit moves the definition of the `ExportedSymbols` structure to the
`rustc` crate and then creates a query that'll be used to construct the
`ExportedSymbols` set. This in turn uses the reachablity query exposed in the
previous commit.
2017-09-17 09:41:43 -07:00
Alex Crichton
baca9a6240 rustc: Use reachablility through a query
Turns out this was already set up as a query, just wasn't using it yet!
2017-09-17 09:41:43 -07:00
Alex Crichton
a97ad6ae50 rustc: Refactor trans paritioning to use tcx
This commit refactors the the `partitioning::partition` function to operate with
a `TyCtxt` instead of a `SharedCrateContext` in preparation for making it a
query.
2017-09-17 09:41:43 -07:00