aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-12 11:15:29 +0100
committerGitHub <[email protected]>2019-09-12 11:15:29 +0100
commitdfcbdcb9a3a329686eedfc18518c675a6f80f338 (patch)
treeb738581d1baeb82537f6481921e9c1a9cfb5db33 /crates/ra_hir
parentfd9e6c649f9428881921dfcd4cc7af05d1df5440 (diff)
parent0ffd1fdbe4a7dd8707cb7eaf31c15dcd1d4fb101 (diff)
Merge #1827
1827: fix panic when fetching generics r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/impl_block.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 162ab02b1..d26a024ed 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -4,7 +4,7 @@ use std::sync::Arc;
4use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; 4use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId};
5use ra_syntax::{ 5use ra_syntax::{
6 ast::{self, AstNode}, 6 ast::{self, AstNode},
7 AstPtr, SourceFile, 7 AstPtr,
8}; 8};
9 9
10use crate::{ 10use crate::{
@@ -29,12 +29,12 @@ impl ImplSourceMap {
29 } 29 }
30 30
31 pub fn get(&self, source: &ModuleSource, impl_id: ImplId) -> ast::ImplBlock { 31 pub fn get(&self, source: &ModuleSource, impl_id: ImplId) -> ast::ImplBlock {
32 let file = match source { 32 let root = match source {
33 ModuleSource::SourceFile(file) => file.clone(), 33 ModuleSource::SourceFile(file) => file.syntax().clone(),
34 ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(), 34 ModuleSource::Module(m) => m.syntax().ancestors().last().unwrap(),
35 }; 35 };
36 36
37 self.map[impl_id].to_node(file.syntax()).to_owned() 37 self.map[impl_id].to_node(&root)
38 } 38 }
39} 39}
40 40