mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 10:58:02 +00:00
Make HirFileId, EditionedFileId and macro files Salsa struct
And make more queries non-interned. Also flip the default for queries, now the default is to not intern and to intern a query you need to say `invoke_interned`.
This commit is contained in:
parent
02ade79631
commit
c58ddafe90
195 changed files with 1473 additions and 1525 deletions
|
|
@ -319,7 +319,6 @@ fn compute_expr_scopes(
|
|||
mod tests {
|
||||
use base_db::RootQueryDb;
|
||||
use hir_expand::{InFile, name::AsName};
|
||||
use salsa::AsDynDatabase;
|
||||
use span::FileId;
|
||||
use syntax::{AstNode, algo::find_node_at_offset, ast};
|
||||
use test_fixture::WithFixture;
|
||||
|
|
@ -331,7 +330,7 @@ mod tests {
|
|||
let krate = db.test_crate();
|
||||
let crate_def_map = db.crate_def_map(krate);
|
||||
|
||||
let module = crate_def_map.modules_for_file(file_id).next().unwrap();
|
||||
let module = crate_def_map.modules_for_file(db, file_id).next().unwrap();
|
||||
let (_, def) = crate_def_map[module].scope.entries().next().unwrap();
|
||||
match def.take_values().unwrap() {
|
||||
ModuleDefId::FunctionId(it) => it,
|
||||
|
|
@ -354,11 +353,9 @@ mod tests {
|
|||
let editioned_file_id = position.file_id;
|
||||
let offset = position.offset;
|
||||
|
||||
let (file_id, _) = editioned_file_id.unpack();
|
||||
let editioned_file_id_wrapper =
|
||||
base_db::EditionedFileId::new(db.as_dyn_database(), editioned_file_id);
|
||||
let (file_id, _) = editioned_file_id.unpack(&db);
|
||||
|
||||
let file_syntax = db.parse(editioned_file_id_wrapper).syntax_node();
|
||||
let file_syntax = db.parse(editioned_file_id).syntax_node();
|
||||
let marker: ast::PathExpr = find_node_at_offset(&file_syntax, offset).unwrap();
|
||||
let function = find_function(&db, file_id);
|
||||
|
||||
|
|
@ -512,11 +509,9 @@ fn foo() {
|
|||
let editioned_file_id = position.file_id;
|
||||
let offset = position.offset;
|
||||
|
||||
let (file_id, _) = editioned_file_id.unpack();
|
||||
let file_id_wrapper =
|
||||
base_db::EditionedFileId::new(db.as_dyn_database(), editioned_file_id);
|
||||
let (file_id, _) = editioned_file_id.unpack(&db);
|
||||
|
||||
let file = db.parse(file_id_wrapper).ok().unwrap();
|
||||
let file = db.parse(editioned_file_id).ok().unwrap();
|
||||
let expected_name = find_node_at_offset::<ast::Name>(file.syntax(), expected_offset.into())
|
||||
.expect("failed to find a name at the target offset");
|
||||
let name_ref: ast::NameRef = find_node_at_offset(file.syntax(), offset).unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue