summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/rmeta/decoder
AgeCommit message (Collapse)AuthorLines
2023-04-11Split implied and super predicate queriesMichael Goulet-1/+13
2023-03-23rustc_metadata: Freeze cstore after the full crate list is queriedVadim Petrochenkov-0/+3
2023-03-23resolve: Rename some cstore methods to match queries and add commentsVadim Petrochenkov-4/+4
about costs associated with replacing them with query calls.
2023-03-23Auto merge of #109517 - matthiaskrgr:rollup-m3orqzd, r=matthiaskrgrbors-12/+0
Rollup of 7 pull requests Successful merges: - #108541 (Suppress `opaque_hidden_inferred_bound` for nested RPITs) - #109137 (resolve: Querify most cstore access methods (subset 2)) - #109380 (add `known-bug` test for unsoundness issue) - #109462 (Make alias-eq have a relation direction (and rename it to alias-relate)) - #109475 (Simpler checked shifts in MIR building) - #109504 (Stabilize `arc_into_inner` and `rc_into_inner`.) - #109506 (make param bound vars visibly bound vars with -Zverbose) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23Rollup merge of #109137 - petrochenkov:qcstore2, r=cjgillotMatthias Krüger-12/+0
resolve: Querify most cstore access methods (subset 2) These changes are less likely to cause perf regressions than the rest of https://github.com/rust-lang/rust/pull/108346.
2023-03-22Rollup merge of #109213 - oli-obk:cstore, r=cjgillotMatthias Krüger-1/+4
Eagerly intern and check CrateNum/StableCrateId collisions r? ``@cjgillot`` It seems better to check things ahead of time than checking them afterwards. The [previous version](https://github.com/rust-lang/rust/pull/108390) was a bit nonsensical, so this addresses the feedback
2023-03-21LocalCrate keyMichael Goulet-5/+6
2023-03-21Use local key in providersMichael Goulet-18/+5
2023-03-21Eagerly intern and check CrateNum/StableCrateId collisionsOli Scherer-1/+4
2023-03-20Update some names and commentsMichael Goulet-1/+1
2023-03-18Implement FixedSizeEncoding for UnusedGenericParams.Camille GILLOT-9/+1
2023-03-16resolve: Remove `item_attrs_untracked`Vadim Petrochenkov-8/+0
2023-03-16resolve: Remove `item_generics_num_lifetimes`Vadim Petrochenkov-4/+0
2023-03-15Rollup merge of #109109 - compiler-errors:polymorphize-foreign, r=NilstriebDylan DPC-1/+9
Use `unused_generic_params` from crate metadata Due to the way that `separate_provide_extern` interacted with the implementation of `<ty::InstanceDef<'tcx> as Key>::query_crate_is_local`, we actually never hit the foreign provider for `unused_generic_params`. Additionally, since the *local* provider of `unused_generic_params` calls `should_polymorphize`, which always returns false if the def-id is foreign, this means that we never actually polymorphize monomorphic instances originating from foreign crates. We don't actually encode `unused_generic_params` for items where all generics are used, so I had to tweak the foreign provider to fall back to `ty::UnusedGenericParams::new_all_used()` to avoid more ICEs when the above bugs were fixed.
2023-03-14Use `unused_generic_params` from crate metadataMichael Goulet-1/+9
2023-03-13metadata: Remove some more untracked `CStore` methodsVadim Petrochenkov-10/+4
2023-03-13resolve: Remove `struct_field_names_untracked`Vadim Petrochenkov-9/+1
2023-03-13resolve: Remove `fn_has_self_parameter_untracked`Vadim Petrochenkov-4/+0
2023-03-13resolve: Remove `struct_field_visibilities_untracked`Vadim Petrochenkov-8/+1
2023-03-13resolve: Remove `visibility_untracked`Vadim Petrochenkov-4/+0
2023-02-21Rollup merge of #108141 - spastorino:add_rpitit_queries, r=compiler-errorsDylan DPC-0/+2
Add rpitit queries This is part of the changes we are making to lower RPITITs as an associated type. The rest of the stuff will follow under a `-Z` flag. I still need to add comments to the code, explain stuff and also I'd need to avoid encoding in metadata when rpitit queries return `&[]` r? `@compiler-errors`
2023-02-20Make untracked.cstore lockable so that resolution can still write to it when ↵Oli Scherer-1/+7
using TyCtxt
2023-02-19Add associated_items_for_impl_trait_in_trait querySantiago Pastorino-0/+2
2023-02-16Factor query arena allocation out from query cachesJohn Kåre Alsaker-1/+1
2023-02-13rustdoc: Eliminate remaining uses of resolverVadim Petrochenkov-14/+1
2023-02-10Resolve documentation links in rustc and store the results in metadataVadim Petrochenkov-30/+4
This commit implements MCP https://github.com/rust-lang/compiler-team/issues/584 It also removes code that is no longer used, and that includes code cloning resolver, so issue #83761 is fixed.
2023-02-05rustc_metadata: Encode/decode some `LazyArray`s without an `Option`Vadim Petrochenkov-2/+11
Also add asserts to decoding `LazyArray`s with `Option`
2023-01-27Separate witness type computation from the generator transform.Camille GILLOT-0/+1
2023-01-25rustdoc: Collect rustdoc-reachable items during early doc link resolutionVadim Petrochenkov-0/+6
2023-01-23rustc_metadata: Support non-`Option` nullable values in metadata tablesVadim Petrochenkov-6/+1
This is a convenience feature for cases in which "no value in the table" and "default value in the table" are equivalent. Tables using `Table<DefIndex, ()>` are migrated in this PR, some other cases can be migrated later. This helps `DocFlags` in https://github.com/rust-lang/rust/pull/107136 in particular.
2023-01-21rustc_metadata: Encode `doc(hidden)` flag to metadataVadim Petrochenkov-2/+6
To retrieve these flags rustdoc currently has to mass decode full attributes for items in the whole crate tree, so it's better to pre-compute it in advance. This is especially for short-term performance of https://github.com/rust-lang/rust/pull/107054 because resolver cannot use memoization of query results yet.
2023-01-21Auto merge of #106977 - michaelwoerister:unord_id_collections, r=oli-obkbors-3/+4
Use UnordMap and UnordSet for id collections (DefIdMap, LocalDefIdMap, etc) This PR changes the `rustc_data_structures::define_id_collections!` macro to use `UnordMap` and `UnordSet` instead of `FxHashMap` and `FxHashSet`. This should account for a large portion of hash-maps being used in places where they can cause trouble. The changes required are moderate but non-zero: - In some places the collections are extracted into sorted vecs. - There are a few instances where for-loops have been changed to extends. ~~Let's see what the performance impact is. With a bit more refactoring, we might be able to get rid of some of the additional sorting -- but the change set is already big enough. Unless there's a performance impact, I'd like to do further changes in subsequent PRs.~~ Performance does not seem to be negatively affected ([perf-run here](https://github.com/rust-lang/rust/pull/106977#issuecomment-1396776699)). Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533). r? `@ghost`
2023-01-19Conditionally encode booleanMichael Goulet-1/+9
2023-01-19Encode whether foreign opaques are TAITs or notMichael Goulet-0/+1
2023-01-19Use UnordMap instead of FxHashMap in define_id_collections!().Michael Woerister-3/+4
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-1/+1
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2022-12-28better names and a commentMichael Goulet-1/+1
2022-12-09Move the untracked cstore and source_span into a structOli Scherer-0/+3
2022-11-22rustc_metadata: Switch module children decoding to an iteratorVadim Petrochenkov-12/+7
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-2/+2
2022-10-31Rewrite implementation of `#[alloc_error_handler]`Amanieu d'Antras-0/+6
The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`. The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic. This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called. This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-10-23Rollup merge of #103192 - petrochenkov:noalltraits, r=jyn514Dylan DPC-5/+0
rustdoc: Eliminate uses of `EarlyDocLinkResolver::all_traits` Another step to https://github.com/rust-lang/rust/pull/94857.
2022-10-22Auto merge of #103196 - Nilstrieb:no-meta-query, r=cjgillotbors-11/+0
Get rid of native_library projection queries They don't seem particularly useful as I don't expect native libraries to change frequently. Maybe they do provide significant value of keeping incremental compilation green though, I'm not sure.
2022-10-21Introduce deduced parameter attributes, and use them for deducing `readonly` onPatrick Walton-0/+1
indirect immutable freeze by-value function parameters. Right now, `rustc` only examines function signatures and the platform ABI when determining the LLVM attributes to apply to parameters. This results in missed optimizations, because there are some attributes that can be determined via analysis of the MIR making up the function body. In particular, `readonly` could be applied to most indirectly-passed by-value function arguments (specifically, those that are freeze and are observed not to be mutated), but it currently is not. This patch introduces the machinery that allows `rustc` to determine those attributes. It consists of a query, `deduced_param_attrs`, that, when evaluated, analyzes the MIR of the function to determine supplementary attributes. The results of this query for each function are written into the crate metadata so that the deduced parameter attributes can be applied to cross-crate functions. In this patch, we simply check the parameter for mutations to determine whether the `readonly` attribute should be applied to parameters that are indirect immutable freeze by-value. More attributes could conceivably be deduced in the future: `nocapture` and `noalias` come to mind. Adding `readonly` to indirect function parameters where applicable enables some potential optimizations in LLVM that are discussed in [issue 103103] and [PR 103070] around avoiding stack-to-stack memory copies that appear in functions like `core::fmt::Write::write_fmt` and `core::panicking::assert_failed`. These functions pass a large structure unchanged by value to a subfunction that also doesn't mutate it. Since the structure in this case is passed as an indirect parameter, it's a pointer from LLVM's perspective. As a result, the intermediate copy of the structure that our codegen emits could be optimized away by LLVM's MemCpyOptimizer if it knew that the pointer is `readonly nocapture noalias` in both the caller and callee. We already pass `nocapture noalias`, but we're missing `readonly`, as we can't determine whether a by-value parameter is mutated by examining the signature in Rust. I didn't have much success with having LLVM infer the `readonly` attribute, even with fat LTO; it seems that deducing it at the MIR level is necessary. No large benefits should be expected from this optimization *now*; LLVM needs some changes (discussed in [PR 103070]) to more aggressively use the `noalias nocapture readonly` combination in its alias analysis. I have some LLVM patches for these optimizations and have had them looked over. With all the patches applied locally, I enabled LLVM to remove all the `memcpy`s from the following code: ```rust fn main() { println!("Hello {}", 3); } ``` which is a significant codegen improvement over the status quo. I expect that if this optimization kicks in in multiple places even for such a simple program, then it will apply to Rust code all over the place. [issue 103103]: https://github.com/rust-lang/rust/issues/103103 [PR 103070]: https://github.com/rust-lang/rust/pull/103070
2022-10-19Get rid of native_library projection queriesnils-11/+0
They don't seem particularly useful as I don't expect native libraries to change frequently.
2022-10-19rustdoc: Eliminate uses of `EarlyDocLinkResolver::all_traits`Vadim Petrochenkov-5/+0
2022-10-07Rewrite representabilityCameron Steffen-0/+1
2022-09-23Serialize RPITIT values in libsMichael Goulet-0/+9
2022-09-07rustc: Parameterize `ty::Visibility` over used IDVadim Petrochenkov-3/+3
It allows using `LocalDefId` instead of `DefId` when possible, and also encode cheaper `Visibility<DefIndex>` into metadata.
2022-08-30Remove fn_has_self_parameter table.Camille GILLOT-3/+3