]> git.lizzy.rs Git - rust.git/commitdiff
Some docs
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 24 Nov 2019 14:34:36 +0000 (17:34 +0300)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Sun, 24 Nov 2019 14:36:06 +0000 (17:36 +0300)
crates/ra_hir_def/src/data.rs
crates/ra_hir_def/src/docs.rs
crates/ra_hir_def/src/nameres/raw.rs
crates/ra_hir_def/src/path.rs

index 81a8ec18db1b38cb7254a25b061c792a0a9f67ee..68bea34df7c8e83b9dd4e1f691878581f4b6a2ea 100644 (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 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 }
+    }
 }
index 225511428871e15a03877734c23f76f601c71775..90a8627bc6911990d1211d0c2fc5e685fa0cf02d 100644 (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;
 
index 19857875381d99091d92913759023719e517dd59..2ec84f2cc9ff0c7d32c793217699ef406aa54b1a 100644 (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};
 
index 94f6a27bc43fdf8afe94fccff3a80c25256935ba..7b2723d5716035b31d881b30fa05c78ce6f0051b 100644 (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};