Some docs

This commit is contained in:
Aleksey Kladov 2019-11-24 17:34:36 +03:00
parent 99af523b68
commit 21cfa6d529
4 changed files with 19 additions and 12 deletions

View file

@ -200,18 +200,17 @@ pub struct ConstData {
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 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 }
}
}
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)
}

View file

@ -1,4 +1,7 @@
//! 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;

View file

@ -1,4 +1,9 @@
//! 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};

View file

@ -1,4 +1,4 @@
//! FIXME: write short doc here
//! A desugared representation of paths like `crate::foo` or `<Type as Trait>::bar`.
use std::{iter, sync::Arc};