Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/static_index.rs')
| -rw-r--r-- | crates/ide/src/static_index.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/ide/src/static_index.rs b/crates/ide/src/static_index.rs index 52b201df96..0cf2e15bc6 100644 --- a/crates/ide/src/static_index.rs +++ b/crates/ide/src/static_index.rs @@ -10,7 +10,6 @@ use ide_db::{ documentation::Documentation, famous_defs::FamousDefs, }; -use span::Edition; use syntax::{AstNode, SyntaxKind::*, SyntaxNode, SyntaxToken, T, TextRange}; use crate::navigation_target::UpmappingResult; @@ -42,7 +41,8 @@ pub struct ReferenceData { #[derive(Debug)] pub struct TokenStaticData { - pub documentation: Option<Documentation>, + // FIXME: Make this have the lifetime of the database. + pub documentation: Option<Documentation<'static>>, pub hover: Option<HoverResult>, /// The position of the token itself. /// @@ -117,7 +117,7 @@ fn documentation_for_definition( sema: &Semantics<'_, RootDatabase>, def: Definition, scope_node: &SyntaxNode, -) -> Option<Documentation> { +) -> Option<Documentation<'static>> { let famous_defs = match &def { Definition::BuiltinType(_) => Some(FamousDefs(sema, sema.scope(scope_node)?.krate())), _ => None, @@ -132,6 +132,7 @@ fn documentation_for_definition( }) .to_display_target(sema.db), ) + .map(Documentation::into_owned) } // FIXME: This is a weird function @@ -202,10 +203,7 @@ impl StaticIndex<'_> { // hovers let sema = hir::Semantics::new(self.db); let root = sema.parse_guess_edition(file_id).syntax().clone(); - let edition = sema - .attach_first_edition(file_id) - .map(|it| it.edition(self.db)) - .unwrap_or(Edition::CURRENT); + let edition = sema.attach_first_edition(file_id).edition(sema.db); let display_target = match sema.first_crate(file_id) { Some(krate) => krate.to_display_target(sema.db), None => return, |