Commit Graph

111 Commits

Author SHA1 Message Date
Michael Woerister
8b36d3308e Allocate DefIndices for global crate metadata.
This allows for treating global crate metadata the same as regular metadata with regard to incr. comp.
2017-06-07 12:11:40 +02:00
Michael Woerister
f854f8b366 Build DefPathHash->DefId table when incr.comp. is enabled 2017-05-31 14:53:39 +02:00
Michael Woerister
59ebe8e115 Make a newtype for DefPathHash so they are not confused with content hashes 2017-05-31 13:54:38 +02:00
Ariel Ben-Yehuda
55767702ec fix RUST_LOG ICE caused by printing a default impl's DefId 2017-05-28 10:43:25 +03:00
Jeffrey Seyfried
1f175fa35d Hygienize librustc_resolve. 2017-05-25 05:51:50 +00:00
Jeffrey Seyfried
2a1d2edb82 Declarative macros 2.0 without hygiene. 2017-05-25 05:51:06 +00:00
Jeffrey Seyfried
9c6430b325 Refactor out ast::MacroDef. 2017-05-25 05:47:25 +00:00
Michael Woerister
4549423f28 Use 128 instead of 64 bits for DefPath hashes 2017-05-18 11:10:11 +02:00
bors
4640e18572 Auto merge of #41911 - michaelwoerister:querify_trait_def, r=nikomatsakis
Remove interior mutability from TraitDef by turning fields into queries

This PR gets rid of anything `std::cell` in `TraitDef` by
- moving the global list of trait impls from `TraitDef` into a query,
- moving the list of trait impls relevent for some self-type from `TraitDef` into a query
- moving the specialization graph of trait impls into a query, and
- moving `TraitDef::object_safety` into a query.

I really like how querifying things not only helps with incremental compilation and on-demand, but also just plain makes the code cleaner `:)`

There are also some smaller fixes in the PR. Commits can be reviewed separately.

r? @eddyb or @nikomatsakis
2017-05-17 21:44:08 +00:00
Michael Woerister
c2d9b4e334 ICH: Hash lists of local trait impls as part of the HIR. 2017-05-15 15:27:49 +02:00
Robin Kruppe
1a24a591dd Remove rustc_llvm dependency from rustc_metadata
Move the code for loading metadata from rlibs and dylibs from
rustc_metadata into rustc_trans, and introduce a trait to avoid
introducing a direct dependency on rustc_trans.

This means rustc_metadata is no longer rebuilt when LLVM changes.
2017-05-14 20:30:22 +02:00
bors
4f3886abf1 Auto merge of #41847 - alexcrichton:less-unstable-annotations, r=eddyb
rustc: Add a new `-Z force-unstable-if-unmarked` flag

This commit adds a new `-Z` flag to the compiler for use when bootstrapping the
compiler itself. We want to be able to use crates.io crates, but we also want
the usage of such crates to be as ergonomic as possible! To that end compiler
crates are a little tricky in that the crates.io crates are not annotated as
unstable, nor do they expect to pull in unstable dependencies.

To cover all these situations it's intended that the compiler will forever now
bootstrap with `-Z force-unstable-if-unmarked`. This flags serves a dual purpose
of forcing crates.io crates to themselves be unstable while also allowing them
to use other "unstable" crates.io crates. This should mean that adding a
dependency to compiler no longer requires upstream modification with
unstable/staged_api attributes for inclusion!
2017-05-13 05:22:08 +00:00
Alex Crichton
99f629a931 rustc: Add a new -Z force-unstable-if-unmarked flag
This commit adds a new `-Z` flag to the compiler for use when bootstrapping the
compiler itself. We want to be able to use crates.io crates, but we also want
the usage of such crates to be as ergonomic as possible! To that end compiler
crates are a little tricky in that the crates.io crates are not annotated as
unstable, nor do they expect to pull in unstable dependencies.

To cover all these situations it's intended that the compiler will forever now
bootstrap with `-Z force-unstable-if-unmarked`. This flags serves a dual purpose
of forcing crates.io crates to themselves be unstable while also allowing them
to use other "unstable" crates.io crates. This should mean that adding a
dependency to compiler no longer requires upstream modification with
unstable/staged_api attributes for inclusion!
2017-05-10 07:42:26 -07:00
achernyak
35812d1746 resolved merge conflicts 2017-05-09 17:23:41 -05:00
Michael Woerister
6a5e2a5a9e incr.comp.: Hash more pieces of crate metadata to detect changes there. 2017-05-08 12:31:26 +02:00
achernyak
1f532bfed5 is_exported_symbol 2017-05-07 21:05:31 -05:00
achernyak
5a7946df70 is_foreign_item 2017-05-05 08:15:08 -05:00
achernyak
5b71d769ff moved metadata provider impls to decoder 2017-05-04 12:45:56 -05:00
achernyak
03fe10d91d impl_parent 2017-05-04 09:37:34 -05:00
achernyak
aa5a532046 trait_of_item 2017-05-04 08:27:48 -05:00
achernyak
c72a16b8e2 fn_arg_names 2017-05-03 09:01:49 -05:00
achernyak
a12a55f519 item_attrs 2017-05-03 08:40:32 -05:00
Corey Farwell
02274a8430 Rollup merge of #41653 - achernyak:master, r=nikomatsakis
Queries for Crate Metadata

This resolves following parts of #41417:
* `fn stability(&self, def: DefId) -> Option<attr::Stability>;`
* `fn deprecation(&self, def: DefId) -> Option<attr::Deprecation>;`

r? @nikomatsakis
2017-05-02 21:21:20 -04:00
Niko Matsakis
393fa4f1b7 rename from item_mir to optimized_mir 2017-05-02 16:21:57 -04:00
Niko Matsakis
29263fdb54 introduce idea of "stealable" MIR
This is a more principled version of the `RefCell` we were using
before. We now allocate a `Steal<Mir<'tcx>>` for each intermediate MIR
pass; when the next pass steals the entry, any later attempts to use it
will panic (there is no way to *test* if MIR is stolen, you're just
supposed to *know*).
2017-05-02 14:01:34 -04:00
Niko Matsakis
2b32cb90c7 retool MIR passes completely
The new setup is as follows. There is a pipeline of MIR passes that each
run **per def-id** to optimize a particular function. You are intended
to request MIR at whatever stage you need it. At the moment, there is
only one stage you can request:

- `optimized_mir(def_id)`

This yields the final product. Internally, it pulls the MIR for the
given def-id through a series of steps. Right now, these are still using
an "interned ref-cell" but they are intended to "steal" from one
another:

- `mir_build` -- performs the initial construction for local MIR
- `mir_pass_set` -- performs a suite of optimizations and transformations
- `mir_pass` -- an individual optimization within a suite

So, to construct the optimized MIR, we invoke:

    mir_pass_set((MIR_OPTIMIZED, def_id))

which will build up the final MIR.
2017-05-02 14:01:01 -04:00
achernyak
c1d97c7d5a query for deprecation 2017-05-02 06:53:34 -05:00
Taylor Cramer
daa0094eb7 Queryify is_item_mir_available 2017-05-01 10:24:10 -07:00
Taylor Cramer
fb4380b12d Queryify const_is_rvalue_promotable_to_static 2017-05-01 10:24:10 -07:00
Taylor Cramer
05b2081e23 Queryify item_body_nested_bodies 2017-05-01 10:24:04 -07:00
Artem Chernyak
2f73b173cb Merge branch 'master' into def_span 2017-04-28 22:44:34 -05:00
achernyak
932d251698 query for def_span 2017-04-28 10:59:57 -05:00
bors
2971d491b9 Auto merge of #41508 - michaelwoerister:generic-path-remapping, r=alexcrichton
Implement a file-path remapping feature in support of debuginfo and reproducible builds

This PR adds the `-Zremap-path-prefix-from`/`-Zremap-path-prefix-to` commandline option pair and is a more general implementation of #41419. As opposed to the previous attempt, this implementation should enable reproducible builds regardless of the working directory of the compiler.

This implementation of the feature is more general in the sense that the re-mapping will affect *all* paths the compiler emits, including the ones in error messages.

r? @alexcrichton
2017-04-28 12:09:37 +00:00
achernyak
e24003fb3c query for describe_def 2017-04-27 13:27:16 -05:00
bors
54ef80043a Auto merge of #37860 - giannicic:defaultimpl, r=nagisa
#37653 support `default impl` for specialization

this commit implements the first step of the `default impl` feature:

> all items in a `default impl` are (implicitly) `default` and hence
> specializable.

In order to test this feature I've copied all the tests provided for the
`default` method implementation (in run-pass/specialization and
compile-fail/specialization directories) and moved the `default` keyword
from the item to the impl.
See [referenced](https://github.com/rust-lang/rust/issues/37653) issue for further info

r? @aturon
2017-04-27 02:48:17 +00:00
Michael Woerister
39ffea31df Implement a file-path remapping feature in support of debuginfo and reproducible builds. 2017-04-26 15:44:02 +02:00
Gianni Ciccarelli
715811d0be support default impl for specialization
pr review
2017-04-25 05:28:22 +00:00
Eduard-Mihai Burtescu
612bb1f54e rustc: rename some of the queries to match tcx methods. 2017-04-24 15:20:52 +03:00
Gianni Ciccarelli
116e9831a5 support default impl for specialization
this commit implements the first step of the `default impl` feature:
all items in a `default impl` are (implicitly) `default` and hence
specializable.
In order to test this feature I've copied all the tests provided for the
`default` method implementation (in run-pass/specialization and
compile-fail/specialization directories) and moved the `default` keyword
from the item to the impl.
See referenced issue for further info
2017-04-24 10:08:48 +00:00
Eduard-Mihai Burtescu
e22873d912 rustc: make the const-eval cache polymorphic. 2017-04-23 11:11:54 +03:00
Ariel Ben-Yehuda
a0f145ba8c add a cache to impl_polarity
this is another one of these things that looks *much* worse on valgrind.
2017-04-22 21:02:41 +03:00
Ariel Ben-Yehuda
ece6c8434b cache attributes of items from foreign crates
this avoids parsing item attributes on each call to `item_attrs`, which takes
off 33% (!) of translation time and 50% (!) of trans-item collection time.
2017-04-22 21:00:50 +03:00
Niko Matsakis
8289e5a73e introduce is_foreign_item query
This may seem like overkill, but it's exactly what we want/need for
incremental compilation I think. In particular, while generating code
for some codegen unit X, we can wind up querying about any number of
external items, and we only want to be forced to rebuild X is some of
those changed from a foreign item to otherwise. Factoring this into a
query means we would re-run only if some `false` became `true` (or vice
versa).
2017-04-21 17:26:53 -04:00
Michael Woerister
ca2dce9b48 ICH: Replace old, transitive metadata hashing with direct hashing approach.
Instead of collecting all potential inputs to some metadata entry and
hashing those, we directly hash the values we are storing in metadata.
This is more accurate and doesn't suffer from quadratic blow-up when
many entries have the same dependencies.
2017-04-12 11:47:26 +02:00
Corey Farwell
996f06fe35 Rollup merge of #41061 - arielb1:parent-lock, r=eddyb
cstore: return an immutable borrow from `visible_parent_map`

This prevents an ICE when `visible_parent_map` is called multiple times, for example when an item referenced in an impl signature is imported from an  `extern crate` statement occurs within an impl.

Fixes #41053.

r? @eddyb
2017-04-07 09:20:06 -04:00
Michael Woerister
edc1ac3016 ICH: Centrally compute and cache DefPath hashes as part of DefPathTable. 2017-04-07 14:36:51 +02:00
Ariel Ben-Yehuda
60381cd9c2 cstore: return an immutable borrow from visible_parent_map
Fixes #41053.
2017-04-04 18:11:03 +03:00
Jeffrey Seyfried
f08d5ad4c5 Refactor how spans are combined in the parser. 2017-03-29 11:17:59 +00:00
Alex Crichton
12f6c5019a Rollup merge of #40683 - nikomatsakis:incr-comp-coerce-unsized-info, r=eddyb
on-demand-ify `custom_coerce_unsized_kind` and `inherent-impls`

This "on-demand" task both checks for errors and computes the custom unsized kind, if any. This task is only defined on impls of `CoerceUnsized`; invoking it on any other kind of impl results in a bug. This is just to avoid having an `Option`, could easily be changed.

r? @eddyb
2017-03-27 15:56:23 -07:00
Niko Matsakis
a3a5ff98eb move export_map into the tcx 2017-03-23 14:18:25 -04:00