about summary refs log tree commit diff
path: root/compiler/rustc_query_impl/src
AgeCommit message (Collapse)AuthorLines
2021-09-12Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnrManish Goregaokar-1/+2
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-10Rename decode to data_untracked.Camille GILLOT-3/+4
2021-09-10Track span dependency using a callback.Camille GILLOT-3/+3
2021-09-10Encode spans relative to their parent.Camille GILLOT-12/+36
2021-09-10Keep a parent LocalDefId in SpanData.Camille GILLOT-1/+1
2021-09-09rename mir -> thir around abstract constsEllen-1/+2
2021-09-06Auto merge of #83214 - cjgillot:dep-map, r=michaelwoeristerbors-23/+35
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-09-05Add query `own_existential_vtable_entries`Gary Guo-0/+10
2021-09-01Auto merge of #88121 - camelid:better-recursive-alias-error, r=estebankbors-1/+45
Improve errors for recursive type aliases Fixes #17539.
2021-08-29Retrieve `DefKind` from HIR map to reduce chance of cyclesNoah Lev-4/+6
`tcx.def_kind()` could theoretically invoke another query, which could cause an infinite query loop. Accessing the HIR map directly makes that less likely to happen. I also changed it to use `as_local()` (`tcx.def_kind()` seems to implicitly call `expect_local()`) and `opt_def_kind()` to reduce the chance of panicking on valid code.
2021-08-28Comment drop_serialized_data.Camille GILLOT-0/+5
2021-08-28Drop the query result memmap before serializing it back.Camille GILLOT-25/+27
2021-08-28Mmap the incremental data instead of reading it.Camille GILLOT-5/+10
2021-08-27Note that trait aliases cannot be recursiveNoah Lev-0/+4
2021-08-27Note that type aliases cannot be recursiveNoah Lev-1/+39
2021-08-26shrink `ty::PredicateKind` againlcnr-1/+1
2021-08-26use `ty::Unevaluated` instead of def substs pairlcnr-8/+3
2021-08-18Fold `vtable_trait_upcasting_coercion_new_vptr_slot` logic into obligation ↵Charles Lew-0/+10
processing.
2021-08-03Implement pointer casting.Charles Lew-0/+10
2021-07-25Create `QuerySideEffects` and use it for diagnosticsAaron Hill-58/+49
2021-07-20Support HIR wf checking for function signaturesAaron Hill-2/+2
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-6/+5
2021-07-18Move OnDiskCache to rustc_query_impl.Camille GILLOT-36/+1245
2021-07-16Add initial implementation of HIR-based WF checking for diagnosticsAaron Hill-0/+12
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-06Correct comments about untracked accesses.Camille GILLOT-1/+1
2021-06-15Auto merge of #85154 - cjgillot:lessfn, r=bjorn3bors-79/+114
Reduce amount of function pointers in query invocation. r? `@ghost`
2021-06-04Rollup merge of #85850 - bjorn3:less_feature_gates, r=jyn514Yuki Okushi-4/+0
Remove unused feature gates The first commit removes a usage of a feature gate, but I don't expect it to be controversial as the feature gate was only used to workaround a limitation of rust in the past. (closures never being `Clone`) The second commit uses `#[allow_internal_unstable]` to avoid leaking the `trusted_step` feature gate usage from inside the index newtype macro. It didn't work for the `min_specialization` feature gate though. The third commit removes (almost) all feature gates from the compiler that weren't used anyway.
2021-06-02Restrict access to crate_name.Camille GILLOT-1/+1
Also remove original_crate_name, which had the exact same implementation
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-2/+2
2021-06-01Auto merge of #85153 - cjgillot:qresolve, r=Aaron1011bors-2/+2
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-31Remove unused feature gatesbjorn3-4/+0
2021-05-31Auto merge of #85266 - cjgillot:hir-dep-clean, r=michaelwoeristerbors-34/+1
Remove obsolete workaround. The regression test for #62649 appears to pass even without the workaround.
2021-05-30Correct comments about untracked accesses.Camille GILLOT-1/+1
2021-05-30Restrict access to crate_name.Camille GILLOT-1/+1
Also remove original_crate_name, which had the exact same implementation
2021-05-30Only test if key is local.Camille GILLOT-76/+110
2021-05-30Reduce amount of function pointers.Camille GILLOT-4/+5
2021-05-30Auto merge of #85319 - cjgillot:query-simp, r=Mark-Simulacrumbors-20/+4
Simplification of query forcing Extracted from #78780
2021-05-27Remove obsolete workaround.Camille GILLOT-34/+1
2021-05-15Remove def_path_str.Camille GILLOT-5/+2
2021-05-15Move key recovering into force_query.Camille GILLOT-15/+2
2021-05-12Use () in dependency_formats.Camille GILLOT-0/+10
2021-05-01Apply `--cfg parallel_compiler` when documentingJoshua Nelson-6/+4
This also reverts commit 9823c2cc700fea541bf2670fcee93af662b63022 working around the bug.
2021-04-29Move iter_results to dyn FnMut rather than a genericMark Rousskov-14/+14
This means that we're no longer generating the iteration/locking code for each invocation site of iter_results, rather just once per query. This is a 15% win in instruction counts when compiling the rustc_query_impl crate.
2021-04-12Introduce CompileMonoItem DepNodebjorn3-0/+5
2021-04-02Auto merge of #83207 - oli-obk:valtree2, r=lcnrbors-0/+9
normalize mir::Constant differently from ty::Const in preparation for valtrees Valtrees are unable to represent many kind of constant values (this is on purpose). For constants that are used at runtime, we do not need a valtree representation and can thus use a different form of evaluation. In order to make this explicit and less fragile, I added a `fold_constant` method to `TypeFolder` and implemented it for normalization. Normalization can now, when it wants to eagerly evaluate a constant, normalize `mir::Constant` directly into a `mir::ConstantKind::Val` instead of relying on the `ty::Const` evaluation. In the future we can get rid of the `ty::Const` in there entirely and add our own `Unevaluated` variant to `mir::ConstantKind`. This would allow us to remove the `promoted` field from `ty::ConstKind::Unevaluated`, as promoteds can never occur in the type system. cc `@rust-lang/wg-const-eval` r? `@lcnr`
2021-03-31Add a new normalization query just for mir constantsOli Scherer-0/+9
2021-03-30Stream the dep-graph to a file.Camille GILLOT-4/+1
2021-03-29Don't duplicate the extern providers once for each cratebjorn3-15/+13
2021-03-12Implement valtreeOli Scherer-0/+9
valtree is a version of constants that is inherently safe to be used within types. This is in contrast to ty::Const which can have different representations of the same value. These representation differences can show up in hashing or equality comparisons, breaking type equality of otherwise equal types. valtrees do not have this problem.
2021-02-21Simplify hashing.Camille GILLOT-2/+2