Reduce amount of function pointers.

This commit is contained in:
Camille GILLOT 2021-05-10 19:09:30 +02:00
parent f60a670256
commit fd318a2f9b
3 changed files with 58 additions and 39 deletions

View file

@ -386,14 +386,15 @@ macro_rules! define_queries {
}
#[inline]
fn compute(tcx: QueryCtxt<'tcx>, key: Self::Key) -> Self::Value {
fn compute_fn(tcx: QueryCtxt<'tcx>, key: &Self::Key) ->
fn(TyCtxt<'tcx>, Self::Key) -> Self::Value
{
let is_local = key.query_crate() == LOCAL_CRATE;
let provider = if is_local {
if is_local {
tcx.queries.local_providers.$name
} else {
tcx.queries.extern_providers.$name
};
provider(*tcx, key)
}
}
fn hash_result(