aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorMarcus Klaas de Vries <[email protected]>2019-01-08 23:47:12 +0000
committerMarcus Klaas de Vries <[email protected]>2019-01-09 00:17:09 +0000
commit0b8fbb4fad97d2980f0070a23f5365a5ed887e2a (patch)
tree4e1cd7f26641c65d809e1a0a6943c77ccbe562d5 /crates/ra_hir/src
parentf8261d611a60e99bc188022773f84912972208d2 (diff)
Fix typos in ARCHITECTURE.md and a number of crates
specifically: gen_lsp_server, ra_arena, ra_cli, ra_db, ra_hir
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model_api.rs20
-rw-r--r--crates/ra_hir/src/db.rs3
-rw-r--r--crates/ra_hir/src/expr.rs8
-rw-r--r--crates/ra_hir/src/ids.rs12
-rw-r--r--crates/ra_hir/src/impl_block.rs12
-rw-r--r--crates/ra_hir/src/lib.rs6
-rw-r--r--crates/ra_hir/src/macros.rs6
-rw-r--r--crates/ra_hir/src/module_tree.rs4
-rw-r--r--crates/ra_hir/src/name.rs2
-rw-r--r--crates/ra_hir/src/nameres.rs24
-rw-r--r--crates/ra_hir/src/source_binder.rs2
-rw-r--r--crates/ra_hir/src/ty.rs4
-rw-r--r--crates/ra_hir/src/ty/autoderef.rs2
-rw-r--r--crates/ra_hir/src/ty/tests.rs2
14 files changed, 63 insertions, 44 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 343d06a5b..66c016180 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -13,8 +13,8 @@ use crate::{
13 ty::InferenceResult, 13 ty::InferenceResult,
14}; 14};
15 15
16/// hir::Crate describes a single crate. It's the main inteface with which 16/// hir::Crate describes a single crate. It's the main interface with which
17/// crate's dependencies interact. Mostly, it should be just a proxy for the 17/// a crate's dependencies interact. Mostly, it should be just a proxy for the
18/// root module. 18/// root module.
19#[derive(Debug, Clone, PartialEq, Eq, Hash)] 19#[derive(Debug, Clone, PartialEq, Eq, Hash)]
20pub struct Crate { 20pub struct Crate {
@@ -78,6 +78,7 @@ impl Module {
78 pub fn definition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> { 78 pub fn definition_source(&self, db: &impl HirDatabase) -> Cancelable<(FileId, ModuleSource)> {
79 self.definition_source_impl(db) 79 self.definition_source_impl(db)
80 } 80 }
81
81 /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. 82 /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`.
82 /// `None` for the crate root. 83 /// `None` for the crate root.
83 pub fn declaration_source( 84 pub fn declaration_source(
@@ -91,20 +92,24 @@ impl Module {
91 pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> { 92 pub fn krate(&self, db: &impl HirDatabase) -> Cancelable<Option<Crate>> {
92 self.krate_impl(db) 93 self.krate_impl(db)
93 } 94 }
95
94 /// Topmost parent of this module. Every module has a `crate_root`, but some 96 /// Topmost parent of this module. Every module has a `crate_root`, but some
95 /// might miss `krate`. This can happen if a module's file is not included 97 /// might be missing `krate`. This can happen if a module's file is not included
96 /// into any module tree of any target from Cargo.toml. 98 /// in the module tree of any target in Cargo.toml.
97 pub fn crate_root(&self, db: &impl HirDatabase) -> Cancelable<Module> { 99 pub fn crate_root(&self, db: &impl HirDatabase) -> Cancelable<Module> {
98 self.crate_root_impl(db) 100 self.crate_root_impl(db)
99 } 101 }
102
100 /// Finds a child module with the specified name. 103 /// Finds a child module with the specified name.
101 pub fn child(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> { 104 pub fn child(&self, db: &impl HirDatabase, name: &Name) -> Cancelable<Option<Module>> {
102 self.child_impl(db, name) 105 self.child_impl(db, name)
103 } 106 }
107
104 /// Finds a parent module. 108 /// Finds a parent module.
105 pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> { 109 pub fn parent(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> {
106 self.parent_impl(db) 110 self.parent_impl(db)
107 } 111 }
112
108 pub fn path_to_root(&self, db: &impl HirDatabase) -> Cancelable<Vec<Module>> { 113 pub fn path_to_root(&self, db: &impl HirDatabase) -> Cancelable<Vec<Module>> {
109 let mut res = vec![self.clone()]; 114 let mut res = vec![self.clone()];
110 let mut curr = self.clone(); 115 let mut curr = self.clone();
@@ -114,13 +119,16 @@ impl Module {
114 } 119 }
115 Ok(res) 120 Ok(res)
116 } 121 }
122
117 /// Returns a `ModuleScope`: a set of items, visible in this module. 123 /// Returns a `ModuleScope`: a set of items, visible in this module.
118 pub fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> { 124 pub fn scope(&self, db: &impl HirDatabase) -> Cancelable<ModuleScope> {
119 self.scope_impl(db) 125 self.scope_impl(db)
120 } 126 }
127
121 pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> { 128 pub fn resolve_path(&self, db: &impl HirDatabase, path: &Path) -> Cancelable<PerNs<DefId>> {
122 self.resolve_path_impl(db, path) 129 self.resolve_path_impl(db, path)
123 } 130 }
131
124 pub fn problems( 132 pub fn problems(
125 &self, 133 &self,
126 db: &impl HirDatabase, 134 db: &impl HirDatabase,
@@ -140,6 +148,7 @@ impl StructField {
140 pub fn name(&self) -> &Name { 148 pub fn name(&self) -> &Name {
141 &self.name 149 &self.name
142 } 150 }
151
143 pub fn type_ref(&self) -> &TypeRef { 152 pub fn type_ref(&self) -> &TypeRef {
144 &self.type_ref 153 &self.type_ref
145 } 154 }
@@ -160,18 +169,21 @@ impl VariantData {
160 _ => &[], 169 _ => &[],
161 } 170 }
162 } 171 }
172
163 pub fn is_struct(&self) -> bool { 173 pub fn is_struct(&self) -> bool {
164 match self { 174 match self {
165 VariantData::Struct(..) => true, 175 VariantData::Struct(..) => true,
166 _ => false, 176 _ => false,
167 } 177 }
168 } 178 }
179
169 pub fn is_tuple(&self) -> bool { 180 pub fn is_tuple(&self) -> bool {
170 match self { 181 match self {
171 VariantData::Tuple(..) => true, 182 VariantData::Tuple(..) => true,
172 _ => false, 183 _ => false,
173 } 184 }
174 } 185 }
186
175 pub fn is_unit(&self) -> bool { 187 pub fn is_unit(&self) -> bool {
176 match self { 188 match self {
177 VariantData::Unit => true, 189 VariantData::Unit => true,
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs
index 07cf0d10a..7dbe93f2b 100644
--- a/crates/ra_hir/src/db.rs
+++ b/crates/ra_hir/src/db.rs
@@ -26,6 +26,7 @@ pub trait HirDatabase: SyntaxDatabase
26 type HirSourceFileQuery; 26 type HirSourceFileQuery;
27 use fn HirFileId::hir_source_file; 27 use fn HirFileId::hir_source_file;
28 } 28 }
29
29 fn expand_macro_invocation(invoc: MacroCallId) -> Option<Arc<MacroExpansion>> { 30 fn expand_macro_invocation(invoc: MacroCallId) -> Option<Arc<MacroExpansion>> {
30 type ExpandMacroCallQuery; 31 type ExpandMacroCallQuery;
31 use fn crate::macros::expand_macro_invocation; 32 use fn crate::macros::expand_macro_invocation;
@@ -80,10 +81,12 @@ pub trait HirDatabase: SyntaxDatabase
80 type InputModuleItemsQuery; 81 type InputModuleItemsQuery;
81 use fn query_definitions::input_module_items; 82 use fn query_definitions::input_module_items;
82 } 83 }
84
83 fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> { 85 fn item_map(source_root_id: SourceRootId) -> Cancelable<Arc<ItemMap>> {
84 type ItemMapQuery; 86 type ItemMapQuery;
85 use fn query_definitions::item_map; 87 use fn query_definitions::item_map;
86 } 88 }
89
87 fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> { 90 fn module_tree(source_root_id: SourceRootId) -> Cancelable<Arc<ModuleTree>> {
88 type ModuleTreeQuery; 91 type ModuleTreeQuery;
89 use fn crate::module_tree::ModuleTree::module_tree_query; 92 use fn crate::module_tree::ModuleTree::module_tree_query;
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index a31f086f7..ebb83d084 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -33,8 +33,7 @@ pub struct Body {
33/// IDs. This is needed to go from e.g. a position in a file to the HIR 33/// IDs. This is needed to go from e.g. a position in a file to the HIR
34/// expression containing it; but for type inference etc., we want to operate on 34/// expression containing it; but for type inference etc., we want to operate on
35/// a structure that is agnostic to the actual positions of expressions in the 35/// a structure that is agnostic to the actual positions of expressions in the
36/// file, so that we don't recompute the type inference whenever some whitespace 36/// file, so that we don't recompute types whenever some whitespace is typed.
37/// is typed.
38#[derive(Debug, Eq, PartialEq)] 37#[derive(Debug, Eq, PartialEq)]
39pub struct BodySyntaxMapping { 38pub struct BodySyntaxMapping {
40 body: Arc<Body>, 39 body: Arc<Body>,
@@ -74,20 +73,25 @@ impl BodySyntaxMapping {
74 pub fn expr_syntax(&self, expr: ExprId) -> Option<LocalSyntaxPtr> { 73 pub fn expr_syntax(&self, expr: ExprId) -> Option<LocalSyntaxPtr> {
75 self.expr_syntax_mapping_back.get(expr).cloned() 74 self.expr_syntax_mapping_back.get(expr).cloned()
76 } 75 }
76
77 pub fn syntax_expr(&self, ptr: LocalSyntaxPtr) -> Option<ExprId> { 77 pub fn syntax_expr(&self, ptr: LocalSyntaxPtr) -> Option<ExprId> {
78 self.expr_syntax_mapping.get(&ptr).cloned() 78 self.expr_syntax_mapping.get(&ptr).cloned()
79 } 79 }
80
80 pub fn node_expr(&self, node: &ast::Expr) -> Option<ExprId> { 81 pub fn node_expr(&self, node: &ast::Expr) -> Option<ExprId> {
81 self.expr_syntax_mapping 82 self.expr_syntax_mapping
82 .get(&LocalSyntaxPtr::new(node.syntax())) 83 .get(&LocalSyntaxPtr::new(node.syntax()))
83 .cloned() 84 .cloned()
84 } 85 }
86
85 pub fn pat_syntax(&self, pat: PatId) -> Option<LocalSyntaxPtr> { 87 pub fn pat_syntax(&self, pat: PatId) -> Option<LocalSyntaxPtr> {
86 self.pat_syntax_mapping_back.get(pat).cloned() 88 self.pat_syntax_mapping_back.get(pat).cloned()
87 } 89 }
90
88 pub fn syntax_pat(&self, ptr: LocalSyntaxPtr) -> Option<PatId> { 91 pub fn syntax_pat(&self, ptr: LocalSyntaxPtr) -> Option<PatId> {
89 self.pat_syntax_mapping.get(&ptr).cloned() 92 self.pat_syntax_mapping.get(&ptr).cloned()
90 } 93 }
94
91 pub fn node_pat(&self, node: &ast::Pat) -> Option<PatId> { 95 pub fn node_pat(&self, node: &ast::Pat) -> Option<PatId> {
92 self.pat_syntax_mapping 96 self.pat_syntax_mapping
93 .get(&LocalSyntaxPtr::new(node.syntax())) 97 .get(&LocalSyntaxPtr::new(node.syntax()))
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 3db757778..2e10e5516 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -9,25 +9,25 @@ use crate::{
9 9
10use crate::code_model_api::Module; 10use crate::code_model_api::Module;
11 11
12/// hir makes a heavy use of ids: integer (u32) handlers to various things. You 12/// hir makes heavy use of ids: integer (u32) handlers to various things. You
13/// can think of id as a pointer (but without a lifetime) or a file descriptor 13/// can think of id as a pointer (but without a lifetime) or a file descriptor
14/// (but for hir objects). 14/// (but for hir objects).
15/// 15///
16/// This module defines a bunch of ids we are using. The most important ones are 16/// This module defines a bunch of ids we are using. The most important ones are
17/// probably `HirFileId` and `DefId`. 17/// probably `HirFileId` and `DefId`.
18 18
19/// Input to the analyzer is a set of file, where each file is indetified by 19/// Input to the analyzer is a set of files, where each file is indentified by
20/// `FileId` and contains source code. However, another source of source code in 20/// `FileId` and contains source code. However, another source of source code in
21/// Rust are macros: each macro can be thought of as producing a "temporary 21/// Rust are macros: each macro can be thought of as producing a "temporary
22/// file". To assign id to such file, we use the id of a macro call that 22/// file". To assign an id to such a file, we use the id of the macro call that
23/// produced the file. So, a `HirFileId` is either a `FileId` (source code 23/// produced the file. So, a `HirFileId` is either a `FileId` (source code
24/// written by user), or a `MacroCallId` (source code produced by macro). 24/// written by user), or a `MacroCallId` (source code produced by macro).
25/// 25///
26/// What is a `MacroCallId`? Simplifying, it's a `HirFileId` of a file containin 26/// What is a `MacroCallId`? Simplifying, it's a `HirFileId` of a file containin
27/// the call plus the offset of the macro call in the file. Note that this is a 27/// the call plus the offset of the macro call in the file. Note that this is a
28/// recursive definition! Nethetheless, size_of of `HirFileId` is finite 28/// recursive definition! However, the size_of of `HirFileId` is finite
29/// (because everything bottoms out at the real `FileId`) and small 29/// (because everything bottoms out at the real `FileId`) and small
30/// (`MacroCallId` uses location interner). 30/// (`MacroCallId` uses the location interner).
31#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 31#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
32pub struct HirFileId(HirFileIdRepr); 32pub struct HirFileId(HirFileIdRepr);
33 33
@@ -235,7 +235,7 @@ pub struct SourceItemId {
235 pub(crate) item_id: Option<SourceFileItemId>, 235 pub(crate) item_id: Option<SourceFileItemId>,
236} 236}
237 237
238/// Maps item's `SyntaxNode`s to `SourceFileItemId` and back. 238/// Maps items' `SyntaxNode`s to `SourceFileItemId`s and back.
239#[derive(Debug, PartialEq, Eq)] 239#[derive(Debug, PartialEq, Eq)]
240pub struct SourceFileItems { 240pub struct SourceFileItems {
241 file_id: HirFileId, 241 file_id: HirFileId,
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 0fbbdc8eb..4acda9af3 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -128,13 +128,13 @@ impl ImplItem {
128pub struct ImplId(pub RawId); 128pub struct ImplId(pub RawId);
129impl_arena_id!(ImplId); 129impl_arena_id!(ImplId);
130 130
131/// Collection of impl blocks is a two-step process: First we collect the blocks 131/// The collection of impl blocks is a two-step process: first we collect the
132/// per-module; then we build an index of all impl blocks in the crate. This 132/// blocks per-module; then we build an index of all impl blocks in the crate.
133/// way, we avoid having to do this process for the whole crate whenever someone 133/// This way, we avoid having to do this process for the whole crate whenever
134/// types in any file; as long as the impl blocks in the file don't change, we 134/// a file is changed; as long as the impl blocks in the file don't change,
135/// don't need to do the second step again. 135/// we don't need to do the second step again.
136/// 136///
137/// (The second step does not yet exist currently.) 137/// (The second step does not yet exist.)
138#[derive(Debug, PartialEq, Eq)] 138#[derive(Debug, PartialEq, Eq)]
139pub struct ModuleImplBlocks { 139pub struct ModuleImplBlocks {
140 impls: Arena<ImplId, ImplData>, 140 impls: Arena<ImplId, ImplData>,
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index eb19d8be1..ca7f395a8 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -1,9 +1,9 @@
1//! HIR (previsouly known as descriptors) provides a high-level OO acess to Rust 1//! HIR (previously known as descriptors) provides a high-level object oriented
2//! code. 2//! access to Rust code.
3//! 3//!
4//! The principal difference between HIR and syntax trees is that HIR is bound 4//! The principal difference between HIR and syntax trees is that HIR is bound
5//! to a particular crate instance. That is, it has cfg flags and features 5//! to a particular crate instance. That is, it has cfg flags and features
6//! applied. So, there relation between syntax and HIR is many-to-one. 6//! applied. So, the relation between syntax and HIR is many-to-one.
7 7
8macro_rules! ctry { 8macro_rules! ctry {
9 ($expr:expr) => { 9 ($expr:expr) => {
diff --git a/crates/ra_hir/src/macros.rs b/crates/ra_hir/src/macros.rs
index eb1c86091..e455b2ad5 100644
--- a/crates/ra_hir/src/macros.rs
+++ b/crates/ra_hir/src/macros.rs
@@ -4,9 +4,9 @@
4/// that is produced after expansion. See `HirFileId` and `MacroCallId` for how 4/// that is produced after expansion. See `HirFileId` and `MacroCallId` for how
5/// do we do that. 5/// do we do that.
6/// 6///
7/// When file-management question is resolved, all that is left is a token tree 7/// When the file-management question is resolved, all that is left is a
8/// to token tree transformation plus hygent. We don't have either of thouse 8/// token-tree-to-token-tree transformation plus hygiene. We don't have either of
9/// yet, so all macros are string based at the moment! 9/// those yet, so all macros are string based at the moment!
10use std::sync::Arc; 10use std::sync::Arc;
11 11
12use ra_db::LocalSyntaxPtr; 12use ra_db::LocalSyntaxPtr;
diff --git a/crates/ra_hir/src/module_tree.rs b/crates/ra_hir/src/module_tree.rs
index 91aab5c74..d2c92f150 100644
--- a/crates/ra_hir/src/module_tree.rs
+++ b/crates/ra_hir/src/module_tree.rs
@@ -85,9 +85,9 @@ impl_arena_id!(LinkId);
85 85
86/// Physically, rust source is organized as a set of files, but logically it is 86/// Physically, rust source is organized as a set of files, but logically it is
87/// organized as a tree of modules. Usually, a single file corresponds to a 87/// organized as a tree of modules. Usually, a single file corresponds to a
88/// single module, but it is not nessary the case. 88/// single module, but it is not neccessarily always the case.
89/// 89///
90/// Module encapsulate the logic of transitioning from the fuzzy world of files 90/// `ModuleTree` encapsulates the logic of transitioning from the fuzzy world of files
91/// (which can have multiple parents) to the precise world of modules (which 91/// (which can have multiple parents) to the precise world of modules (which
92/// always have one parent). 92/// always have one parent).
93#[derive(Default, Debug, PartialEq, Eq)] 93#[derive(Default, Debug, PartialEq, Eq)]
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs
index 3e6ce8b95..d9683549c 100644
--- a/crates/ra_hir/src/name.rs
+++ b/crates/ra_hir/src/name.rs
@@ -3,7 +3,7 @@ use std::fmt;
3use ra_syntax::{ast, SmolStr}; 3use ra_syntax::{ast, SmolStr};
4 4
5/// `Name` is a wrapper around string, which is used in hir for both references 5/// `Name` is a wrapper around string, which is used in hir for both references
6/// and declarations. In theory, names should also carry hygene info, but we are 6/// and declarations. In theory, names should also carry hygiene info, but we are
7/// not there yet! 7/// not there yet!
8#[derive(Clone, PartialEq, Eq, Hash)] 8#[derive(Clone, PartialEq, Eq, Hash)]
9pub struct Name { 9pub struct Name {
diff --git a/crates/ra_hir/src/nameres.rs b/crates/ra_hir/src/nameres.rs
index 20adc9ec4..6bf949654 100644
--- a/crates/ra_hir/src/nameres.rs
+++ b/crates/ra_hir/src/nameres.rs
@@ -1,18 +1,18 @@
1//! Name resolution algorithm. The end result of the algorithm is `ItemMap`: a 1//! Name resolution algorithm. The end result of the algorithm is an `ItemMap`:
2//! map with maps each module to it's scope: the set of items, visible in the 2//! a map which maps each module to its scope: the set of items visible in the
3//! module. That is, we only resolve imports here, name resolution of item 3//! module. That is, we only resolve imports here, name resolution of item
4//! bodies will be done in a separate step. 4//! bodies will be done in a separate step.
5//! 5//!
6//! Like Rustc, we use an interative per-crate algorithm: we start with scopes 6//! Like Rustc, we use an interactive per-crate algorithm: we start with scopes
7//! containing only directly defined items, and then iteratively resolve 7//! containing only directly defined items, and then iteratively resolve
8//! imports. 8//! imports.
9//! 9//!
10//! To make this work nicely in the IDE scenarios, we place `InputModuleItems` 10//! To make this work nicely in the IDE scenario, we place `InputModuleItems`
11//! in between raw syntax and name resolution. `InputModuleItems` are computed 11//! in between raw syntax and name resolution. `InputModuleItems` are computed
12//! using only the module's syntax, and it is all directly defined items plus 12//! using only the module's syntax, and it is all directly defined items plus
13//! imports. The plain is to make `InputModuleItems` independent of local 13//! imports. The plan is to make `InputModuleItems` independent of local
14//! modifications (that is, typing inside a function shold not change IMIs), 14//! modifications (that is, typing inside a function should not change IMIs),
15//! such that the results of name resolution can be preserved unless the module 15//! so that the results of name resolution can be preserved unless the module
16//! structure itself is modified. 16//! structure itself is modified.
17use std::sync::Arc; 17use std::sync::Arc;
18 18
@@ -34,7 +34,7 @@ use crate::{
34 module_tree::{ModuleId, ModuleTree}, 34 module_tree::{ModuleId, ModuleTree},
35}; 35};
36 36
37/// Item map is the result of the name resolution. Item map contains, for each 37/// `ItemMap` is the result of name resolution. It contains, for each
38/// module, the set of visible items. 38/// module, the set of visible items.
39// FIXME: currenty we compute item map per source-root. We should do it per crate instead. 39// FIXME: currenty we compute item map per source-root. We should do it per crate instead.
40#[derive(Default, Debug, PartialEq, Eq)] 40#[derive(Default, Debug, PartialEq, Eq)]
@@ -59,9 +59,9 @@ impl ModuleScope {
59/// A set of items and imports declared inside a module, without relation to 59/// A set of items and imports declared inside a module, without relation to
60/// other modules. 60/// other modules.
61/// 61///
62/// This stands in-between raw syntax and name resolution and alow us to avoid 62/// This sits in-between raw syntax and name resolution and allows us to avoid
63/// recomputing name res: if `InputModuleItems` are the same, we can avoid 63/// recomputing name res: if two instance of `InputModuleItems` are the same, we
64/// running name resolution. 64/// can avoid redoing name resolution.
65#[derive(Debug, Default, PartialEq, Eq)] 65#[derive(Debug, Default, PartialEq, Eq)]
66pub struct InputModuleItems { 66pub struct InputModuleItems {
67 pub(crate) items: Vec<ModuleItem>, 67 pub(crate) items: Vec<ModuleItem>,
@@ -114,7 +114,7 @@ enum ImportKind {
114 Named(NamedImport), 114 Named(NamedImport),
115} 115}
116 116
117/// Resolution is basically `DefId` atm, but it should account for stuff like 117/// `Resolution` is basically `DefId` atm, but it should account for stuff like
118/// multiple namespaces, ambiguity and errors. 118/// multiple namespaces, ambiguity and errors.
119#[derive(Debug, Clone, PartialEq, Eq)] 119#[derive(Debug, Clone, PartialEq, Eq)]
120pub struct Resolution { 120pub struct Resolution {
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 4b0400cd0..1f149a366 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -1,4 +1,4 @@
1/// Lookup hir elements using position in the source code. This is a lossy 1/// Lookup hir elements using positions in the source code. This is a lossy
2/// transformation: in general, a single source might correspond to several 2/// transformation: in general, a single source might correspond to several
3/// modules, functions, etc, due to macros, cfgs and `#[path=]` attributes on 3/// modules, functions, etc, due to macros, cfgs and `#[path=]` attributes on
4/// modules. 4/// modules.
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 90ba393ce..3b2bfd67a 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -144,7 +144,7 @@ pub enum Ty {
144 Bool, 144 Bool,
145 145
146 /// The primitive character type; holds a Unicode scalar value 146 /// The primitive character type; holds a Unicode scalar value
147 /// (a non-surrogate code point). Written as `char`. 147 /// (a non-surrogate code point). Written as `char`.
148 Char, 148 Char,
149 149
150 /// A primitive signed integer type. For example, `i32`. 150 /// A primitive signed integer type. For example, `i32`.
@@ -204,7 +204,7 @@ pub enum Ty {
204 // `|a| yield a`. 204 // `|a| yield a`.
205 // Generator(DefId, GeneratorSubsts<'tcx>, hir::GeneratorMovability), 205 // Generator(DefId, GeneratorSubsts<'tcx>, hir::GeneratorMovability),
206 206
207 // A type representin the types stored inside a generator. 207 // A type representing the types stored inside a generator.
208 // This should only appear in GeneratorInteriors. 208 // This should only appear in GeneratorInteriors.
209 // GeneratorWitness(Binder<&'tcx List<Ty<'tcx>>>), 209 // GeneratorWitness(Binder<&'tcx List<Ty<'tcx>>>),
210 /// The never type `!`. 210 /// The never type `!`.
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs
index 24a386558..d95879e46 100644
--- a/crates/ra_hir/src/ty/autoderef.rs
+++ b/crates/ra_hir/src/ty/autoderef.rs
@@ -1,4 +1,4 @@
1//! In certain situations, rust automatically inserts derefs as necessary: For 1//! In certain situations, rust automatically inserts derefs as necessary: for
2//! example, field accesses `foo.bar` still work when `foo` is actually a 2//! example, field accesses `foo.bar` still work when `foo` is actually a
3//! reference to a type with the field `bar`. This is an approximation of the 3//! reference to a type with the field `bar`. This is an approximation of the
4//! logic in rustc (which lives in librustc_typeck/check/autoderef.rs). 4//! logic in rustc (which lives in librustc_typeck/check/autoderef.rs).
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 2749d740c..ba2a44474 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -15,7 +15,7 @@ use crate::{
15}; 15};
16 16
17// These tests compare the inference results for all expressions in a file 17// These tests compare the inference results for all expressions in a file
18// against snapshots of the current results. If you change something and these 18// against snapshots of the expected results. If you change something and these
19// tests fail expectedly, you can update the comparison files by deleting them 19// tests fail expectedly, you can update the comparison files by deleting them
20// and running the tests again. Similarly, to add a new test, just write the 20// and running the tests again. Similarly, to add a new test, just write the
21// test here in the same pattern and it will automatically write the snapshot. 21// test here in the same pattern and it will automatically write the snapshot.