rust/compiler
Matthias Krüger cf7041186c
Rollup merge of #93064 - Aaron1011:provisional-dep-node, r=michaelwoerister
Properly track `DepNode`s in trait evaluation provisional cache

Fixes #92987

During evaluation of an auto trait predicate, we may encounter a cycle.
This causes us to store the evaluation result in a special 'provisional
cache;. If we later end up determining that the type can legitimately
implement the auto trait despite the cycle, we remove the entry from
the provisional cache, and insert it into the evaluation cache.

Additionally, trait evaluation creates a special anonymous `DepNode`.
All queries invoked during the predicate evaluation are added as
outoging dependency edges from the `DepNode`. This `DepNode` is then
store in the evaluation cache - if a different query ends up reading
from the cache entry, it will also perform a read of the stored
`DepNode`. As a result, the cached evaluation will still end up
(transitively) incurring all of the same dependencies that it would
if it actually performed the uncached evaluation (e.g. a call to
`type_of` to determine constituent types).

Previously, we did not correctly handle the interaction between the
provisional cache and the created `DepNode`. Storing an evaluation
result in the provisional cache would cause us to lose the `DepNode`
created during the evaluation. If we later moved the entry from the
provisional cache to the evaluation cache, we would use the `DepNode`
associated with the evaluation that caused us to 'complete' the cycle,
not the evaluatoon where we first discovered the cycle. As a result,
future reads from the evaluation cache would miss some incremental
compilation dependencies that would have otherwise been added if the
evaluation was *not* cached.

Under the right circumstances, this could lead to us trying to force
a query with a no-longer-existing `DefPathHash`, since we were missing
the (red) dependency edge that would have caused us to bail out before
attempting forcing.

This commit makes the provisional cache store the `DepNode` create
during the provisional evaluation. When we move an entry from the
provisional cache to the evaluation cache, we create a *new* `DepNode`
that has dependencies going to *both* of the evaluation `DepNodes` we
have available. This ensures that cached reads will incur all of
the necessary dependency edges.
2022-01-25 05:51:10 +01:00
..
rustc Remove useless #[global_allocator] from rustc and rustdoc. 2021-12-23 17:23:21 +11:00
rustc_apfloat Stabilize iter::zip. 2021-12-14 18:50:31 -04:00
rustc_arena Add some comments. 2021-11-19 07:52:59 +11:00
rustc_ast Make Decodable and Decoder infallible. 2022-01-22 10:38:31 +11:00
rustc_ast_lowering Rollup merge of #93103 - estebank:await-span, r=nagisa 2022-01-23 01:09:43 +01:00
rustc_ast_passes Auto merge of #92896 - lqd:update-deps, r=Mark-Simulacrum 2022-01-21 10:38:30 +00:00
rustc_ast_pretty Deduplicate branches of print_break implementation 2022-01-19 19:04:36 -08:00
rustc_attr Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
rustc_borrowck Normalize field access types during borrowck 2022-01-22 20:05:05 -08:00
rustc_builtin_macros Fix comment about spans during borrowck per PR 91359 review 2022-01-17 10:38:30 -08:00
rustc_codegen_cranelift Use an indexmap to avoid sorting LocalDefIds 2022-01-22 22:34:16 -06:00
rustc_codegen_gcc Add preliminary support for inline assembly for msp430. 2022-01-22 23:42:46 -05:00
rustc_codegen_llvm Add preliminary support for inline assembly for msp430. 2022-01-22 23:42:46 -05:00
rustc_codegen_ssa Rollup merge of #92828 - Amanieu:unwind-abort, r=dtolnay 2022-01-22 15:32:49 +01:00
rustc_const_eval Auto merge of #93028 - compiler-errors:const_drop_bounds, r=fee1-dead 2022-01-24 08:05:37 +00:00
rustc_data_structures Auto merge of #90842 - pierwill:localdefid-indexmap, r=wesleywiser 2022-01-24 22:04:55 +00:00
rustc_driver Make Decodable and Decoder infallible. 2022-01-22 10:38:31 +11:00
rustc_error_codes Reject unsupported naked functions 2022-01-21 17:38:21 +01:00
rustc_errors Rollup merge of #93229 - mark-i-m:noquiet, r=eddyb 2022-01-23 20:13:07 +01:00
rustc_expand expand: Pass everything by reference to pre-expansion lint callback 2022-01-23 19:31:32 +08:00
rustc_feature Formally implement let chains 2022-01-18 19:38:17 -03:00
rustc_fs_util Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_graphviz eplace usages of vec![].into_iter with [].into_iter 2022-01-09 14:09:25 +11:00
rustc_hir Rollup merge of #92828 - Amanieu:unwind-abort, r=dtolnay 2022-01-22 15:32:49 +01:00
rustc_hir_pretty Remove a span from hir::ExprKind::MethodCall 2022-01-21 07:48:10 -06:00
rustc_incremental Make Decodable and Decoder infallible. 2022-01-22 10:38:31 +11:00
rustc_index Make Decodable and Decoder infallible. 2022-01-22 10:38:31 +11:00
rustc_infer Remove a span from hir::ExprKind::MethodCall 2022-01-21 07:48:10 -06:00
rustc_interface expand: Pass everything by reference to pre-expansion lint callback 2022-01-23 19:31:32 +08:00
rustc_lexer Auto merge of #91393 - Julian-Wollersberger:lexer_optimization, r=petrochenkov 2021-12-03 13:20:14 +00:00
rustc_lint rustc_lint: Stop creating a fake ast::Crate for running early lints 2022-01-23 19:31:32 +08:00
rustc_lint_defs Reject unsupported naked functions 2022-01-21 17:38:21 +01:00
rustc_llvm Remove LLVMRustMarkAllFunctionsNounwind 2022-01-14 00:36:12 +00:00
rustc_log Make rustc_log doc test runnable 2022-01-03 22:31:56 -08:00
rustc_macros Make Decodable and Decoder infallible. 2022-01-22 10:38:31 +11:00
rustc_metadata Auto merge of #90842 - pierwill:localdefid-indexmap, r=wesleywiser 2022-01-24 22:04:55 +00:00
rustc_middle Auto merge of #90842 - pierwill:localdefid-indexmap, r=wesleywiser 2022-01-24 22:04:55 +00:00
rustc_mir_build Rollup merge of #93046 - est31:let_else, r=davidtwco 2022-01-21 22:03:17 +01:00
rustc_mir_dataflow Remove deprecated LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
rustc_mir_transform Auto merge of #90842 - pierwill:localdefid-indexmap, r=wesleywiser 2022-01-24 22:04:55 +00:00
rustc_monomorphize Change TerminatorKind::Abort to call the panic handler instead of 2022-01-17 00:39:34 +00:00
rustc_parse Fix let_chains and if_let_guard feature flags 2022-01-22 17:45:45 -03:00
rustc_parse_format Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_passes Reject unsupported naked functions 2022-01-21 17:38:21 +01:00
rustc_plugin_impl replace dynamic library module with libloading 2021-12-06 12:03:47 -05:00
rustc_privacy Remove a span from hir::ExprKind::MethodCall 2022-01-21 07:48:10 -06:00
rustc_query_impl Make Decodable and Decoder infallible. 2022-01-22 10:38:31 +11:00
rustc_query_system Address review comments. 2022-01-22 10:38:34 +11:00
rustc_resolve rustc_lint: Reuse the set of registered tools from resolver 2022-01-23 18:51:51 +08:00
rustc_save_analysis Remove a span from hir::ExprKind::MethodCall 2022-01-21 07:48:10 -06:00
rustc_serialize Auto merge of #90842 - pierwill:localdefid-indexmap, r=wesleywiser 2022-01-24 22:04:55 +00:00
rustc_session Rollup merge of #93229 - mark-i-m:noquiet, r=eddyb 2022-01-23 20:13:07 +01:00
rustc_span Auto merge of #93066 - nnethercote:infallible-decoder, r=bjorn3 2022-01-23 15:37:43 +00:00
rustc_symbol_mangling Rollup merge of #92316 - petrochenkov:extmangle, r=wesleywiser 2022-01-19 19:19:45 +01:00
rustc_target Add preliminary support for inline assembly for msp430. 2022-01-22 23:42:46 -05:00
rustc_trait_selection Rollup merge of #93064 - Aaron1011:provisional-dep-node, r=michaelwoerister 2022-01-25 05:51:10 +01:00
rustc_traits ⬆ chalk to 0.76.0 2022-01-19 13:44:43 -06:00
rustc_ty_utils Auto merge of #92805 - BoxyUwU:revert-lazy-anon-const-substs, r=lcnr 2022-01-16 11:19:21 +00:00
rustc_type_ir initial revert 2022-01-15 01:16:55 +00:00
rustc_typeck Auto merge of #93028 - compiler-errors:const_drop_bounds, r=fee1-dead 2022-01-24 08:05:37 +00:00