Encode edition within FileId in the hir layer

This commit is contained in:
Lukas Wirth 2024-07-17 17:35:40 +02:00
parent 92268627a8
commit 5264f86242
160 changed files with 1117 additions and 824 deletions

View file

@ -12,7 +12,7 @@ mod traits;
use std::env;
use base_db::{FileRange, SourceDatabaseExt2 as _};
use base_db::SourceDatabaseExt2 as _;
use expect_test::Expect;
use hir_def::{
body::{Body, BodySourceMap, SyntheticSyntax},
@ -23,7 +23,7 @@ use hir_def::{
src::HasSource,
AssocItemId, DefWithBodyId, HasModule, LocalModuleId, Lookup, ModuleDefId,
};
use hir_expand::{db::ExpandDatabase, InFile};
use hir_expand::{db::ExpandDatabase, FileRange, InFile};
use once_cell::race::OnceBool;
use rustc_hash::FxHashMap;
use stdx::format_to;
@ -344,7 +344,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
} else {
(node.value.text_range(), node.value.text().to_string().replace('\n', " "))
};
let macro_prefix = if node.file_id != file_id.into() { "!" } else { "" };
let macro_prefix = if node.file_id != file_id { "!" } else { "" };
format_to!(
buf,
"{}{:?} '{}': {}\n",
@ -361,7 +361,7 @@ fn infer_with_mismatches(content: &str, include_mismatches: bool) -> String {
});
for (src_ptr, mismatch) in &mismatches {
let range = src_ptr.value.text_range();
let macro_prefix = if src_ptr.file_id != file_id.into() { "!" } else { "" };
let macro_prefix = if src_ptr.file_id != file_id { "!" } else { "" };
format_to!(
buf,
"{}{:?}: expected {}, got {}\n",
@ -584,7 +584,7 @@ fn salsa_bug() {
}
";
db.set_file_text(pos.file_id, new_text);
db.set_file_text(pos.file_id.file_id(), new_text);
let module = db.module_for_file(pos.file_id);
let crate_def_map = module.def_map(&db);