Auto merge of #85154 - cjgillot:lessfn, r=bjorn3
Reduce amount of function pointers in query invocation. r? `@ghost`
This commit is contained in:
commit
12d0849f9d
5 changed files with 167 additions and 114 deletions
|
@ -353,14 +353,14 @@ macro_rules! define_queries {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn compute(tcx: QueryCtxt<'tcx>, key: Self::Key) -> Self::Value {
|
||||
let is_local = key.query_crate() == LOCAL_CRATE;
|
||||
let provider = if is_local {
|
||||
fn compute_fn(tcx: QueryCtxt<'tcx>, key: &Self::Key) ->
|
||||
fn(TyCtxt<'tcx>, Self::Key) -> Self::Value
|
||||
{
|
||||
if key.query_crate_is_local() {
|
||||
tcx.queries.local_providers.$name
|
||||
} else {
|
||||
tcx.queries.extern_providers.$name
|
||||
};
|
||||
provider(*tcx, key)
|
||||
}
|
||||
}
|
||||
|
||||
fn hash_result(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue