mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-10 15:14:32 +00:00
profile type inference
This commit is contained in:
parent
0f3e85002b
commit
f63be06002
4 changed files with 6 additions and 3 deletions
|
@ -126,7 +126,7 @@ pub trait HirDatabase: DefDatabase {
|
|||
#[salsa::invoke(ExprScopes::expr_scopes_query)]
|
||||
fn expr_scopes(&self, def: DefWithBody) -> Arc<ExprScopes>;
|
||||
|
||||
#[salsa::invoke(crate::ty::infer)]
|
||||
#[salsa::invoke(crate::ty::infer_query)]
|
||||
fn infer(&self, def: DefWithBody) -> Arc<InferenceResult>;
|
||||
|
||||
#[salsa::invoke(crate::ty::type_for_def)]
|
||||
|
|
|
@ -20,7 +20,7 @@ use crate::{Name, AdtDef, type_ref::Mutability, db::HirDatabase, Trait, GenericP
|
|||
use display::{HirDisplay, HirFormatter};
|
||||
|
||||
pub(crate) use lower::{TypableDef, type_for_def, type_for_field, callable_item_sig, generic_predicates, generic_defaults};
|
||||
pub(crate) use infer::{infer, InferenceResult, InferTy};
|
||||
pub(crate) use infer::{infer_query, InferenceResult, InferTy};
|
||||
pub use lower::CallableDef;
|
||||
|
||||
/// A type constructor or type name: this might be something like the primitive
|
||||
|
|
|
@ -23,6 +23,7 @@ use ena::unify::{InPlaceUnificationTable, UnifyKey, UnifyValue, NoError};
|
|||
use rustc_hash::FxHashMap;
|
||||
|
||||
use ra_arena::map::ArenaMap;
|
||||
use ra_prof::profile;
|
||||
use test_utils::tested_by;
|
||||
|
||||
use crate::{
|
||||
|
@ -51,7 +52,8 @@ use super::{
|
|||
mod unify;
|
||||
|
||||
/// The entry point of type inference.
|
||||
pub fn infer(db: &impl HirDatabase, def: DefWithBody) -> Arc<InferenceResult> {
|
||||
pub fn infer_query(db: &impl HirDatabase, def: DefWithBody) -> Arc<InferenceResult> {
|
||||
let _p = profile("infer_query");
|
||||
db.check_canceled();
|
||||
let body = def.body(db);
|
||||
let resolver = def.resolver(db);
|
||||
|
|
|
@ -198,6 +198,7 @@ fn print(lvl: usize, msgs: &[Message], out: &mut impl Write) {
|
|||
if l != lvl {
|
||||
continue;
|
||||
}
|
||||
|
||||
writeln!(out, "{} {:6}ms - {}", indent, dur.as_millis(), msg)
|
||||
.expect("printing profiling info to stdout");
|
||||
|
||||
|
|
Loading…
Reference in a new issue