about summary refs log tree commit diff
path: root/src/librustc_metadata
AgeCommit message (Collapse)AuthorLines
2017-04-24rustc: rename some of the queries to match tcx methods.Eduard-Mihai Burtescu-25/+25
2017-04-24support `default impl` for specializationGianni Ciccarelli-1/+9
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-23rustc: make the const-eval cache polymorphic.Eduard-Mihai Burtescu-18/+16
2017-04-22add a cache to impl_polarityAriel Ben-Yehuda-6/+1
this is another one of these things that looks *much* worse on valgrind.
2017-04-22cache attributes of items from foreign cratesAriel Ben-Yehuda-7/+24
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-21introduce `is_foreign_item` queryNiko Matsakis-0/+1
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-16rustc: use monomorphic const_eval for cross-crate enum discriminants.Eduard-Mihai Burtescu-36/+47
2017-04-16rustc_const_eval: move ConstEvalErr to the rustc crate.Eduard-Mihai Burtescu-1/+2
2017-04-14Rollup merge of #40702 - mrhota:global_asm, r=nagisaCorey Farwell-0/+5
Implement global_asm!() (RFC 1548) This is a first attempt. ~~One (potential) problem I haven't solved is how to handle multiple usages of `global_asm!` in a module/crate. It looks like `LLVMSetModuleInlineAsm` overwrites module asm, and `LLVMAppendModuleInlineAsm` is not provided in LLVM C headers 😦~~ I can provide more detail as needed, but honestly, there's not a lot going on here. r? @eddyb CC @Amanieu @jackpot51 Tracking issue: #35119
2017-04-13remove `LinkMeta` from `SharedCrateContext`Niko Matsakis-3/+3
A number of things were using `crate_hash` that really ought to be using `crate_disambiguator` (e.g., to create the plugin symbol names). They have been updated. It is important to remove `LinkMeta` from `SharedCrateContext` since it contains a hash of the entire crate, and hence it will change whenever **anything** changes (which would then require rebuilding **everything**).
2017-04-13use `tcx.crate_name(LOCAL_CRATE)` rather than `LinkMeta::crate_name`Niko Matsakis-2/+2
2017-04-13Make simple_global_asm even simplerA.J. Gardner-0/+1
Windows builder croaked. This change tries to fix that by actually calling the global_asm-defined function so the symbol doesn't get optimized away, if that is in fact what was happening. Additionally, we provide an empty main() for non-x86 arches.
2017-04-12First attempt at global_asm! macroA.J. Gardner-0/+4
2017-04-12ICH: Replace old, transitive metadata hashing with direct hashing approach.Michael Woerister-35/+204
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-12ICH: Hash everything that gets encoded into crate metadata.Michael Woerister-52/+186
2017-04-07Rollup merge of #41061 - arielb1:parent-lock, r=eddybCorey Farwell-4/+12
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-07ICH: Centrally compute and cache DefPath hashes as part of DefPathTable.Michael Woerister-6/+13
2017-04-04cstore: return an immutable borrow from `visible_parent_map`Ariel Ben-Yehuda-4/+12
Fixes #41053.
2017-03-30Auto merge of #40524 - alexcrichton:update-bootstrap, r=alexcrichtonbors-1/+0
rustbuild: Update bootstrap compiler Now that we've also updated cargo's release process this commit also changes the download location of Cargo from Cargos archives back to the static.r-l.o archives. This should ensure that the Cargo download is the exact Cargo paired with the rustc that we release.
2017-03-29rustbuild: Update bootstrap compilerAlex Crichton-1/+0
Now that we've also updated cargo's release process this commit also changes the download location of Cargo from Cargos archives back to the static.r-l.o archives. This should ensure that the Cargo download is the exact Cargo paired with the rustc that we release.
2017-03-29Refactor how spans are combined in the parser.Jeffrey Seyfried-5/+5
2017-03-27Rollup merge of #40683 - nikomatsakis:incr-comp-coerce-unsized-info, r=eddybAlex Crichton-19/+24
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-27Fix various useless derefs and slicingsOliver Schneider-6/+6
2017-03-26Auto merge of #40826 - frewsxcv:rollup, r=frewsxcvbors-8/+4
Rollup of 7 pull requests - Successful merges: #40642, #40734, #40740, #40771, #40807, #40820, #40821 - Failed merges:
2017-03-23Remove internal liblogAlex Crichton-2/+2
This commit deletes the internal liblog in favor of the implementation that lives on crates.io. Similarly it's also setting a convention for adding crates to the compiler. The main restriction right now is that we want compiler implementation details to be unreachable from normal Rust code (e.g. requires a feature), and by default everything in the sysroot is reachable via `extern crate`. The proposal here is to require that crates pulled in have these lines in their `src/lib.rs`: #![cfg_attr(rustbuild, feature(staged_api, rustc_private))] #![cfg_attr(rustbuild, unstable(feature = "rustc_private", issue = "27812"))] This'll mean that by default they're not using these attributes but when compiled as part of the compiler they do a few things: * Mark themselves as entirely unstable via the `staged_api` feature and the `#![unstable]` attribute. * Allow usage of other unstable crates via `feature(rustc_private)` which is required if the crate relies on any other crates to compile (other than std).
2017-03-23move `export_map` into the tcxNiko Matsakis-8/+4
2017-03-23convert inherent-impl-related things to on-demand queriesNiko Matsakis-6/+1
There are now 3 queries: - inherent_impls(def-id): for a given type, get a `Rc<Vec<DefId>>` with all its inherent impls. This internally uses `crate_inherent_impls`, doing some hacks to keep the current deps (which, btw, are not clearly correct). - crate_inherent_impls(crate): gathers up a map from types to `Rc<Vec<DefId>>`, touching the entire krate, possibly generating errors. - crate_inherent_impls_overlap_check(crate): performs overlap checks between the inherent impls for a given type, generating errors.
2017-03-23convert `custom_coerce_unsized_kind` into a `coerce_unsized_info`Niko Matsakis-13/+23
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.
2017-03-22Rollup merge of #40696 - cramertj:remove-unused-adt-def-code, r=petrochenkovCorey Farwell-10/+2
Remove unused adt-def insertion by constructor DefIndex It looks to me like ADT definitions weren't being looked up by constructor id, and a test run supports my theory. In any case, I'm not sure it would have worked in its current configuration. If I understand correctly, the `adt_def` map entry from constructor id -> adt def would only be present after a successful call to `queries::adt_def::get` with the proper ADT `DefIndex`. Trying to look up an adt_def by the constructor index prior to a successful lookup by ADT index would fail since `item.kind` would be `EntryKind::Fn` (for the constructor function) and so would trigger the `bug!`. r? @nikomatsakis
2017-03-22Rollup merge of #40542 - abonander:issue_40535, r=jseyfriedCorey Farwell-1/+2
Correctly get source for metatdata-only crate type Closes #40535 However, I'm not sure how to approach writing a regression test since I'm still working on a reduced test case from the code that caused the ICE in the first place. It's not enough to have an unknown `extern crate` in a metadata crate, it depends on a few extra arguments but I'm not sure which yet. Also replaced the `unwrap()` with a more informative `expect()`. r? @jseyfried
2017-03-22Rollup merge of #40518 - michaelwoerister:hir-id, r=eddybCorey Farwell-18/+51
Introduce HirId, a replacement for ast::NodeId after lowering to HIR This is the first step towards implementing #40303. This PR introduces the `HirId` type and generates a `HirId` for everything that would be assigned one (i.e. stuff in the HIR), but the HIR data types still use `NodeId` for now. Changing that is a big refactoring that I want to do in a separate PR. A `HirId` uniquely identifies a node in the HIR of the current crate. It is composed of the `owner`, which is the `DefIndex` of the directly enclosing `hir::Item`, `hir::TraitItem`, or `hir::ImplItem` (i.e. the closest "item-like"), and the `local_id` which is unique within the given owner. This PR is also running a number of consistency checks for the generated `HirId`s: - Does `NodeId` in the HIR have a corresponding `HirId`? - Is the `owner` part of each `HirId` consistent with its position in the HIR? - Do the numerical values of the `local_id` part all lie within a dense range of integers? cc @rust-lang/compiler r? @eddyb or @nikomatsakis
2017-03-22Allocate numerical values of DefIndexes from two seperate ranges.Michael Woerister-18/+51
This way we can have all item-likes occupy a dense range of DefIndexes, which is good for making fast, array-based dictionaries.
2017-03-21Correctly get source for metadata crate type;Austin Bonander-1/+2
replace `unwrap()` with `expect()`
2017-03-21Remove unused adt-def insertion by constructor DefIndexTaylor Cramer-10/+2
2017-03-21Check for conflicts between macros 1.0 exports (`#[macro_export]`, ↵Jeffrey Seyfried-13/+6
`#[macro_reexport]`) and macros 2.0 exports (`pub use` macro re-exports and `pub macro` (once implemented) at the crate root.
2017-03-20Auto merge of #39628 - arielb1:shimmir, r=eddybbors-2/+2
Translate shims using MIR This removes one large remaining part of old trans.
2017-03-19Auto merge of #40346 - jseyfried:path_and_tokenstream_attr, r=nrcbors-6/+11
`TokenStream`-based attributes, paths in attribute and derive macro invocations This PR - refactors `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`. - supports macro invocation paths for attribute procedural macros. - e.g. `#[::foo::attr_macro] struct S;`, `#[cfg_attr(all(), foo::attr_macro)] struct S;` - supports macro invocation paths for derive procedural macros. - e.g. `#[derive(foo::Bar, super::Baz)] struct S;` - supports arbitrary tokens as arguments to attribute procedural macros. - e.g. `#[foo::attr_macro arbitrary + tokens] struct S;` - supports using arbitrary tokens in "inert attributes" with derive procedural macros. - e.g. `#[derive(Foo)] struct S(#[inert arbitrary + tokens] i32);` where `#[proc_macro_derive(Foo, attributes(inert))]` r? @nrc
2017-03-18translate tuple-variant constructors using MIRAriel Ben-Yehuda-2/+2
2017-03-14Refactor `Attribute` to use `Path` and `TokenStream` instead of `MetaItem`.Jeffrey Seyfried-6/+11
2017-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-3/+3
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2017-03-10Avoid using `Mark` and `Invocation` for macro defs.Jeffrey Seyfried-2/+1
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-2/+4
2017-03-09rustc: Prefer loading crates in the sysrootAlex Crichton-0/+28
This commit is a random stab in the dark to fix the spurious failures on #39518. The leading theory of the spurious failures on Windows is that the compiler is loading a path in the `deps` folder, passing it to `link.exe`, and then this is racing with Cargo itself updating those paths. This race, however, has a few unique properties: * It's isolated to just libstd. Most crates are never passed to the linker and simultaneously being worked on by Cargo. Cargo's typical execution of the dependency graph never hits this problem. * The crates are already all located in the sysroot in addition to the `deps` folder. This means that the compiler actually has two candidates of crates to load, and it's just arbitrarily rejecting one. Together this means that we shouldn't need to fix this problem "in the large" and we can instead just fix it in this isolated situation (hopefully). To solve this the compiler's been updated to prefer crates from the sysroot to leave Cargo's structure to itself. We'll see if this actually allows the PR to land...
2017-03-04Auto merge of #40202 - jseyfried:integrate_tokenstream, r=nrcbors-4/+5
syntax: integrate `TokenStream` Use `TokenStream` instead of `Vec<TokenTree>` in `TokenTree::Delimited` and elsewhere. r? @nrc
2017-03-03Auto merge of #40178 - arielb1:provide-destructors, r=eddybbors-0/+4
convert AdtDef::destructor to on-demand This removes the `Cell` from `AdtDef`. Also, moving destructor validity checking to on-demand (forced during item-type checking) ensures that invalid destructors can't cause ICEs. Fixes #38868. Fixes #40132. r? @eddyb
2017-03-03Integrate `TokenStream`.Jeffrey Seyfried-4/+5
2017-03-02Rollup merge of #40129 - abonander:proc_macro_bang, r=jseyfriedCorey Farwell-1/+10
Implement function-like procedural macros ( `#[proc_macro]`) Adds the `#[proc_macro]` attribute, which expects bare functions of the kind `fn(TokenStream) -> TokenStream`, which can be invoked like `my_macro!()`. cc rust-lang/rfcs#1913, #38356 r? @jseyfried cc @nrc
2017-03-01convert AdtDef::destructor to on-demandAriel Ben-Yehuda-0/+4
This removes the Cell from AdtDef. Also, moving destructor validity checking to on-demand (forced during item-type checking) ensures that invalid destructors can't cause ICEs. Fixes #38868. Fixes #40132.
2017-02-28Implement function-like procedural macros ( `#[proc_macro]`)Austin Bonander-1/+10
2017-02-25rustc_const_eval: demand that the MIR qualify_consts ran on each evaluated body.Eduard-Mihai Burtescu-8/+27