mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-22 11:53:44 +00:00
Make ExpOrPatId private
This commit is contained in:
parent
79f61dcb0e
commit
1578375b89
@ -56,7 +56,7 @@ pub fn infer(db: &impl HirDatabase, func: Function) -> Arc<InferenceResult> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
|
||||||
pub enum ExprOrPatId {
|
enum ExprOrPatId {
|
||||||
Expr(ExprId),
|
Expr(ExprId),
|
||||||
Pat(PatId),
|
Pat(PatId),
|
||||||
}
|
}
|
||||||
@ -93,8 +93,11 @@ impl InferenceResult {
|
|||||||
pub fn field_resolution(&self, expr: ExprId) -> Option<StructField> {
|
pub fn field_resolution(&self, expr: ExprId) -> Option<StructField> {
|
||||||
self.field_resolutions.get(&expr).map(|it| *it)
|
self.field_resolutions.get(&expr).map(|it| *it)
|
||||||
}
|
}
|
||||||
pub fn assoc_resolutions(&self, id: ExprOrPatId) -> Option<ImplItem> {
|
pub fn assoc_resolutions_for_expr(&self, id: ExprId) -> Option<ImplItem> {
|
||||||
self.assoc_resolutions.get(&id).map(|it| *it)
|
self.assoc_resolutions.get(&id.into()).map(|it| *it)
|
||||||
|
}
|
||||||
|
pub fn assoc_resolutions_for_pat(&self, id: PatId) -> Option<ImplItem> {
|
||||||
|
self.assoc_resolutions.get(&id.into()).map(|it| *it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ pub(crate) fn reference_definition(
|
|||||||
|
|
||||||
if let Some(res) = source_map
|
if let Some(res) = source_map
|
||||||
.node_expr(expr)
|
.node_expr(expr)
|
||||||
.and_then(|it| infer_result.assoc_resolutions(it.into()))
|
.and_then(|it| infer_result.assoc_resolutions_for_expr(it.into()))
|
||||||
{
|
{
|
||||||
return Exact(NavigationTarget::from_impl_item(db, res));
|
return Exact(NavigationTarget::from_impl_item(db, res));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user