about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/query
AgeCommit message (Collapse)AuthorLines
2021-08-22Fix typos “an”→“a” and a few different ones that appeared in the ↵Frank Steffahn-1/+1
same search
2021-08-22Fix more “a”/“an” typosFrank Steffahn-1/+1
2021-08-18Fold `vtable_trait_upcasting_coercion_new_vptr_slot` logic into obligation ↵Charles Lew-3/+3
processing.
2021-08-14Auto merge of #85020 - lrh2000:named-upvars, r=tmandrybors-0/+10
Name the captured upvars for closures/generators in debuginfo Previously, debuggers print closures as something like ``` y::main::closure-0 (0x7fffffffdd34) ``` The pointer actually references to an upvar. It is not very obvious, especially for beginners. It's because upvars don't have names before, as they are packed into a tuple. This PR names the upvars, so we can expect to see something like ``` y::main::closure-0 {_captured_ref__b: 0x[...]} ``` r? `@tmandry` Discussed at https://github.com/rust-lang/rust/pull/84752#issuecomment-831639489 .
2021-08-10Replace #[plugin_registrar] with exporting __rustc_plugin_registrarbjorn3-3/+0
2021-08-03Implement pointer casting.Charles Lew-0/+5
2021-07-24Support -Z unpretty=thir-tree againSmitty-0/+6
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-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-1/+1
2021-07-16Add initial implementation of HIR-based WF checking for diagnosticsAaron Hill-0/+14
During well-formed checking, we walk through all types 'nested' in generic arguments. For example, WF-checking `Option<MyStruct<u8>>` will cause us to check `MyStruct<u8>` and `u8`. However, this is done on a `rustc_middle::ty::Ty`, which has no span information. As a result, any errors that occur will have a very general span (e.g. the definintion of an associated item). This becomes a problem when macros are involved. In general, an associated type like `type MyType = Option<MyStruct<u8>>;` may have completely different spans for each nested type in the HIR. Using the span of the entire associated item might end up pointing to a macro invocation, even though a user-provided span is available in one of the nested types. This PR adds a framework for HIR-based well formed checking. This check is only run during error reporting, and is used to obtain a more precise span for an existing error. This is accomplished by individually checking each 'nested' type in the HIR for the type, allowing us to find the most-specific type (and span) that produces a given error. The majority of the changes are to the error-reporting code. However, some of the general trait code is modified to pass through more information. Since this has no soundness implications, I've implemented a minimal version to begin with, which can be extended over time. In particular, this only works for HIR items with a corresponding `DefId` (e.g. it will not work for WF-checking performed within function bodies).
2021-07-14Shrink the CrateStore dynamic interface.Camille GILLOT-0/+3
2021-07-13Auto merge of #86857 - fee1-dead:add-attr, r=oli-obkbors-0/+4
Add #[default_method_body_is_const] `@rustbot` label F-const_trait_impl
2021-07-11Auto merge of #85941 - cjgillot:qresolve, r=Aaron1011bors-11/+7
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-10Auto merge of #81360 - Aaron1011:trait-caller-loc, r=nagisabors-0/+4
Support forwarding caller location through trait object method call Since PR #69251, the `#[track_caller]` attribute has been supported on traits. However, it only has an effect on direct (monomorphized) method calls. Calling a `#[track_caller]` method on a trait object will *not* propagate caller location information - instead, `Location::caller()` will return the location of the method definition. This PR forwards caller location information when `#[track_caller]` is present on the method definition in the trait. This is possible because `#[track_caller]` in this position is 'inherited' by any impls of that trait, so all implementations will have the same ABI. This PR does *not* change the behavior in the case where `#[track_caller]` is present only on the impl of a trait. While all implementations of the method might have an explicit `#[track_caller]`, we cannot know this at codegen time, since other crates may have impls of the trait. Therefore, we keep the current behavior of not forwarding the caller location, ensuring that all implementations of the trait will have the correct ABI. See the modified test for examples of how this works
2021-07-10Test for misusing attributeDeadbeef-1/+1
2021-07-10Add impl_constness queryDeadbeef-0/+4
2021-07-10Add a query for `CapturedPlace::to_symbol`lrh2000-0/+10
2021-07-07Auto merge of #86901 - sexxi-goose:query_remove, r=nikomatsakisbors-19/+0
Make type_implements_trait not a query r? `@nikomatsakis`
2021-07-06Make type_implements_trait not a queryAman Arora-19/+0
2021-07-06Make resolutions a query.Camille GILLOT-11/+7
2021-07-06Revert "Revert "Merge CrateDisambiguator into StableCrateId""bjorn3-4/+0
This reverts commit 8176ab8bc18fdd7d3c2cf7f720c51166364c33a3.
2021-07-05Auto merge of #86674 - Aaron1011:new-querify-limits, r=michaelwoeristerbors-0/+4
Query-ify global limit attribute handling Currently, we read various 'global limits' from inner attributes the crate root (`recursion_limit`, `move_size_limit`, `type_length_limit`, `const_eval_limit`). These limits are then stored in `Sessions`, allowing them to be access from a `TyCtxt` without registering a dependency on the crate root attributes. This PR moves the calculation of these global limits behind queries, so that we properly track dependencies on crate root attributes. During the setup of macro expansion (before we've created a `TyCtxt`), we need to access the recursion limit, which is now done by directly calling into the code shared by the normal query implementations.
2021-07-04Combine individual limit queries into single `limits` queryAaron Hill-20/+2
2021-07-04Query-ify global limit attribute handlingAaron Hill-0/+22
2021-07-04allow inference vars in type_implements_traitNiko Matsakis-1/+14
2021-07-01Rename all_crate_nums query to crates and remove useless wrapperbjorn3-1/+1
2021-06-20Make allocator_kind a query.Camille GILLOT-0/+4
2021-06-17Rollup merge of #86353 - JohnTitor:remove-projection_ty_from_predicates, ↵Yuki Okushi-4/+0
r=oli-obk Remove `projection_ty_from_predicates` Fixes #86350 r? ``@oli-obk``
2021-06-16Remove `projection_ty_from_predicates`Yuki Okushi-4/+0
2021-06-15Refactor to make interpreter and codegen backend neutral to vtable internal ↵Charles Lew-3/+3
representation.
2021-06-07Revert "Merge CrateDisambiguator into StableCrateId"bjorn3-0/+4
This reverts commit d0ec85d3fb6d322496cb8f4bc1c21e19f23284ad.
2021-06-05Update compiler/rustc_middle/src/query/mod.rsCamille Gillot-1/+0
2021-06-04Always go through the expn_that_defined query.Camille GILLOT-0/+1
2021-06-04Support forwarding caller location through trait object method callAaron Hill-0/+4
Since PR #69251, the `#[track_caller]` attribute has been supported on traits. However, it only has an effect on direct (monomorphized) method calls. Calling a `#[track_caller]` method on a trait object will *not* propagate caller location information - instead, `Location::caller()` will return the location of the method definition. This PR forwards caller location information when `#[track_caller]` is present on the method definition in the trait. This is possible because `#[track_caller]` in this position is 'inherited' by any impls of that trait, so all implementations will have the same ABI. This PR does *not* change the behavior in the case where `#[track_caller]` is present only on the impl of a trait. While all implementations of the method might have an explicit `#[track_caller]`, we cannot know this at codegen time, since other crates may have impls of the trait. Therefore, we keep the current behavior of not forwarding the caller location, ensuring that all implementations of the trait will have the correct ABI. See the modified test for examples of how this works
2021-06-02Restrict access to crate_name.Camille GILLOT-4/+0
Also remove original_crate_name, which had the exact same implementation
2021-06-02Auto merge of #85908 - cjgillot:private-dep-query, r=Aaron1011bors-0/+6
Make is_private_dep a query. Part of #85153 r? `@Aaron1011`
2021-06-01Make is_private_dep a query.Camille GILLOT-0/+6
2021-06-01Remove StableVec.Camille GILLOT-1/+1
2021-06-01Only compute the trait_map once.Camille GILLOT-1/+0
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-16/+16
2021-06-01Auto merge of #85153 - cjgillot:qresolve, r=Aaron1011bors-16/+16
Reduce the amount of untracked state in TyCtxt Access to untracked global state may generate instances of #84970. The GlobalCtxt contains the lowered HIR, the resolver outputs and interners. By wrapping the resolver inside a query, we make sure those accesses are properly tracked. As a no_hash query, all dependent queries essentially become `eval_always`, what they should have been from the beginning.
2021-05-31Auto merge of #85266 - cjgillot:hir-dep-clean, r=michaelwoeristerbors-1/+1
Remove obsolete workaround. The regression test for #62649 appears to pass even without the workaround.
2021-05-30Make is_private_dep a query.Camille GILLOT-0/+5
2021-05-30Make allocator_kind a query.Camille GILLOT-0/+3
2021-05-30Remove StableVec.Camille GILLOT-1/+1
2021-05-30Restrict access to crate_name.Camille GILLOT-4/+0
Also remove original_crate_name, which had the exact same implementation
2021-05-30Make resolutions a query.Camille GILLOT-10/+7
2021-05-30Only compute the trait_map once.Camille GILLOT-1/+0
2021-05-30Merge CrateDisambiguator into StableCrateIdbjorn3-4/+0
2021-05-28Merge fields and comment.Camille GILLOT-1/+1