about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta
AgeCommit message (Collapse)AuthorLines
2023-09-10List all defined and required lang items in -Zlsbjorn3-0/+20
2023-09-10List more crate metadata in -Zlsbjorn3-4/+38
2023-09-10Encode only MIR that can be used by other cratesTomasz Miąsko-12/+31
Only reachable items might participate in the code generation in the downstream crates. Omit redundant optimized MIR of unreachable items from a crate metadata. Additionally, include reachable closures in reachable set, so that unreachable closures can be omitted on the same basis.
2023-09-09Use `FreezeLock` for `CStore`John Kåre Alsaker-2/+2
2023-09-07Use `Freeze` for `SourceFile.external_src`John Kåre Alsaker-2/+2
2023-09-03Register the file while computing its start position.Camille GILLOT-1/+1
2023-09-03Use relative positions inside a SourceFile.Camille GILLOT-13/+11
2023-09-02Auto merge of #115286 - saethlin:detangler, r=petrochenkovbors-11/+97
Skip rendering metadata strings from include_str!/include_bytes! The const rendering code in rustdoc completely ignores consts from expansions, but the compiler was rendering all consts. So some consts (namely those from `include_bytes!`) were rendered then ignored. Most of the diff here is from moving `print_const_expr` from rustdoc into `rustc_hir_pretty` so that it can be used in rustdoc and when building rmeta files.
2023-09-01Reuse const rendering from rustdoc in rmeta encodingBen Kimock-11/+97
2023-09-01Use `OnceLock` for `SingleCache`John Kåre Alsaker-2/+2
2023-08-30Auto merge of #113542 - saethlin:adaptive-tables, r=b-naberbors-47/+125
Adapt table sizes to the contents This is an implementation of https://github.com/rust-lang/compiler-team/issues/666 The objective of this PR is to permit the rmeta format to accommodate larger crates that need offsets larger than a `u32` can store without compromising performance for crates that do not need such range. The second commit is a number of tiny optimization opportunities I noticed while looking at perf recordings of the first commit. The rmeta tables need to have fixed-size elements to permit lazy random access. But the size only needs to be fixed _per table_, not per element type. This PR adds another `usize` to the table header which indicates the table element size. As each element of a table is set, we keep track of the widest encoded table value, then don't bother encoding all the unused trailing bytes on each value. When decoding table elements, we copy them to a full-width array if they are not already full-width. `LazyArray` needs some special treatment. Most other values that are encoded in tables are indexes or offsets, and those tend to be small so we get to drop a lot of zero bytes off the end. But `LazyArray` encodes _two_ small values in a fixed-width table element: A position of the table and the length of the table. The treatment described above could trim zero bytes off the table length, but any nonzero length shields the position bytes from the optimization. To improve this, we interleave the bytes of position and length. This change is responsible for about half of the crate metadata win on many crates. Fixes https://github.com/rust-lang/rust/issues/112934 (probably) Fixes https://github.com/rust-lang/rust/issues/103607
2023-08-29Document in the code how this scheme worksBen Kimock-14/+25
2023-08-27Add a specialization for encoding byte arrays in rmetaBen Kimock-0/+7
2023-08-11rustc: Move `features` from `Session` to `GlobalCtxt`Vadim Petrochenkov-4/+7
Removes two pieces of mutable state. Follow up to #114622.
2023-08-09rustc: Move `crate_types` from `Session` to `GlobalCtxt`Vadim Petrochenkov-2/+2
Removes a piece of mutable state. Follow up to #114578.
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-14/+14
2023-08-03Compute variances for lazy type aliasesLeón Orell Valerian Liehr-3/+7
2023-07-30Rollup merge of #113741 - compiler-errors:rpitit-projects-to-missing-opaque, ↵Jubilee-7/+1
r=spastorino Don't install default projection bound for return-position `impl Trait` in trait methods with no body This ensures that we never try to project to an opaque type in a trait method that has no body to infer its hidden type, which means we never later call `type_of` on that opaque. This is because opaque types try to reveal their hidden type when proving auto traits. I thought about this a lot, and I think this is a fix that's less likely to introduce other strange downstream ICEs than #113461. Fixes #113434 r? `@spastorino`
2023-07-30Don't install default projection bound for RPITITsMichael Goulet-7/+1
2023-07-30inline format!() args up to and including rustc_codegen_llvmMatthias Krüger-1/+1
2023-07-29Implement assumed_wf_types for RPITITs' implementationsMichael Goulet-0/+8
2023-07-22improve debuggabilityLukas Markeffsky-5/+4
2023-07-21Revert "Auto merge of #113166 - moulins:ref-niches-initial, r=oli-obk"David Tolnay-4/+1
This reverts commit 557359f92512ca88b62a602ebda291f17a953002, reversing changes made to 1e6c09a803fd543a98bfbe1624d697a55300a786.
2023-07-21add crate-local `-Z reference_niches` unstable flag (does nothing for now)Moulins-1/+4
2023-07-19Auto merge of #113865 - Dylan-DPC:rollup-pt960bk, r=Dylan-DPCbors-4/+2
Rollup of 7 pull requests Successful merges: - #113444 (add tests for alias bound preference) - #113716 (Add the `no-builtins` attribute to functions when `no_builtins` is applied at the crate level.) - #113754 (Simplify native_libs query) - #113765 (Make it clearer that edition functions are `>=`, not `==`) - #113774 (Improve error message when closing bracket interpreted as formatting fill character) - #113785 (Fix invalid display of inlined re-export when both local and foreign items are inlined) - #113803 (Fix inline_const with interpolated block) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-19Rollup merge of #113754 - cjgillot:simplify-foreign, r=petrochenkovDylan DPC-4/+2
Simplify native_libs query Drive-by cleanup I saw while implementing https://github.com/rust-lang/rust/pull/113734
2023-07-19Encode shorthands for spans in metadata.Camille GILLOT-13/+48
2023-07-17Do not fetch HIR in native_libs.Camille GILLOT-1/+1
2023-07-17Simplify foreign_modules.Camille GILLOT-3/+1
2023-07-17Auto merge of #113562 - saethlin:larger-incr-comp-offset, r=nnethercotebors-2/+2
Use u64 for incr comp allocation offsets Fixes https://github.com/rust-lang/rust/issues/76037 Fixes https://github.com/rust-lang/rust/issues/95780 Fixes https://github.com/rust-lang/rust/issues/111613 These issues are all reporting ICEs caused by using `u32` to store offsets to allocations in the incremental compilation cache. This PR aims to lift that limitation by changing the offset type in question to `u64`. There are two perf runs in this PR. The first reports a regression, and the second does not. The changes are the same in both. I rebased the PR then did the second perf run because I noticed that the primary regression in it was very commonly seen in spurious regression reports. I do not know what the perf run will report when this is merged. I would not be surprised to see regression or neutral, but the cachegrind diffs for the regression point at `try_mark_previous_green` which is a common source of inexplicable regressions and I don't think should be perturbed by this PR. I'm not opposed to adding a regression test such as ```rust fn main() { println!("{}", [37; 1 << 30].len()); } ``` But that program takes 1 minute to compile and consumes 4.6 GB of memory then writes that much to disk. Is that a concerning amount of resource use for a test? r? `@nnethercote`
2023-07-14Use u64 for incr comp allocation offsetsBen Kimock-2/+2
2023-07-14Rollup merge of #113698 - compiler-errors:rpitit-check, r=spastorinoMatthias Krüger-1/+1
Make it clearer that we're just checking for an RPITIT Tiny nit to use `is_impl_trait_in_trait` more, to make it clearer that we're just checking whether a def-id is an RPITIT, rather than doing something meaningful with the `opt_rpitit_info`. r? `@spastorino`
2023-07-14Make it clearer that we're just checking for an RPITITMichael Goulet-1/+1
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-1/+1
2023-07-14Micro-optimizeBen Kimock-4/+14
2023-07-13Adapt table sizes to the contentsBen Kimock-45/+102
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-13/+25
2023-07-08Replace RPITIT current impl with new strategy that lowers as a GATSantiago Pastorino-31/+1
2023-07-04Auto merge of #113215 - compiler-errors:rpitit-predicates-tweaks, r=spastorinobors-4/+4
Make RPITITs assume/require their parent method's predicates Removes a FIXME from the `param_env` query where we were manually adding the parent function's predicates to the RPITIT's assumptions. r? `@spastorino`
2023-06-30reflow comment, not a FIXME i thinkMichael Goulet-4/+4
2023-06-29Encode item bounds for DefKind::ImplTraitPlaceholderMichael Goulet-0/+3
2023-06-28Auto merge of #98867 - cjgillot:metaloop, r=oli-obkbors-284/+197
Refactor metadata emission to avoid visiting HIR This PR refactors metadata emission to be based on tables and iteration over definitions. In a first part, this PR moves information from the `EntryKind` enum to tables, until removing the `EntryKind` enum. In a second part, the iteration scheme is refactored to avoid fetching HIR unless strictly necessary. r? `@ghost`
2023-06-27Encode impls in encode_impls.Camille GILLOT-46/+31
2023-06-27Use instrument macro.Camille GILLOT-13/+10
2023-06-27Retire encode_info_for_items.Camille GILLOT-83/+33
2023-06-27Encode Impl separately.Camille GILLOT-24/+31
2023-06-27Encode Trait info in def-id loop.Camille GILLOT-10/+8
2023-06-27Merge assoc_item functions.Camille GILLOT-50/+30
2023-06-27Encode fn_sig separately.Camille GILLOT-38/+91
Closures do not have a `fn_sig`, so no reason to encode one.
2023-06-26Migrate predicates_of and caller_bounds to ClauseMichael Goulet-6/+0