diff options
Diffstat (limited to 'crates/ra_hir_expand/src/builtin_macro.rs')
-rw-r--r-- | crates/ra_hir_expand/src/builtin_macro.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs index 99303188b..c7071fe85 100644 --- a/crates/ra_hir_expand/src/builtin_macro.rs +++ b/crates/ra_hir_expand/src/builtin_macro.rs | |||
@@ -2,8 +2,7 @@ | |||
2 | use crate::db::AstDatabase; | 2 | use crate::db::AstDatabase; |
3 | use crate::{ | 3 | use crate::{ |
4 | ast::{self, AstNode}, | 4 | ast::{self, AstNode}, |
5 | name, AstId, CrateId, HirFileId, MacroCallId, MacroDefId, MacroDefKind, MacroFileKind, | 5 | name, AstId, CrateId, HirFileId, MacroCallId, MacroDefId, MacroDefKind, TextUnit, |
6 | TextUnit, | ||
7 | }; | 6 | }; |
8 | 7 | ||
9 | use crate::quote; | 8 | use crate::quote; |
@@ -90,7 +89,7 @@ fn line_expand( | |||
90 | let arg = loc.kind.arg(db).ok_or_else(|| mbe::ExpandError::UnexpectedToken)?; | 89 | let arg = loc.kind.arg(db).ok_or_else(|| mbe::ExpandError::UnexpectedToken)?; |
91 | let arg_start = arg.text_range().start(); | 90 | let arg_start = arg.text_range().start(); |
92 | 91 | ||
93 | let file = id.as_file(MacroFileKind::Expr); | 92 | let file = id.as_file(); |
94 | let line_num = to_line_number(db, file, arg_start); | 93 | let line_num = to_line_number(db, file, arg_start); |
95 | 94 | ||
96 | let expanded = quote! { | 95 | let expanded = quote! { |
@@ -158,7 +157,7 @@ fn column_expand( | |||
158 | let _arg = macro_call.token_tree().ok_or_else(|| mbe::ExpandError::UnexpectedToken)?; | 157 | let _arg = macro_call.token_tree().ok_or_else(|| mbe::ExpandError::UnexpectedToken)?; |
159 | let col_start = macro_call.syntax().text_range().start(); | 158 | let col_start = macro_call.syntax().text_range().start(); |
160 | 159 | ||
161 | let file = id.as_file(MacroFileKind::Expr); | 160 | let file = id.as_file(); |
162 | let col_num = to_col_number(db, file, col_start); | 161 | let col_num = to_col_number(db, file, col_start); |
163 | 162 | ||
164 | let expanded = quote! { | 163 | let expanded = quote! { |
@@ -269,7 +268,7 @@ mod tests { | |||
269 | }; | 268 | }; |
270 | 269 | ||
271 | let id = db.intern_macro(loc); | 270 | let id = db.intern_macro(loc); |
272 | let parsed = db.parse_or_expand(id.as_file(MacroFileKind::Expr)).unwrap(); | 271 | let parsed = db.parse_or_expand(id.as_file()).unwrap(); |
273 | 272 | ||
274 | parsed.text().to_string() | 273 | parsed.text().to_string() |
275 | } | 274 | } |