aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-10 23:27:00 +0100
committerAleksey Kladov <[email protected]>2020-04-10 23:27:00 +0100
commitc1244c853c6bdc42bf91a77768963c0d287093ff (patch)
treec7f96c8f170c43d4a65451e089783ba6550ca020 /crates/ra_hir_def/src
parentca9a5dd1654cc0d54ed5b2bb71ec8ed559470276 (diff)
Forward compat
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r--crates/ra_hir_def/src/body.rs6
-rw-r--r--crates/ra_hir_def/src/body/lower.rs6
-rw-r--r--crates/ra_hir_def/src/diagnostics.rs2
3 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs
index 5f9d53ecb..e09996c6f 100644
--- a/crates/ra_hir_def/src/body.rs
+++ b/crates/ra_hir_def/src/body.rs
@@ -236,7 +236,7 @@ impl Index<PatId> for Body {
236 236
237impl BodySourceMap { 237impl BodySourceMap {
238 pub fn expr_syntax(&self, expr: ExprId) -> Result<ExprSource, SyntheticSyntax> { 238 pub fn expr_syntax(&self, expr: ExprId) -> Result<ExprSource, SyntheticSyntax> {
239 self.expr_map_back[expr] 239 self.expr_map_back[expr].clone()
240 } 240 }
241 241
242 pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> { 242 pub fn node_expr(&self, node: InFile<&ast::Expr>) -> Option<ExprId> {
@@ -255,7 +255,7 @@ impl BodySourceMap {
255 } 255 }
256 256
257 pub fn pat_syntax(&self, pat: PatId) -> Result<PatSource, SyntheticSyntax> { 257 pub fn pat_syntax(&self, pat: PatId) -> Result<PatSource, SyntheticSyntax> {
258 self.pat_map_back[pat] 258 self.pat_map_back[pat].clone()
259 } 259 }
260 260
261 pub fn node_pat(&self, node: InFile<&ast::Pat>) -> Option<PatId> { 261 pub fn node_pat(&self, node: InFile<&ast::Pat>) -> Option<PatId> {
@@ -264,6 +264,6 @@ impl BodySourceMap {
264 } 264 }
265 265
266 pub fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::RecordField> { 266 pub fn field_syntax(&self, expr: ExprId, field: usize) -> AstPtr<ast::RecordField> {
267 self.field_map[&(expr, field)] 267 self.field_map[&(expr, field)].clone()
268 } 268 }
269} 269}
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 0855c1d3a..9d6ee095e 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -106,7 +106,7 @@ impl ExprCollector<'_> {
106 fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId { 106 fn alloc_expr(&mut self, expr: Expr, ptr: AstPtr<ast::Expr>) -> ExprId {
107 let ptr = Either::Left(ptr); 107 let ptr = Either::Left(ptr);
108 let src = self.expander.to_source(ptr); 108 let src = self.expander.to_source(ptr);
109 let id = self.make_expr(expr, Ok(src)); 109 let id = self.make_expr(expr, Ok(src.clone()));
110 self.source_map.expr_map.insert(src, id); 110 self.source_map.expr_map.insert(src, id);
111 id 111 id
112 } 112 }
@@ -118,7 +118,7 @@ impl ExprCollector<'_> {
118 fn alloc_expr_field_shorthand(&mut self, expr: Expr, ptr: AstPtr<ast::RecordField>) -> ExprId { 118 fn alloc_expr_field_shorthand(&mut self, expr: Expr, ptr: AstPtr<ast::RecordField>) -> ExprId {
119 let ptr = Either::Right(ptr); 119 let ptr = Either::Right(ptr);
120 let src = self.expander.to_source(ptr); 120 let src = self.expander.to_source(ptr);
121 let id = self.make_expr(expr, Ok(src)); 121 let id = self.make_expr(expr, Ok(src.clone()));
122 self.source_map.expr_map.insert(src, id); 122 self.source_map.expr_map.insert(src, id);
123 id 123 id
124 } 124 }
@@ -136,7 +136,7 @@ impl ExprCollector<'_> {
136 136
137 fn alloc_pat(&mut self, pat: Pat, ptr: PatPtr) -> PatId { 137 fn alloc_pat(&mut self, pat: Pat, ptr: PatPtr) -> PatId {
138 let src = self.expander.to_source(ptr); 138 let src = self.expander.to_source(ptr);
139 let id = self.make_pat(pat, Ok(src)); 139 let id = self.make_pat(pat, Ok(src.clone()));
140 self.source_map.pat_map.insert(src, id); 140 self.source_map.pat_map.insert(src, id);
141 id 141 id
142 } 142 }
diff --git a/crates/ra_hir_def/src/diagnostics.rs b/crates/ra_hir_def/src/diagnostics.rs
index 095498429..cfa0f2f76 100644
--- a/crates/ra_hir_def/src/diagnostics.rs
+++ b/crates/ra_hir_def/src/diagnostics.rs
@@ -20,7 +20,7 @@ impl Diagnostic for UnresolvedModule {
20 "unresolved module".to_string() 20 "unresolved module".to_string()
21 } 21 }
22 fn source(&self) -> InFile<SyntaxNodePtr> { 22 fn source(&self) -> InFile<SyntaxNodePtr> {
23 InFile { file_id: self.file, value: self.decl.into() } 23 InFile { file_id: self.file, value: self.decl.clone().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