Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Introduce SingletonCache for use with ZST query keys #86119

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Avoid ambiguity by always using parens for query modifiers"
This reverts commit a03cf1b.
  • Loading branch information
Aaron1011 committed Jun 7, 2021
commit 86edc29150db89f2da8328ecac57e374fda28f8d
10 changes: 5 additions & 5 deletions compiler/rustc_macros/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,27 +455,27 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {

// Pass on the fatal_cycle modifier
if modifiers.fatal_cycle {
attributes.push(quote! { fatal_cycle() });
attributes.push(quote! { fatal_cycle });
};
// Pass on the storage modifier
if let Some(ref ty) = modifiers.storage {
attributes.push(quote! { storage(#ty) });
};
// Pass on the cycle_delay_bug modifier
if modifiers.cycle_delay_bug {
attributes.push(quote! { cycle_delay_bug() });
attributes.push(quote! { cycle_delay_bug });
};
// Pass on the no_hash modifier
if modifiers.no_hash {
attributes.push(quote! { no_hash() });
attributes.push(quote! { no_hash });
};
// Pass on the anon modifier
if modifiers.anon {
attributes.push(quote! { anon() });
attributes.push(quote! { anon });
};
// Pass on the eval_always modifier
if modifiers.eval_always {
attributes.push(quote! { eval_always() });
attributes.push(quote! { eval_always });
};

let attribute_stream = quote! {#(#attributes),*};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/ty/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ macro_rules! query_storage {
([storage($ty:ty) $($rest:tt)*][$K:ty, $V:ty]) => {
<$ty as CacheSelector<$K, $V>>::Cache
};
([$other:ident ($($other_args:tt)*) $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
query_storage!([$($($modifiers)*)*][$($args)*])
};
}
Expand Down
18 changes: 9 additions & 9 deletions compiler/rustc_query_impl/src/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,16 @@ macro_rules! handle_cycle_error {
$error.emit();
Value::from_cycle_error($tcx)
}};
([fatal_cycle() $($rest:tt)*][$tcx:expr, $error:expr]) => {{
([fatal_cycle $($rest:tt)*][$tcx:expr, $error:expr]) => {{
$error.emit();
$tcx.sess.abort_if_errors();
unreachable!()
}};
([cycle_delay_bug() $($rest:tt)*][$tcx:expr, $error:expr]) => {{
([cycle_delay_bug $($rest:tt)*][$tcx:expr, $error:expr]) => {{
$error.delay_as_bug();
Value::from_cycle_error($tcx)
}};
([$other:ident ($($other_args:tt)*) $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
handle_cycle_error!([$($($modifiers)*)*][$($args)*])
};
}
Expand All @@ -237,10 +237,10 @@ macro_rules! is_anon {
([]) => {{
false
}};
([anon() $($rest:tt)*]) => {{
([anon $($rest:tt)*]) => {{
true
}};
([$other:ident ($($other_args:tt)*) $(, $($modifiers:tt)*)*]) => {
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*]) => {
is_anon!([$($($modifiers)*)*])
};
}
Expand All @@ -249,10 +249,10 @@ macro_rules! is_eval_always {
([]) => {{
false
}};
([eval_always() $($rest:tt)*]) => {{
([eval_always $($rest:tt)*]) => {{
true
}};
([$other:ident ($($other_args:tt)*) $(, $($modifiers:tt)*)*]) => {
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*]) => {
is_eval_always!([$($($modifiers)*)*])
};
}
Expand All @@ -261,10 +261,10 @@ macro_rules! hash_result {
([][$hcx:expr, $result:expr]) => {{
dep_graph::hash_result($hcx, &$result)
}};
([no_hash() $($rest:tt)*][$hcx:expr, $result:expr]) => {{
([no_hash $($rest:tt)*][$hcx:expr, $result:expr]) => {{
None
}};
([$other:ident ($($other_args:tt)*) $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
([$other:ident $(($($other_args:tt)*))* $(, $($modifiers:tt)*)*][$($args:tt)*]) => {
hash_result!([$($($modifiers)*)*][$($args)*])
};
}
Expand Down