about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/context.rs
AgeCommit message (Collapse)AuthorLines
2021-10-08Auto merge of #89619 - michaelwoerister:incr-vtables, r=nagisabors-6/+1
Turn vtable_allocation() into a query This PR removes the untracked vtable-const-allocation cache from the `tcx` and turns the `vtable_allocation()` method into a query. The change is pretty straightforward and should be backportable without too much effort. Fixes https://github.com/rust-lang/rust/issues/89598.
2021-10-07Remove untracked vtable-const-allocation cache from tcxMichael Woerister-6/+1
2021-10-06Introduce get_diagnostic_nameCameron Steffen-2/+7
2021-10-05Auto merge of #89266 - cjgillot:session-ich, r=michaelwoeristerbors-1/+1
Move ICH to rustc_query_system Based on https://github.com/rust-lang/rust/pull/89183 The StableHashingContext does not need to be in rustc_middle. This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124.
2021-10-04Rollup merge of #89453 - waywardmonkeys:consistent-supertrait-usage, r=nagisaJubilee-1/+1
Consistently use 'supertrait'. A subset of places referred to 'super-trait', so this changes them to all use 'supertrait'. This matches 'supertype' and some other usages. An exception is 'auto-trait' which is consistently used in that manner.
2021-10-03Remove re-export.Camille GILLOT-1/+1
2021-10-02Consistently use 'supertrait'.Bruce Mitchener-1/+1
A subset of places referred to 'super-trait', so this changes them to all use 'supertrait'. This matches 'supertype' and some other usages. An exception is 'auto-trait' which is consistently used in that manner.
2021-10-01Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obkManish Goregaokar-0/+23
Coerce const FnDefs to implement const Fn traits You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`. r? ``@oli-obk`` ``@rustbot`` label T-compiler F-const_trait_impl
2021-09-30Move encode_metadata out of CrateStore.Camille GILLOT-6/+0
2021-09-19Auto merge of #88575 - eddyb:fn-abi-queries, r=nagisabors-55/+26
Querify `FnAbi::of_{fn_ptr,instance}` as `fn_abi_of_{fn_ptr,instance}`. *Note: opening this PR as draft because it's based on #88499* This more or less replicates the `LayoutOf::layout_of` setup from #88499, to replace `FnAbi::of_{fn_ptr,instance}` with `FnAbiOf::fn_abi_of_{fn_ptr,instance}`, and also route them through queries (which `layout_of` has used for a while). The two changes at the use sites (other than the names) are: * return type is now wrapped in `&'tcx` * the value *is* interned, which may affect performance * the `extra_args` list is now an interned `&'tcx ty::List<Ty<'tcx>>` * should be cheap (it's empty for anything other than C variadics) Theoretically, a `FnAbiOfHelpers` implementer could choose to keep the `Result<...>` instead of eagerly erroring, but the only existing users of these APIs are codegen backends, so they don't (want to) take advantage of this. At least miri could make use of this, since it prefers propagating errors (it "just" doesn't use `FnAbi` yet - cc `@RalfJung).` The way this is done is probably less efficient than what is possible, because the queries handle the correctness-oriented API (i.e. the split into `fn` pointers vs instances), whereas a lower-level query could end up with more reuse between different instances with identical signatures. r? `@nagisa` cc `@oli-obk` `@bjorn3`
2021-09-18[HACK(eddyb)] arena-allocate but don't intern `FnAbi`s.Eduard-Mihai Burtescu-5/+0
2021-09-18ty::layout: intern `FnAbi`s as `&'tcx`.Eduard-Mihai Burtescu-0/+5
2021-09-18ty::context: move interning `Allocation`s and `Layout`s to `direct_interners!`.Eduard-Mihai Burtescu-55/+26
2021-09-15Coerce const FnDefs to implement const Fn traitsDeadbeef-1/+4
2021-09-15Move is_const_fn to under TyCtxtDeadbeef-0/+20
2021-09-14Make DefPathHash->DefId panic for if the mapping fails.Michael Woerister-5/+1
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-14Remove RawDefId tracking infrastructure from incr. comp. framework.Michael Woerister-13/+1
This infrastructure is obsolete now with the new encoding scheme for the DefPathHash->DefIndex maps in crate metadata.
2021-09-14Store DefPathHash->DefIndex map in on-disk-hash-table format in crate metadata.Michael Woerister-0/+11
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-06Auto merge of #83214 - cjgillot:dep-map, r=michaelwoeristerbors-1/+4
Mmap the incremental data instead of reading it. Instead of reading the full incremental state using `fs::read_file`, we memmap it using a private read-only file-backed map. This allows the system to reclaim any memory we are not using, while ensuring we are not polluted by outside modifications to the file. Suggested in https://github.com/rust-lang/rust/pull/83036#issuecomment-800458082 by `@bjorn3`
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-2/+2
2021-08-30remove lazy_normalization_constsEllen-1/+1
2021-08-28Drop the query result memmap before serializing it back.Camille GILLOT-0/+2
2021-08-28Mmap the incremental data instead of reading it.Camille GILLOT-1/+2
2021-08-24Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiserbors-1/+1
Remove `Session.used_attrs` and move logic to `CheckAttrVisitor` Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-22Fix typos “a”→“an”Frank Steffahn-1/+1
2021-08-21Remove `Session.used_attrs` and move logic to `CheckAttrVisitor`Aaron Hill-1/+1
Instead of updating global state to mark attributes as used, we now explicitly emit a warning when an attribute is used in an unsupported position. As a side effect, we are to emit more detailed warning messages (instead of just a generic "unused" message). `Session.check_name` is removed, since its only purpose was to mark the attribute as used. All of the callers are modified to use `Attribute.has_name` Additionally, `AttributeType::AssumedUsed` is removed - an 'assumed used' attribute is implemented by simply not performing any checks in `CheckAttrVisitor` for a particular attribute. We no longer emit unused attribute warnings for the `#[rustc_dummy]` attribute - it's an internal attribute used for tests, so it doesn't mark sense to treat it as 'unused'. With this commit, a large source of global untracked state is removed.
2021-08-13move Constness into TraitPredicateDeadbeef-1/+1
2021-08-11Make concrete_opaque_types be FxHashSet<DefId>Santiago Pastorino-3/+1
2021-07-31rustc: Replace `HirId`s with `LocalDefId`s in `AccessLevels` tablesVadim Petrochenkov-12/+5
and passes using them - primarily privacy checking, stability checking and dead code checking. WIP
2021-07-20Support HIR wf checking for function signaturesAaron Hill-1/+1
During function type-checking, we normalize any associated types in the function signature (argument types + return type), and then create WF obligations for each of the normalized types. The HIR wf code does not currently support this case, so any errors that we get have imprecise spans. This commit extends `ObligationCauseCode::WellFormed` to support recording a function parameter, allowing us to get the corresponding HIR type if an error occurs. Function typechecking is modified to pass this information during signature normalization and WF checking. The resulting code is fairly verbose, due to the fact that we can no longer normalize the entire signature with a single function call. As part of the refactoring, we now perform HIR-based WF checking for several other 'typed items' (statics, consts, and inherent impls). As a result, WF and projection errors in a function signature now have a precise span, which points directly at the responsible type. If a function signature is constructed via a macro, this will allow the error message to point at the code 'most responsible' for the error (e.g. a user-supplied macro argument).
2021-07-18Remove deadlock virtual call.Camille GILLOT-1/+1
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-10/+50
2021-07-14Shrink the CrateStore dynamic interface.Camille GILLOT-7/+2
2021-07-06Correct comments about untracked accesses.Camille GILLOT-5/+5
2021-07-06Make resolutions a query.Camille GILLOT-58/+46
2021-07-06Make tcx.stable_crate_id() fasterbjorn3-2/+6
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-6/+6
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-04Combine individual limit queries into single `limits` queryAaron Hill-0/+17
2021-07-01Auto merge of #86749 - bjorn3:link_info_refactor_part1, r=petrochenkovbors-5/+1
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-5/+1
2021-06-30Auto merge of #86695 - sexxi-goose:closure_size, r=nikomatsakisbors-5/+13
Introduce -Zprofile-closures to evaluate the impact of 2229 This creates a CSV with name "closure_profile_XXXXX.csv", where the variable part is the process id of the compiler. To profile a cargo project you can run one of the following depending on if you're compiling a library or a binary: ``` cargo +nightly rustc --lib -- -Zprofile-closures cargo +nightly rustc --bin {binary_name} -- -Zprofile-closures ``` r? `@nikomatsakis`
2021-06-29Auto merge of #86475 - crlf0710:miri_vtable_refactor, r=bjorn3bors-1/+5
Change vtable memory representation to use tcx allocated allocations. This fixes https://github.com/rust-lang/rust/issues/86324. However i suspect there's more to change before it can land. r? `@bjorn3` cc `@rust-lang/miri`
2021-06-28Introduce -Zprofile-closures to evaluate the impact of 2229Aman Arora-5/+13
This creates a CSV with name "closure_profile_XXXXX.csv", where the variable part is the process id of the compiler. To profile a cargo project you can run one of the following depending on if you're compiling a library or a binary: ``` cargo +stage1 rustc --lib -- -Zprofile-closures cargo +stage1 rustc --bin -- -Zprofile-closures ```
2021-06-28Update other codegens to use tcx managed vtable allocations.Charles Lew-1/+5
2021-06-28Auto merge of #85909 - cjgillot:alloc-kind-query, r=Aaron1011bors-5/+0
Make allocator_kind a query. Part of #85153 r? `@Aaron1011`
2021-06-24Prefer "allow list" structure to check a typeYuki Okushi-18/+8
2021-06-24Rename function name in commentsYuki Okushi-3/+3
2021-06-24Do not panic in `return_type_impl_trait`Yuki Okushi-0/+7
2021-06-20Implement the query in cstore_impl.Camille GILLOT-1/+0
2021-06-20Make allocator_kind a query.Camille GILLOT-5/+1