mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Fix ConstParam HasSource impl and implement TryToNav not Nav
This commit is contained in:
parent
887028fcf5
commit
40cd6cdf67
@ -142,8 +142,8 @@ impl HasSource for LifetimeParam {
|
||||
|
||||
impl HasSource for ConstParam {
|
||||
type Ast = ast::ConstParam;
|
||||
fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> {
|
||||
fn source(self, db: &dyn HirDatabase) -> Option<InFile<Self::Ast>> {
|
||||
let child_source = self.id.parent.child_source(db.upcast());
|
||||
child_source.map(|it| it[self.id.local_id].clone())
|
||||
Some(child_source.map(|it| it[self.id.local_id].clone()))
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ impl TryToNav for Definition {
|
||||
Definition::TypeParam(it) => it.try_to_nav(db),
|
||||
Definition::LifetimeParam(it) => it.try_to_nav(db),
|
||||
Definition::Label(it) => Some(it.to_nav(db)),
|
||||
Definition::ConstParam(it) => Some(it.to_nav(db)),
|
||||
Definition::ConstParam(it) => it.try_to_nav(db),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -479,11 +479,11 @@ impl TryToNav for hir::LifetimeParam {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToNav for hir::ConstParam {
|
||||
fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
|
||||
let src = self.source(db);
|
||||
impl TryToNav for hir::ConstParam {
|
||||
fn try_to_nav(&self, db: &RootDatabase) -> Option<NavigationTarget> {
|
||||
let src = self.source(db)?;
|
||||
let full_range = src.value.syntax().text_range();
|
||||
NavigationTarget {
|
||||
Some(NavigationTarget {
|
||||
file_id: src.file_id.original_file(db),
|
||||
name: self.name(db).to_string().into(),
|
||||
kind: Some(SymbolKind::ConstParam),
|
||||
@ -492,7 +492,7 @@ impl ToNav for hir::ConstParam {
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user