diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-06 21:26:52 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-06 21:26:52 +0100 |
commit | 31d2b3b9cb75a09c93655b38377ed5f4144ebaf0 (patch) | |
tree | 19614f79db1cb180c05bbdb725e85381c7846682 /crates/hir_def/src/lib.rs | |
parent | 1643d1534b92eef1cf55631aba3ca9289c3cea72 (diff) | |
parent | 035d84558cb777806d8c02234051843194459aee (diff) |
Merge #8386
8386: Avoid O(n²) when constructing AttrSourceMap r=jonas-schievink a=jonas-schievink
Brings https://github.com/rust-analyzer/rust-analyzer/issues/8377 down to 2.52s on my machine. Not quite back to where it was before, so I'll leave that issue open for now.
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_def/src/lib.rs')
-rw-r--r-- | crates/hir_def/src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs index abd6c553f..e2af0e514 100644 --- a/crates/hir_def/src/lib.rs +++ b/crates/hir_def/src/lib.rs | |||
@@ -453,6 +453,14 @@ impl VariantId { | |||
453 | } | 453 | } |
454 | } | 454 | } |
455 | } | 455 | } |
456 | |||
457 | pub fn file_id(self, db: &dyn db::DefDatabase) -> HirFileId { | ||
458 | match self { | ||
459 | VariantId::EnumVariantId(it) => it.parent.lookup(db).id.file_id(), | ||
460 | VariantId::StructId(it) => it.lookup(db).id.file_id(), | ||
461 | VariantId::UnionId(it) => it.lookup(db).id.file_id(), | ||
462 | } | ||
463 | } | ||
456 | } | 464 | } |
457 | 465 | ||
458 | trait Intern { | 466 | trait Intern { |