Skip to content

try and simplify some things in the query system #100436

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

Merged
merged 4 commits into from
Aug 25, 2022
Merged
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
get rid of another unnecessary lifetime macro argument
  • Loading branch information
jyn514 committed Aug 24, 2022
commit e188868014da60bc266024e60c914b532445c743
24 changes: 12 additions & 12 deletions compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ impl ProcessQueryValue<'_, Option<DeprecationEntry>> for Option<Deprecation> {
}

macro_rules! provide_one {
(<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $name:ident => { table }) => {
($tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $name:ident => { table }) => {
provide_one! {
<$lt> $tcx, $def_id, $other, $cdata, $name => {
$tcx, $def_id, $other, $cdata, $name => {
$cdata
.root
.tables
Expand All @@ -89,9 +89,9 @@ macro_rules! provide_one {
}
}
};
(<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $name:ident => { table_direct }) => {
($tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $name:ident => { table_direct }) => {
provide_one! {
<$lt> $tcx, $def_id, $other, $cdata, $name => {
$tcx, $def_id, $other, $cdata, $name => {
// We don't decode `table_direct`, since it's not a Lazy, but an actual value
$cdata
.root
Expand All @@ -102,11 +102,11 @@ macro_rules! provide_one {
}
}
};
(<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $name:ident => $compute:block) => {
fn $name<$lt>(
$tcx: TyCtxt<$lt>,
def_id_arg: ty::query::query_keys::$name<$lt>,
) -> ty::query::query_values::$name<$lt> {
($tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $name:ident => $compute:block) => {
fn $name<'tcx>(
$tcx: TyCtxt<'tcx>,
def_id_arg: ty::query::query_keys::$name<'tcx>,
) -> ty::query::query_values::$name<'tcx> {
let _prof_timer =
$tcx.prof.generic_activity(concat!("metadata_decode_entry_", stringify!($name)));

Expand All @@ -130,11 +130,11 @@ macro_rules! provide_one {
}

macro_rules! provide {
(<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident,
($tcx:ident, $def_id:ident, $other:ident, $cdata:ident,
$($name:ident => { $($compute:tt)* })*) => {
pub fn provide_extern(providers: &mut ExternProviders) {
$(provide_one! {
<$lt> $tcx, $def_id, $other, $cdata, $name => { $($compute)* }
$tcx, $def_id, $other, $cdata, $name => { $($compute)* }
})*

*providers = ExternProviders {
Expand Down Expand Up @@ -187,7 +187,7 @@ impl IntoArgs for (CrateNum, SimplifiedType) {
}
}

provide! { <'tcx> tcx, def_id, other, cdata,
provide! { tcx, def_id, other, cdata,
explicit_item_bounds => { table }
explicit_predicates_of => { table }
generics_of => { table }
Expand Down