Skip to content

Commit 642002a

Browse files
author
Paolo Tranquilli
committed
Rust: fix compilation errors
1 parent 35de136 commit 642002a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

rust/extractor/src/rust_analyzer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<'a> RustAnalyzer<'a> {
7979
.ok_or("failed to determine rust edition")?;
8080
Ok((
8181
semantics,
82-
EditionedFileId::new(semantics.db, editioned_file_id),
82+
editioned_file_id,
8383
input,
8484
))
8585
}

rust/extractor/src/translate/base.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ impl<'a> Translator<'a> {
168168
if let Some(semantics) = self.semantics.as_ref() {
169169
let file_range = semantics.original_range(node.syntax());
170170
let file_id = self.file_id?;
171-
if file_id.file_id(semantics.db) == file_range.file_id {
171+
if file_id == file_range.file_id {
172172
Some(file_range.range)
173173
} else {
174174
None
@@ -284,20 +284,20 @@ impl<'a> Translator<'a> {
284284
if let Some(value) = semantics
285285
.hir_file_for(expanded)
286286
.macro_file()
287-
.and_then(|macro_file| {
287+
.and_then(|macro_call_id| {
288288
semantics
289289
.db
290-
.parse_macro_expansion_error(macro_file.macro_call_id)
290+
.parse_macro_expansion_error(macro_call_id)
291291
})
292292
{
293293
if let Some(err) = &value.err {
294294
let error = err.render_to_string(semantics.db);
295-
296-
if err.span().anchor.file_id == semantics.hir_file_for(node.syntax()) {
295+
let hir_file_id = semantics.hir_file_for(node.syntax());
296+
if Some(err.span().anchor.file_id.file_id()) == hir_file_id.file_id().map(|f| f.file_id(semantics.db)) {
297297
let location = err.span().range
298298
+ semantics
299299
.db
300-
.ast_id_map(err.span().anchor.file_id.into())
300+
.ast_id_map(hir_file_id)
301301
.get_erased(err.span().anchor.ast_id)
302302
.text_range()
303303
.start();

0 commit comments

Comments
 (0)