about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta
AgeCommit message (Collapse)AuthorLines
2021-10-07Rollup merge of #89476 - cjgillot:expn-id, r=petrochenkovJubilee-6/+10
Correct decoding of foreign expansions during incr. comp. Fixes https://github.com/rust-lang/rust/issues/74946 The original issue was due to a wrong assertion in `expn_hash_to_expn_id`. The secondary issue was due to a mismatch between the encoding and decoding paths for expansions that are created after the TyCtxt is created.
2021-10-06Do not ICE if some foreign expansions were not encoded.Camille GILLOT-2/+0
The metadata encoder does not necessarily encode all expansions, only those which are referenced in other metadata fields.
2021-10-06Access Session while decoding expn_id.Camille GILLOT-4/+10
2021-10-06Introduce get_diagnostic_nameCameron Steffen-5/+13
2021-10-03Move rustc_middle::middle::cstore to rustc_session.Camille GILLOT-6/+6
2021-10-01Auto merge of #88880 - cjgillot:no-krate, r=oli-obkbors-4/+3
Rework HIR API to make invocations of the hir_crate query harder. `hir_crate` forces the recomputation of queries that depend on it. This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.
2021-09-30Move EncodedMetadata to rustc_metadata.Camille GILLOT-2/+19
2021-09-30Move encode_metadata out of CrateStore.Camille GILLOT-7/+5
2021-09-29Avoid more invocations of hir_crate query.Camille GILLOT-4/+3
2021-09-21`crates` is already deterministiclcnr-38/+23
2021-09-14rustc_metadata: Remove Metadata::raw_bytes() and use Metadata::blob() ↵Michael Woerister-7/+4
directly instead.
2021-09-14Rename DefPathHashMap in rustc_metadata so its name does not clash with ↵Michael Woerister-21/+19
DefPathHashMap in rustc_hir.
2021-09-14Make DefPathHash->DefId panic for if the mapping fails.Michael Woerister-7/+6
We only use this mapping for cases where we know that it must succeed. Letting it panic otherwise makes it harder to use the API in unsupported ways.
2021-09-14Store DefPathHash->DefIndex map in on-disk-hash-table format in crate metadata.Michael Woerister-65/+103
This encoding allows for random access without an expensive upfront decoding state which in turn allows simplifying the DefPathIndex lookup logic without regressing performance.
2021-09-14Allow taking an OwningRef of the crate metadata blob.Michael Woerister-18/+62
2021-09-12Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddybbors-0/+3
Add -Z panic-in-drop={unwind,abort} command-line option This PR changes `Drop` to abort if an unwinding panic attempts to escape it, making the process abort instead. This has several benefits: - The current behavior when unwinding out of `Drop` is very unintuitive and easy to miss: unwinding continues, but the remaining drops in scope are simply leaked. - A lot of unsafe code doesn't expect drops to unwind, which can lead to unsoundness: - https://github.com/servo/rust-smallvec/issues/14 - https://github.com/bluss/arrayvec/issues/3 - There is a code size and compilation time cost to this: LLVM needs to generate extra landing pads out of all calls in a drop implementation. This can compound when functions are inlined since unwinding will then continue on to process drops in the callee, which can itself unwind, etc. - Initial measurements show a 3% size reduction and up to 10% compilation time reduction on some crates (`syn`). One thing to note about `-Z panic-in-drop=abort` is that *all* crates must be built with this option for it to be sound since it makes the compiler assume that dropping `Box<dyn Any>` will never unwind. cc https://github.com/rust-lang/lang-team/issues/97
2021-09-12Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnrManish Goregaokar-9/+13
generic_const_exprs: use thir for abstract consts instead of mir Changes `AbstractConst` building to use `thir` instead of `mir` so that there's less chance of consts unifying when they shouldn't because lowering to mir dropped information (see `abstract-consts-as-cast-5.rs` test) r? `@lcnr`
2021-09-12Rollup merge of #88677 - petrochenkov:exportid, r=davidtwcoManish Goregaokar-36/+20
rustc: Remove local variable IDs from `Export`s Local variables can never be exported.
2021-09-11Ensure that crates are linked with compatible panic-in-drop settingsAmanieu d'Antras-0/+3
2021-09-10rustc: Remove local variable IDs from `Export`sVadim Petrochenkov-36/+20
Local variables can never be exported.
2021-09-10Keep a parent LocalDefId in SpanData.Camille GILLOT-1/+2
2021-09-09add test for builtin types N + N unifying with fn callEllen-1/+1
2021-09-09rename mir -> thir around abstract constsEllen-9/+13
2021-09-01Compute proc_macros in resolutions.Camille GILLOT-9/+11
2021-08-28Treat macros as HIR itemsinquisitivecrystal-14/+11
2021-08-25Auto merge of #85344 - cbeuw:remap-across-cwd, r=michaelwoeristerbors-5/+14
Correctly handle remapping from path containing the current directory with trailing paths If we have a `auxiliary/lib.rs`, and we generate the metadata with `--remap-path-prefix $PWD/auxiliary=xyz`, the path to `$PWD/auxiliary/lib.rs` won't be correctly remapped in the metadata. This is because internally, path to the working directory itself and relative paths to files under the working directory are remapped separately (hence neither are affected since neither has `$PWD/auxiliary` as prefix), but the concatenation between the working directory and the relative path is not remapped. This PR fixes that.
2021-08-22Fix typos “an”→“a” and a few different ones that appeared in the ↵Frank Steffahn-1/+1
same search
2021-08-15Include (potentially remapped) working dir in crate hashAaron Hill-1/+4
Fixes #85019 A `SourceFile` created during compilation may have a relative path (e.g. if rustc itself is invoked with a relative path). When we write out crate metadata, we convert all relative paths to absolute paths using the current working direction. However, the working directory is not included in the crate hash. This means that the crate metadata can change while the crate hash remains the same. Among other problems, this can cause a fingerprint mismatch ICE, since incremental compilation uses the crate metadata hash to determine if a foreign query is green. This commit moves the field holding the working directory from `Session` to `Options`, including it as part of the crate hash.
2021-08-06encode `generics_of` of fields and ty paramsEllen-2/+2
2021-07-25Introduce OwnerNode::Crate.Camille GILLOT-1/+1
2021-07-25Merge the BTreeMap in hir::Crate.Camille GILLOT-1/+1
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-14Shrink the CrateStore dynamic interface.Camille GILLOT-21/+14
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/+3
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-06Correct comments about untracked accesses.Camille GILLOT-3/+3
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-13/+5
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-01Auto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkovbors-2/+2
Rename all_crate_nums query to crates and remove useless wrapper Split out of https://github.com/rust-lang/rust/pull/86105 r? `@petrochenkov`