diff options
author | Aleksey Kladov <[email protected]> | 2019-11-28 09:50:26 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-28 09:50:26 +0000 |
commit | ccd1b0800a5de5e046e6e9a4b6f49030c1ce3639 (patch) | |
tree | e878f88aebf11c0e54eff2e107dfaa4d192ab272 /crates/ra_hir_def | |
parent | 2702fa1c5d6d8ad504c0d7703b6363ea09ba5570 (diff) |
Rename Source -> InFile
Diffstat (limited to 'crates/ra_hir_def')
-rw-r--r-- | crates/ra_hir_def/src/adt.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/attr.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/body.rs | 14 | ||||
-rw-r--r-- | crates/ra_hir_def/src/body/scope.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/diagnostics.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/lib.rs | 26 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres.rs | 14 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/raw.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/path.rs | 4 |
9 files changed, 44 insertions, 44 deletions
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index 3666529b0..3d21dedee 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs | |||
@@ -5,7 +5,7 @@ use std::sync::Arc; | |||
5 | use hir_expand::{ | 5 | use hir_expand::{ |
6 | either::Either, | 6 | either::Either, |
7 | name::{AsName, Name}, | 7 | name::{AsName, Name}, |
8 | Source, | 8 | InFile, |
9 | }; | 9 | }; |
10 | use ra_arena::{map::ArenaMap, Arena}; | 10 | use ra_arena::{map::ArenaMap, Arena}; |
11 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; | 11 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; |
@@ -88,7 +88,7 @@ impl EnumData { | |||
88 | impl HasChildSource for EnumId { | 88 | impl HasChildSource for EnumId { |
89 | type ChildId = LocalEnumVariantId; | 89 | type ChildId = LocalEnumVariantId; |
90 | type Value = ast::EnumVariant; | 90 | type Value = ast::EnumVariant; |
91 | fn child_source(&self, db: &impl DefDatabase) -> Source<ArenaMap<Self::ChildId, Self::Value>> { | 91 | fn child_source(&self, db: &impl DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { |
92 | let src = self.source(db); | 92 | let src = self.source(db); |
93 | let mut trace = Trace::new_for_map(); | 93 | let mut trace = Trace::new_for_map(); |
94 | lower_enum(&mut trace, &src.value); | 94 | lower_enum(&mut trace, &src.value); |
@@ -145,7 +145,7 @@ impl HasChildSource for VariantId { | |||
145 | type ChildId = LocalStructFieldId; | 145 | type ChildId = LocalStructFieldId; |
146 | type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>; | 146 | type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>; |
147 | 147 | ||
148 | fn child_source(&self, db: &impl DefDatabase) -> Source<ArenaMap<Self::ChildId, Self::Value>> { | 148 | fn child_source(&self, db: &impl DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { |
149 | let src = match self { | 149 | let src = match self { |
150 | VariantId::EnumVariantId(it) => { | 150 | VariantId::EnumVariantId(it) => { |
151 | // I don't really like the fact that we call into parent source | 151 | // I don't really like the fact that we call into parent source |
diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs index fffb22201..83783ac7a 100644 --- a/crates/ra_hir_def/src/attr.rs +++ b/crates/ra_hir_def/src/attr.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::{ops, sync::Arc}; | 3 | use std::{ops, sync::Arc}; |
4 | 4 | ||
5 | use hir_expand::{either::Either, hygiene::Hygiene, AstId, Source}; | 5 | use hir_expand::{either::Either, hygiene::Hygiene, AstId, InFile}; |
6 | use mbe::ast_to_token_tree; | 6 | use mbe::ast_to_token_tree; |
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | ast::{self, AstNode, AttrsOwner}, | 8 | ast::{self, AstNode, AttrsOwner}, |
@@ -68,7 +68,7 @@ impl Attrs { | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | 70 | ||
71 | fn from_attrs_owner(db: &impl DefDatabase, owner: Source<&dyn AttrsOwner>) -> Attrs { | 71 | fn from_attrs_owner(db: &impl DefDatabase, owner: InFile<&dyn AttrsOwner>) -> Attrs { |
72 | let hygiene = Hygiene::new(db, owner.file_id); | 72 | let hygiene = Hygiene::new(db, owner.file_id); |
73 | Attrs::new(owner.value, &hygiene) | 73 | Attrs::new(owner.value, &hygiene) |
74 | } | 74 | } |
@@ -157,7 +157,7 @@ where | |||
157 | N: ast::AttrsOwner, | 157 | N: ast::AttrsOwner, |
158 | D: DefDatabase, | 158 | D: DefDatabase, |
159 | { | 159 | { |
160 | let src = Source::new(src.file_id(), src.to_node(db)); | 160 | let src = InFile::new(src.file_id(), src.to_node(db)); |
161 | Attrs::from_attrs_owner(db, src.as_ref().map(|it| it as &dyn AttrsOwner)) | 161 | Attrs::from_attrs_owner(db, src.as_ref().map(|it| it as &dyn AttrsOwner)) |
162 | } | 162 | } |
163 | 163 | ||
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index a57a0176d..f21937f10 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs | |||
@@ -6,7 +6,7 @@ pub mod scope; | |||
6 | use std::{ops::Index, sync::Arc}; | 6 | use std::{ops::Index, sync::Arc}; |
7 | 7 | ||
8 | use hir_expand::{ | 8 | use hir_expand::{ |
9 | either::Either, hygiene::Hygiene, AstId, HirFileId, MacroDefId, MacroFileKind, Source, | 9 | either::Either, hygiene::Hygiene, AstId, HirFileId, InFile, MacroDefId, MacroFileKind, |
10 | }; | 10 | }; |
11 | use ra_arena::{map::ArenaMap, Arena}; | 11 | use ra_arena::{map::ArenaMap, Arena}; |
12 | use ra_syntax::{ast, AstNode, AstPtr}; | 12 | use ra_syntax::{ast, AstNode, AstPtr}; |
@@ -73,8 +73,8 @@ impl Expander { | |||
73 | std::mem::forget(mark); | 73 | std::mem::forget(mark); |
74 | } | 74 | } |
75 | 75 | ||
76 | fn to_source<T>(&self, value: T) -> Source<T> { | 76 | fn to_source<T>(&self, value: T) -> InFile<T> { |
77 | Source { file_id: self.current_file_id, value } | 77 | InFile { file_id: self.current_file_id, value } |
78 | } | 78 | } |
79 | 79 | ||
80 | fn parse_path(&mut self, path: ast::Path) -> Option<Path> { | 80 | fn parse_path(&mut self, path: ast::Path) -> Option<Path> { |
@@ -115,10 +115,10 @@ pub struct Body { | |||
115 | } | 115 | } |
116 | 116 | ||
117 | pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>; | 117 | pub type ExprPtr = Either<AstPtr<ast::Expr>, AstPtr<ast::RecordField>>; |
118 | pub type ExprSource = Source<ExprPtr>; | 118 | pub type ExprSource = InFile<ExprPtr>; |
119 | 119 | ||
120 | pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; | 120 | pub type PatPtr = Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>; |
121 | pub type PatSource = Source<PatPtr>; | 121 | pub type PatSource = InFile<PatPtr>; |
122 | 122 | ||
123 | /// An item body together with the mapping from syntax nodes to HIR expression | 123 | /// An item body together with the mapping from syntax nodes to HIR expression |
124 | /// IDs. This is needed to go from e.g. a position in a file to the HIR | 124 | /// IDs. This is needed to go from e.g. a position in a file to the HIR |
@@ -205,7 +205,7 @@ impl BodySourceMap { | |||
205 | self.expr_map_back.get(expr).copied() | 205 | self.expr_map_back.get(expr).copied() |
206 | } | 206 | } |
207 | 207 | ||
208 | pub fn node_expr(&self, node: Source<&ast::Expr>) -> Option<ExprId> { | 208 | pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> { |
209 | let src = node.map(|it| Either::A(AstPtr::new(it))); | 209 | let src = node.map(|it| Either::A(AstPtr::new(it))); |
210 | self.expr_map.get(&src).cloned() | 210 | self.expr_map.get(&src).cloned() |
211 | } | 211 | } |
@@ -214,7 +214,7 @@ impl BodySourceMap { | |||
214 | self.pat_map_back.get(pat).copied() | 214 | self.pat_map_back.get(pat).copied() |
215 | } | 215 | } |
216 | 216 | ||
217 | pub fn node_pat(&self, node: Source<&ast::Pat>) -> Option<PatId> { | 217 | pub fn node_pat(&self, node: InFile<&ast::Pat>) -> Option<PatId> { |
218 | let src = node.map(|it| Either::A(AstPtr::new(it))); | 218 | let src = node.map(|it| Either::A(AstPtr::new(it))); |
219 | self.pat_map.get(&src).cloned() | 219 | self.pat_map.get(&src).cloned() |
220 | } | 220 | } |
diff --git a/crates/ra_hir_def/src/body/scope.rs b/crates/ra_hir_def/src/body/scope.rs index 625aa39dd..ab6599b23 100644 --- a/crates/ra_hir_def/src/body/scope.rs +++ b/crates/ra_hir_def/src/body/scope.rs | |||
@@ -171,7 +171,7 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope | |||
171 | 171 | ||
172 | #[cfg(test)] | 172 | #[cfg(test)] |
173 | mod tests { | 173 | mod tests { |
174 | use hir_expand::{name::AsName, Source}; | 174 | use hir_expand::{name::AsName, InFile}; |
175 | use ra_db::{fixture::WithFixture, FileId, SourceDatabase}; | 175 | use ra_db::{fixture::WithFixture, FileId, SourceDatabase}; |
176 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; | 176 | use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; |
177 | use test_utils::{assert_eq_text, covers, extract_offset}; | 177 | use test_utils::{assert_eq_text, covers, extract_offset}; |
@@ -211,7 +211,7 @@ mod tests { | |||
211 | let (_body, source_map) = db.body_with_source_map(function.into()); | 211 | let (_body, source_map) = db.body_with_source_map(function.into()); |
212 | 212 | ||
213 | let expr_id = source_map | 213 | let expr_id = source_map |
214 | .node_expr(Source { file_id: file_id.into(), value: &marker.into() }) | 214 | .node_expr(InFile { file_id: file_id.into(), value: &marker.into() }) |
215 | .unwrap(); | 215 | .unwrap(); |
216 | let scope = scopes.scope_for(expr_id); | 216 | let scope = scopes.scope_for(expr_id); |
217 | 217 | ||
@@ -318,7 +318,7 @@ mod tests { | |||
318 | let expr_scope = { | 318 | let expr_scope = { |
319 | let expr_ast = name_ref.syntax().ancestors().find_map(ast::Expr::cast).unwrap(); | 319 | let expr_ast = name_ref.syntax().ancestors().find_map(ast::Expr::cast).unwrap(); |
320 | let expr_id = | 320 | let expr_id = |
321 | source_map.node_expr(Source { file_id: file_id.into(), value: &expr_ast }).unwrap(); | 321 | source_map.node_expr(InFile { file_id: file_id.into(), value: &expr_ast }).unwrap(); |
322 | scopes.scope_for(expr_id).unwrap() | 322 | scopes.scope_for(expr_id).unwrap() |
323 | }; | 323 | }; |
324 | 324 | ||
diff --git a/crates/ra_hir_def/src/diagnostics.rs b/crates/ra_hir_def/src/diagnostics.rs index eda9b2269..095498429 100644 --- a/crates/ra_hir_def/src/diagnostics.rs +++ b/crates/ra_hir_def/src/diagnostics.rs | |||
@@ -6,7 +6,7 @@ use hir_expand::diagnostics::Diagnostic; | |||
6 | use ra_db::RelativePathBuf; | 6 | use ra_db::RelativePathBuf; |
7 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; | 7 | use ra_syntax::{ast, AstPtr, SyntaxNodePtr}; |
8 | 8 | ||
9 | use hir_expand::{HirFileId, Source}; | 9 | use hir_expand::{HirFileId, InFile}; |
10 | 10 | ||
11 | #[derive(Debug)] | 11 | #[derive(Debug)] |
12 | pub struct UnresolvedModule { | 12 | pub struct UnresolvedModule { |
@@ -19,8 +19,8 @@ impl Diagnostic for UnresolvedModule { | |||
19 | fn message(&self) -> String { | 19 | fn message(&self) -> String { |
20 | "unresolved module".to_string() | 20 | "unresolved module".to_string() |
21 | } | 21 | } |
22 | fn source(&self) -> Source<SyntaxNodePtr> { | 22 | fn source(&self) -> InFile<SyntaxNodePtr> { |
23 | Source { file_id: self.file, value: self.decl.into() } | 23 | InFile { file_id: self.file, value: self.decl.into() } |
24 | } | 24 | } |
25 | fn as_any(&self) -> &(dyn Any + Send + 'static) { | 25 | fn as_any(&self) -> &(dyn Any + Send + 'static) { |
26 | self | 26 | self |
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index bc5530896..9d89692bf 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs | |||
@@ -36,7 +36,7 @@ mod marks; | |||
36 | 36 | ||
37 | use std::hash::{Hash, Hasher}; | 37 | use std::hash::{Hash, Hasher}; |
38 | 38 | ||
39 | use hir_expand::{ast_id_map::FileAstId, db::AstDatabase, AstId, HirFileId, MacroDefId, Source}; | 39 | use hir_expand::{ast_id_map::FileAstId, db::AstDatabase, AstId, HirFileId, InFile, MacroDefId}; |
40 | use ra_arena::{impl_arena_id, map::ArenaMap, RawId}; | 40 | use ra_arena::{impl_arena_id, map::ArenaMap, RawId}; |
41 | use ra_db::{impl_intern_key, salsa, CrateId}; | 41 | use ra_db::{impl_intern_key, salsa, CrateId}; |
42 | use ra_syntax::{ast, AstNode}; | 42 | use ra_syntax::{ast, AstNode}; |
@@ -105,10 +105,10 @@ pub trait AstItemDef<N: AstNode>: salsa::InternKey + Clone { | |||
105 | let loc = ItemLoc { module: ctx.module, ast_id: AstId::new(ctx.file_id, ast_id) }; | 105 | let loc = ItemLoc { module: ctx.module, ast_id: AstId::new(ctx.file_id, ast_id) }; |
106 | Self::intern(ctx.db, loc) | 106 | Self::intern(ctx.db, loc) |
107 | } | 107 | } |
108 | fn source(self, db: &(impl AstDatabase + InternDatabase)) -> Source<N> { | 108 | fn source(self, db: &(impl AstDatabase + InternDatabase)) -> InFile<N> { |
109 | let loc = self.lookup_intern(db); | 109 | let loc = self.lookup_intern(db); |
110 | let value = loc.ast_id.to_node(db); | 110 | let value = loc.ast_id.to_node(db); |
111 | Source { file_id: loc.ast_id.file_id(), value } | 111 | InFile { file_id: loc.ast_id.file_id(), value } |
112 | } | 112 | } |
113 | fn module(self, db: &impl InternDatabase) -> ModuleId { | 113 | fn module(self, db: &impl InternDatabase) -> ModuleId { |
114 | let loc = self.lookup_intern(db); | 114 | let loc = self.lookup_intern(db); |
@@ -517,42 +517,42 @@ impl HasModule for StaticLoc { | |||
517 | 517 | ||
518 | pub trait HasSource { | 518 | pub trait HasSource { |
519 | type Value; | 519 | type Value; |
520 | fn source(&self, db: &impl db::DefDatabase) -> Source<Self::Value>; | 520 | fn source(&self, db: &impl db::DefDatabase) -> InFile<Self::Value>; |
521 | } | 521 | } |
522 | 522 | ||
523 | impl HasSource for FunctionLoc { | 523 | impl HasSource for FunctionLoc { |
524 | type Value = ast::FnDef; | 524 | type Value = ast::FnDef; |
525 | 525 | ||
526 | fn source(&self, db: &impl db::DefDatabase) -> Source<ast::FnDef> { | 526 | fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::FnDef> { |
527 | let node = self.ast_id.to_node(db); | 527 | let node = self.ast_id.to_node(db); |
528 | Source::new(self.ast_id.file_id(), node) | 528 | InFile::new(self.ast_id.file_id(), node) |
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | impl HasSource for TypeAliasLoc { | 532 | impl HasSource for TypeAliasLoc { |
533 | type Value = ast::TypeAliasDef; | 533 | type Value = ast::TypeAliasDef; |
534 | 534 | ||
535 | fn source(&self, db: &impl db::DefDatabase) -> Source<ast::TypeAliasDef> { | 535 | fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::TypeAliasDef> { |
536 | let node = self.ast_id.to_node(db); | 536 | let node = self.ast_id.to_node(db); |
537 | Source::new(self.ast_id.file_id(), node) | 537 | InFile::new(self.ast_id.file_id(), node) |
538 | } | 538 | } |
539 | } | 539 | } |
540 | 540 | ||
541 | impl HasSource for ConstLoc { | 541 | impl HasSource for ConstLoc { |
542 | type Value = ast::ConstDef; | 542 | type Value = ast::ConstDef; |
543 | 543 | ||
544 | fn source(&self, db: &impl db::DefDatabase) -> Source<ast::ConstDef> { | 544 | fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::ConstDef> { |
545 | let node = self.ast_id.to_node(db); | 545 | let node = self.ast_id.to_node(db); |
546 | Source::new(self.ast_id.file_id(), node) | 546 | InFile::new(self.ast_id.file_id(), node) |
547 | } | 547 | } |
548 | } | 548 | } |
549 | 549 | ||
550 | impl HasSource for StaticLoc { | 550 | impl HasSource for StaticLoc { |
551 | type Value = ast::StaticDef; | 551 | type Value = ast::StaticDef; |
552 | 552 | ||
553 | fn source(&self, db: &impl db::DefDatabase) -> Source<ast::StaticDef> { | 553 | fn source(&self, db: &impl db::DefDatabase) -> InFile<ast::StaticDef> { |
554 | let node = self.ast_id.to_node(db); | 554 | let node = self.ast_id.to_node(db); |
555 | Source::new(self.ast_id.file_id(), node) | 555 | InFile::new(self.ast_id.file_id(), node) |
556 | } | 556 | } |
557 | } | 557 | } |
558 | 558 | ||
@@ -562,5 +562,5 @@ pub trait HasChildSource { | |||
562 | fn child_source( | 562 | fn child_source( |
563 | &self, | 563 | &self, |
564 | db: &impl db::DefDatabase, | 564 | db: &impl db::DefDatabase, |
565 | ) -> Source<ArenaMap<Self::ChildId, Self::Value>>; | 565 | ) -> InFile<ArenaMap<Self::ChildId, Self::Value>>; |
566 | } | 566 | } |
diff --git a/crates/ra_hir_def/src/nameres.rs b/crates/ra_hir_def/src/nameres.rs index 2359386c2..1b369ea11 100644 --- a/crates/ra_hir_def/src/nameres.rs +++ b/crates/ra_hir_def/src/nameres.rs | |||
@@ -58,8 +58,8 @@ mod tests; | |||
58 | use std::sync::Arc; | 58 | use std::sync::Arc; |
59 | 59 | ||
60 | use hir_expand::{ | 60 | use hir_expand::{ |
61 | ast_id_map::FileAstId, diagnostics::DiagnosticSink, either::Either, name::Name, MacroDefId, | 61 | ast_id_map::FileAstId, diagnostics::DiagnosticSink, either::Either, name::Name, InFile, |
62 | Source, | 62 | MacroDefId, |
63 | }; | 63 | }; |
64 | use once_cell::sync::Lazy; | 64 | use once_cell::sync::Lazy; |
65 | use ra_arena::Arena; | 65 | use ra_arena::Arena; |
@@ -261,21 +261,21 @@ impl ModuleData { | |||
261 | pub fn definition_source( | 261 | pub fn definition_source( |
262 | &self, | 262 | &self, |
263 | db: &impl DefDatabase, | 263 | db: &impl DefDatabase, |
264 | ) -> Source<Either<ast::SourceFile, ast::Module>> { | 264 | ) -> InFile<Either<ast::SourceFile, ast::Module>> { |
265 | if let Some(file_id) = self.definition { | 265 | if let Some(file_id) = self.definition { |
266 | let sf = db.parse(file_id).tree(); | 266 | let sf = db.parse(file_id).tree(); |
267 | return Source::new(file_id.into(), Either::A(sf)); | 267 | return InFile::new(file_id.into(), Either::A(sf)); |
268 | } | 268 | } |
269 | let decl = self.declaration.unwrap(); | 269 | let decl = self.declaration.unwrap(); |
270 | Source::new(decl.file_id(), Either::B(decl.to_node(db))) | 270 | InFile::new(decl.file_id(), Either::B(decl.to_node(db))) |
271 | } | 271 | } |
272 | 272 | ||
273 | /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. | 273 | /// Returns a node which declares this module, either a `mod foo;` or a `mod foo {}`. |
274 | /// `None` for the crate root. | 274 | /// `None` for the crate root. |
275 | pub fn declaration_source(&self, db: &impl DefDatabase) -> Option<Source<ast::Module>> { | 275 | pub fn declaration_source(&self, db: &impl DefDatabase) -> Option<InFile<ast::Module>> { |
276 | let decl = self.declaration?; | 276 | let decl = self.declaration?; |
277 | let value = decl.to_node(db); | 277 | let value = decl.to_node(db); |
278 | Some(Source { file_id: decl.file_id(), value }) | 278 | Some(InFile { file_id: decl.file_id(), value }) |
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index 6eb106094..5196b67ca 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs | |||
@@ -22,8 +22,8 @@ use ra_syntax::{ | |||
22 | use test_utils::tested_by; | 22 | use test_utils::tested_by; |
23 | 23 | ||
24 | use crate::{ | 24 | use crate::{ |
25 | attr::Attrs, db::DefDatabase, path::Path, trace::Trace, FileAstId, HirFileId, LocalImportId, | 25 | attr::Attrs, db::DefDatabase, path::Path, trace::Trace, FileAstId, HirFileId, InFile, |
26 | Source, | 26 | LocalImportId, |
27 | }; | 27 | }; |
28 | 28 | ||
29 | /// `RawItems` is a set of top-level items in a file (except for impls). | 29 | /// `RawItems` is a set of top-level items in a file (except for impls). |
@@ -313,7 +313,7 @@ impl RawItemsCollector { | |||
313 | 313 | ||
314 | let mut buf = Vec::new(); | 314 | let mut buf = Vec::new(); |
315 | Path::expand_use_item( | 315 | Path::expand_use_item( |
316 | Source { value: use_item, file_id: self.file_id }, | 316 | InFile { value: use_item, file_id: self.file_id }, |
317 | &self.hygiene, | 317 | &self.hygiene, |
318 | |path, use_tree, is_glob, alias| { | 318 | |path, use_tree, is_glob, alias| { |
319 | let import_data = ImportData { | 319 | let import_data = ImportData { |
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index 6810a26db..10688df4d 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs | |||
@@ -13,7 +13,7 @@ use ra_syntax::{ | |||
13 | AstNode, | 13 | AstNode, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | use crate::{type_ref::TypeRef, Source}; | 16 | use crate::{type_ref::TypeRef, InFile}; |
17 | 17 | ||
18 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 18 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
19 | pub struct Path { | 19 | pub struct Path { |
@@ -67,7 +67,7 @@ pub enum PathKind { | |||
67 | impl Path { | 67 | impl Path { |
68 | /// Calls `cb` with all paths, represented by this use item. | 68 | /// Calls `cb` with all paths, represented by this use item. |
69 | pub(crate) fn expand_use_item( | 69 | pub(crate) fn expand_use_item( |
70 | item_src: Source<ast::UseItem>, | 70 | item_src: InFile<ast::UseItem>, |
71 | hygiene: &Hygiene, | 71 | hygiene: &Hygiene, |
72 | mut cb: impl FnMut(Path, &ast::UseTree, bool, Option<Name>), | 72 | mut cb: impl FnMut(Path, &ast::UseTree, bool, Option<Name>), |
73 | ) { | 73 | ) { |