summary refs log tree commit diff
path: root/compiler/rustc_metadata/src
AgeCommit message (Collapse)AuthorLines
2021-07-18Auto merge of #86698 - cjgillot:modc, r=estebankbors-1/+4
Move OnDiskCache to rustc_query_impl. This should be the last remnant of the query implementation that was still in rustc_middle.
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-1/+4
2021-07-18Rollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, ↵Yuki Okushi-1/+1
r=petrochenkov Remove nondeterminism in multiple-definitions test Compare all fields in `DllImport` when sorting to avoid nondeterminism in the error for multiple inconsistent definitions of an extern function. Restore the multiple-definitions test. Resolves #87084.
2021-07-17Drop ExpnData::krate.Camille GILLOT-1/+1
2021-07-17Drop orig_id.Camille GILLOT-1/+1
2021-07-17Encode ExpnId using ExpnHash for incr. comp.Camille GILLOT-18/+43
2021-07-17Choose encoding format in caller code.Camille GILLOT-3/+16
2021-07-17Make the CrateNum part of the ExpnId.Camille GILLOT-8/+40
2021-07-16Consider all fields when comparing DllImports, to remove nondetermininsm in ↵Richard Cobbe-1/+1
multiple-definitions test
2021-07-15Simplify metadata decoding.Camille GILLOT-14/+4
2021-07-15Separate encoding paths.Camille GILLOT-35/+25
The two paths will be modified independently in the next few commits.
2021-07-15Auto merge of #86876 - jyn514:56935-target-crate-num, r=petrochenkovbors-1/+5
Reuse CrateNum for proc-macro crates even when cross-compiling Proc-macros are always compiled for the host, so this should be the same in every way as recompiling the crate. I am not sure why the previous code special-cased the target, since the compiler properly gives an error when trying to load a crate for a different host: ``` error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2 | LL | dependency::is_64(); | ^^^^^^^^^^ | = note: the following crate versions were found: crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so ``` I think another possible fix is to remove the check altogether. But I'm not sure, and this fix works, so I'm not making the larger change here. Fixes https://github.com/rust-lang/rust/issues/56935. r? `@petrochenkov` cc `@alexcrichton`
2021-07-14Reuse CrateNum for proc-macro crates even when cross-compilingJoshua Nelson-1/+5
Proc-macros are always compiled for the host, so this should be the same in every way as recompiling the crate. I am not sure why the previous code special-cased the target, since the compiler properly gives an error when trying to load a crate for a different host: ``` error[E0461]: couldn't find crate `dependency` with expected target triple x86_64-unknown-linux-gnu --> /home/joshua/rustc4/src/test/ui/cfg-dependent.rs:8:2 | LL | dependency::is_64(); | ^^^^^^^^^^ | = note: the following crate versions were found: crate `dependency`, target triple i686-unknown-linux-gnu: /home/joshua/rustc4/build/x86_64-unknown-linux-gnu/test/ui/cfg-dependent/auxiliary/libdependency.so ``` I think another possible fix is to remove the check altogether. But I'm not sure, and this fix works, so I'm not making the larger change here.
2021-07-14Shrink the CrateStore dynamic interface.Camille GILLOT-22/+15
2021-07-13Auto merge of #87044 - cjgillot:expnhash, r=petrochenkovbors-9/+25
Cache expansion hash globally ... instead of computing it multiple times. Split from #86676 r? `@petrochenkov`
2021-07-13Cache expansion hash.Camille GILLOT-9/+25
2021-07-13Auto merge of #86857 - fee1-dead:add-attr, r=oli-obkbors-3/+14
Add #[default_method_body_is_const] `@rustbot` label F-const_trait_impl
2021-07-11Auto merge of #85941 - cjgillot:qresolve, r=Aaron1011bors-3/+9
Reduce the amount of untracked state in TyCtxt -- Take 2 Main part of #85153 The offending line (https://github.com/rust-lang/rust/pull/85153#discussion_r642866298) is replaced by a FIXME until the possible bug and the perf concern are both resolved. r? `@Aaron1011`
2021-07-10rustc_expand: Remove redundant field from proc macro expander structuresVadim Petrochenkov-19/+12
This information is already available from `ExpnData`
2021-07-10Add impl_constness queryDeadbeef-3/+14
2021-07-09Add support for raw-dylib with stdcall, fastcall functions on ↵Richard Cobbe-15/+57
i686-pc-windows-msvc.
2021-07-06Correct comments about untracked accesses.Camille GILLOT-3/+3
2021-07-06Make resolutions a query.Camille GILLOT-0/+6
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-29/+16
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-05Remove LibSourcebjorn3-3/+13
The information is stored in used_crate_source too anyway
2021-07-01Auto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkovbors-7/+7
Rename all_crate_nums query to crates and remove useless wrapper Split out of https://github.com/rust-lang/rust/pull/86105 r? `@petrochenkov`
2021-07-01Rename all_crate_nums query to crates and remove useless wrapperbjorn3-7/+7
2021-06-30use is_const_fn_raw when encoding constnessDeadbeef-1/+6
this properly encodes cross-crate constness data.
2021-06-28Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011bors-5/+1
Make allocator_kind a query. Part of #85153 r? `@Aaron1011`
2021-06-24Use `#[non_exhaustive]` where appropriateJacob Pratt-4/+3
Due to the std/alloc split, it is not possible to make `alloc::collections::TryReserveError::AllocError` non-exhaustive without having an unstable, doc-hidden method to construct (which negates the benefits from `#[non_exhaustive]`.
2021-06-21Print more crate details in -ZlsJeremy Fitzhardinge-2/+15
Useful for debugging crate hash and resolution issues.
2021-06-20Implement the query in cstore_impl.Camille GILLOT-5/+1
2021-06-18Auto merge of #85284 - eggyal:custom-profiler-runtime, r=jackh726bors-19/+25
Provide option for specifying the profiler runtime Currently, if `-Zinstrument-coverage` is enabled, the target is linked against the `library/profiler_builtins` crate (which pulls in LLVM's compiler-rt runtime). This option enables backends to specify an alternative runtime crate for handling injected instrumentation calls.
2021-06-17Early return from `inject_profiler_runtime`Alan Egerton-23/+23
2021-06-17Auto merge of #85834 - cjgillot:save-sbi, r=michaelwoeristerbors-4/+4
Encode CrateNum using the StableCrateId for incr. comp.
2021-06-11Auto merge of #85885 - bjorn3:remove_box_region, r=cjgillotbors-3/+3
Don't use a generator for BoxedResolver The generator is non-trivial and requires unsafe code anyway. Using regular unsafe code without a generator is much easier to follow. Based on #85810 as it touches rustc_interface too.
2021-06-10Auto merge of #85910 - cjgillot:no-meta-version, r=Aaron1011bors-6/+4
Drop metadata_encoding_version. Part of #85153 r? `@Aaron1011`
2021-06-09Encode CrateNum using the StableCrateId for incr. comp.Camille GILLOT-4/+4
2021-06-08Store boxed metadata loader in CrateLoaderbjorn3-3/+3
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-16/+29
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-06Auto merge of #84171 - ricobbe:raw-dylib-via-llvm, r=petrochenkovbors-11/+61
Partial support for raw-dylib linkage First cut of functionality for issue #58713: add support for `#[link(kind = "raw-dylib")]` on `extern` blocks in lib crates compiled to .rlib files. Does not yet support `#[link_name]` attributes on functions, or the `#[link_ordinal]` attribute, or `#[link(kind = "raw-dylib")]` on `extern` blocks in bin crates; I intend to publish subsequent PRs to fill those gaps. It's also not yet clear whether this works for functions in `extern "stdcall"` blocks; I also intend to investigate that shortly and make any necessary changes as a follow-on PR. This implementation calls out to an LLVM function to construct the actual `.idata` sections as temporary `.lib` files on disk and then links those into the generated .rlib.
2021-06-05Auto merge of #86002 - cjgillot:expn_that_defined, r=petrochenkovbors-1/+1
Always go through the expn_that_defined query.
2021-06-04Add first cut of functionality for #58713: support for #[link(kind = ↵Richard Cobbe-11/+61
"raw-dylib")]. This does not yet support #[link_name] attributes on functions, the #[link_ordinal] attribute, #[link(kind = "raw-dylib")] on extern blocks in bin crates, or stdcall functions on 32-bit x86.
2021-06-04Always go through the expn_that_defined query.Camille GILLOT-1/+1
2021-06-04Rollup merge of #85889 - denismerigoux:master, r=petrochenkovYuki Okushi-0/+11
Restoring the `num_def_ids` function in the CStore API ## The context I am the maintainer of https://github.com/hacspec/hacspec, an embedded Rust DSL aimed at cryptographic specifications. As it is normal for an embedded DSL, Hacspec's compiler relies on being plugged to the internal API of the Rust compiler, which is unstable and subject to changes. ## The problem The Hacspec compiler features its own typechecker, that performs an additional, more restrictive typechecking pass over the Rust code of a crate. To complete this typechecking, the Hacspec compiler needs to retrieve the signature of functions defined in non-local imported crates. Rather than retrieving these signatures on-demand, the Hacspec compiler pre-populates its typechecking context with all the Hacspec-compatible symbols defined in non-local crates first. This requires having a way to iterate over all the definitions in a non-local crate. I used to do this with `CrateMetadata::all_def_path_hashes_and_def_ids`, but this function was deleted in 908bf5a310b7265a3e. Then, I fellback on `CStore::num_def_ids`, exploiting the fact that all the `DefIds` for a crate have the same `krate_num` and range from `0` to `num_def_ids(krate_num)`. But `num_def_ids` was deleted in b6120bfb354c1c1c9fdf. I looked to the `Cstore::item_children_untracked` function to replicate the feature of traversing through all the `DefId` for a crate, using `CRATE_DEF_INDEX` as the root, but this does not work as recursive `Cstore::item_children_untracked` calls do not reach all the symbols I was able to reach using the two previous methods. ## Description of this PR This PR simply restores in the public API of `CStore` the `num_def_ids` function, giving the size of the definition table for a given crate.
2021-06-04Rollup merge of #85850 - bjorn3:less_feature_gates, r=jyn514Yuki Okushi-2/+0
Remove unused feature gates The first commit removes a usage of a feature gate, but I don't expect it to be controversial as the feature gate was only used to workaround a limitation of rust in the past. (closures never being `Clone`) The second commit uses `#[allow_internal_unstable]` to avoid leaking the `trusted_step` feature gate usage from inside the index newtype macro. It didn't work for the `min_specialization` feature gate though. The third commit removes (almost) all feature gates from the compiler that weren't used anyway.
2021-06-03Restore the num_def_ids_untracked public function giving the total number of ↵Denis Merigoux-0/+11
exported symbols for each crate Restored underlying num_def_ids_method Update compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs Changed name to fit with naming convention Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com> Update compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs Replace regular doc with Rustdoc comment Co-authored-by: Joshua Nelson <jyn514@gmail.com> Clarifies third-party use of num_def_ids_untracked
2021-06-02Restrict access to crate_name.Camille GILLOT-3/+2
Also remove original_crate_name, which had the exact same implementation
2021-06-02Update compiler/rustc_metadata/src/rmeta/mod.rsCamille Gillot-1/+1
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2021-06-02Auto merge of #85908 - cjgillot:private-dep-query, r=Aaron1011bors-4/+5
Make is_private_dep a query. Part of #85153 r? `@Aaron1011`