mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 23:25:03 +00:00
Migrate trait & type to new ids
This commit is contained in:
parent
00ba70a095
commit
0f2f3a21e7
13 changed files with 104 additions and 186 deletions
|
@ -1,18 +1,3 @@
|
|||
mod krate; // `crate` is invalid ident :(
|
||||
mod module;
|
||||
pub(crate) mod function;
|
||||
|
||||
use ra_syntax::{AstNode, TreeArc};
|
||||
|
||||
use crate::{HirDatabase, DefId, HirFileId};
|
||||
|
||||
pub(crate) fn def_id_to_ast<N: AstNode>(
|
||||
db: &impl HirDatabase,
|
||||
def_id: DefId,
|
||||
) -> (HirFileId, TreeArc<N>) {
|
||||
let (file_id, syntax) = def_id.source(db);
|
||||
let ast = N::cast(&syntax)
|
||||
.unwrap_or_else(|| panic!("def points to wrong source {:?} {:?}", def_id, syntax))
|
||||
.to_owned();
|
||||
(file_id, ast)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue