diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-04-08 17:03:34 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-02-19 17:51:50 +0100 |
| commit | 2db2776589eced747c35e030aa185f3a4fc93ffa (patch) | |
| tree | 2bebd6d88cde010752a82f7aa9160f1a2e3fd525 /compiler/rustc_macros | |
| parent | dab9b89221472d36fb5375d0c474c794706d2ae8 (diff) | |
| download | rust-2db2776589eced747c35e030aa185f3a4fc93ffa.tar.gz rust-2db2776589eced747c35e030aa185f3a4fc93ffa.zip | |
Wrap TyCtxt inside a QueryCtxt for queries.
Diffstat (limited to 'compiler/rustc_macros')
| -rw-r--r-- | compiler/rustc_macros/src/query.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/compiler/rustc_macros/src/query.rs b/compiler/rustc_macros/src/query.rs index 48b74bdaf1e..1ac71824faf 100644 --- a/compiler/rustc_macros/src/query.rs +++ b/compiler/rustc_macros/src/query.rs @@ -354,9 +354,10 @@ fn add_query_description_impl( quote! { #[inline] fn try_load_from_disk( - #tcx: TyCtxt<'tcx>, - #id: SerializedDepNodeIndex + tcx: QueryCtxt<'tcx>, + id: SerializedDepNodeIndex ) -> Option<Self::Value> { + let (#tcx, #id) = (*tcx, id); #block } } @@ -365,10 +366,10 @@ fn add_query_description_impl( quote! { #[inline] fn try_load_from_disk( - tcx: TyCtxt<'tcx>, + tcx: QueryCtxt<'tcx>, id: SerializedDepNodeIndex ) -> Option<Self::Value> { - tcx.on_disk_cache.as_ref()?.try_load_query_result(tcx, id) + tcx.on_disk_cache.as_ref()?.try_load_query_result(*tcx, id) } } }; @@ -393,10 +394,11 @@ fn add_query_description_impl( #[inline] #[allow(unused_variables, unused_braces)] fn cache_on_disk( - #tcx: TyCtxt<'tcx>, - #key: &Self::Key, - #value: Option<&Self::Value> + tcx: QueryCtxt<'tcx>, + key: &Self::Key, + value: Option<&Self::Value> ) -> bool { + let (#tcx, #key, #value) = (*tcx, key, value); #expr } @@ -414,16 +416,14 @@ fn add_query_description_impl( let desc = quote! { #[allow(unused_variables)] - fn describe( - #tcx: TyCtxt<'tcx>, - #key: #arg, - ) -> String { - ::rustc_middle::ty::print::with_no_trimmed_paths(|| format!(#desc)) + fn describe(tcx: QueryCtxt<'tcx>, key: #arg) -> String { + let (#tcx, #key) = (*tcx, key); + ::rustc_middle::ty::print::with_no_trimmed_paths(|| format!(#desc).into()) } }; impls.extend(quote! { - impl<'tcx> QueryDescription<TyCtxt<'tcx>> for queries::#name<'tcx> { + impl<'tcx> QueryDescription<QueryCtxt<'tcx>> for queries::#name<'tcx> { #desc #cache } |
