impl ConstData {
pub(crate) fn const_data_query(db: &impl DefDatabase, konst: ConstId) -> Arc<ConstData> {
let node = konst.lookup(db).source(db).value;
- const_data_for(&node)
+ Arc::new(ConstData::new(&node))
}
pub(crate) fn static_data_query(db: &impl DefDatabase, konst: StaticId) -> Arc<ConstData> {
let node = konst.lookup(db).source(db).value;
- const_data_for(&node)
+ Arc::new(ConstData::new(&node))
}
-}
-fn const_data_for<N: NameOwner + TypeAscriptionOwner>(node: &N) -> Arc<ConstData> {
- let name = node.name().map(|n| n.as_name());
- let type_ref = TypeRef::from_ast_opt(node.ascribed_type());
- let sig = ConstData { name, type_ref };
- Arc::new(sig)
+ fn new<N: NameOwner + TypeAscriptionOwner>(node: &N) -> ConstData {
+ let name = node.name().map(|n| n.as_name());
+ let type_ref = TypeRef::from_ast_opt(node.ascribed_type());
+ ConstData { name, type_ref }
+ }
}
-//! FIXME: write short doc here
+//! Defines hir documentation.
+//!
+//! This really shouldn't exist, instead, we should deshugar doc comments into attributes, see
+//! https://github.com/rust-analyzer/rust-analyzer/issues/2148#issuecomment-550519102
use std::sync::Arc;
-//! FIXME: write short doc here
+//! Lowers syntax tree of a rust file into a raw representation of containing
+//! items, *without* attaching them to a module structure.
+//!
+//! That is, raw items don't have semantics, just as syntax, but, unlike syntax,
+//! they don't change with trivial source code edits, making them a great tool
+//! for building salsa recomputation firewalls.
use std::{ops::Index, sync::Arc};
-//! FIXME: write short doc here
+//! A desugared representation of paths like `crate::foo` or `<Type as Trait>::bar`.
use std::{iter, sync::Arc};