aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/body.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/body.rs')
-rw-r--r--crates/ra_hir_def/src/body.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index 2bc405a59..34561ee73 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -34,19 +34,19 @@ pub(crate) struct Expander {
34 34
35impl Expander { 35impl Expander {
36 pub(crate) fn new( 36 pub(crate) fn new(
37 db: &impl DefDatabase, 37 db: &dyn DefDatabase,
38 current_file_id: HirFileId, 38 current_file_id: HirFileId,
39 module: ModuleId, 39 module: ModuleId,
40 ) -> Expander { 40 ) -> Expander {
41 let crate_def_map = db.crate_def_map(module.krate); 41 let crate_def_map = db.crate_def_map(module.krate);
42 let hygiene = Hygiene::new(db, current_file_id); 42 let hygiene = Hygiene::new(db.upcast(), current_file_id);
43 let ast_id_map = db.ast_id_map(current_file_id); 43 let ast_id_map = db.ast_id_map(current_file_id);
44 Expander { crate_def_map, current_file_id, hygiene, ast_id_map, module } 44 Expander { crate_def_map, current_file_id, hygiene, ast_id_map, module }
45 } 45 }
46 46
47 pub(crate) fn enter_expand<T: ast::AstNode, DB: DefDatabase>( 47 pub(crate) fn enter_expand<T: ast::AstNode>(
48 &mut self, 48 &mut self,
49 db: &DB, 49 db: &dyn DefDatabase,
50 local_scope: Option<&ItemScope>, 50 local_scope: Option<&ItemScope>,
51 macro_call: ast::MacroCall, 51 macro_call: ast::MacroCall,
52 ) -> Option<(Mark, T)> { 52 ) -> Option<(Mark, T)> {
@@ -70,7 +70,7 @@ impl Expander {
70 ast_id_map: mem::take(&mut self.ast_id_map), 70 ast_id_map: mem::take(&mut self.ast_id_map),
71 bomb: DropBomb::new("expansion mark dropped"), 71 bomb: DropBomb::new("expansion mark dropped"),
72 }; 72 };
73 self.hygiene = Hygiene::new(db, file_id); 73 self.hygiene = Hygiene::new(db.upcast(), file_id);
74 self.current_file_id = file_id; 74 self.current_file_id = file_id;
75 self.ast_id_map = db.ast_id_map(file_id); 75 self.ast_id_map = db.ast_id_map(file_id);
76 76
@@ -84,8 +84,8 @@ impl Expander {
84 None 84 None
85 } 85 }
86 86
87 pub(crate) fn exit(&mut self, db: &impl DefDatabase, mut mark: Mark) { 87 pub(crate) fn exit(&mut self, db: &dyn DefDatabase, mut mark: Mark) {
88 self.hygiene = Hygiene::new(db, mark.file_id); 88 self.hygiene = Hygiene::new(db.upcast(), mark.file_id);
89 self.current_file_id = mark.file_id; 89 self.current_file_id = mark.file_id;
90 self.ast_id_map = mem::take(&mut mark.ast_id_map); 90 self.ast_id_map = mem::take(&mut mark.ast_id_map);
91 mark.bomb.defuse(); 91 mark.bomb.defuse();
@@ -99,7 +99,7 @@ impl Expander {
99 Path::from_src(path, &self.hygiene) 99 Path::from_src(path, &self.hygiene)
100 } 100 }
101 101
102 fn resolve_path_as_macro(&self, db: &impl DefDatabase, path: &ModPath) -> Option<MacroDefId> { 102 fn resolve_path_as_macro(&self, db: &dyn DefDatabase, path: &ModPath) -> Option<MacroDefId> {
103 self.crate_def_map 103 self.crate_def_map
104 .resolve_path(db, self.module.local_id, path, BuiltinShadowMode::Other) 104 .resolve_path(db, self.module.local_id, path, BuiltinShadowMode::Other)
105 .0 105 .0
@@ -167,7 +167,7 @@ pub struct SyntheticSyntax;
167 167
168impl Body { 168impl Body {
169 pub(crate) fn body_with_source_map_query( 169 pub(crate) fn body_with_source_map_query(
170 db: &impl DefDatabase, 170 db: &dyn DefDatabase,
171 def: DefWithBodyId, 171 def: DefWithBodyId,
172 ) -> (Arc<Body>, Arc<BodySourceMap>) { 172 ) -> (Arc<Body>, Arc<BodySourceMap>) {
173 let _p = profile("body_with_source_map_query"); 173 let _p = profile("body_with_source_map_query");
@@ -196,12 +196,12 @@ impl Body {
196 (Arc::new(body), Arc::new(source_map)) 196 (Arc::new(body), Arc::new(source_map))
197 } 197 }
198 198
199 pub(crate) fn body_query(db: &impl DefDatabase, def: DefWithBodyId) -> Arc<Body> { 199 pub(crate) fn body_query(db: &dyn DefDatabase, def: DefWithBodyId) -> Arc<Body> {
200 db.body_with_source_map(def).0 200 db.body_with_source_map(def).0
201 } 201 }
202 202
203 fn new( 203 fn new(
204 db: &impl DefDatabase, 204 db: &dyn DefDatabase,
205 def: DefWithBodyId, 205 def: DefWithBodyId,
206 expander: Expander, 206 expander: Expander,
207 params: Option<ast::ParamList>, 207 params: Option<ast::ParamList>,