internal: Fetch toolchain and datalayout for DetachedFiles

This commit is contained in:
Lukas Wirth 2024-02-20 10:40:39 +01:00
parent 2223b4fa71
commit d93096ecc0
29 changed files with 164 additions and 80 deletions

View file

@ -6,8 +6,8 @@ use itertools::Itertools;
use crate::{
hir::{
Array, BindingAnnotation, BindingId, CaptureBy, ClosureKind, Literal, LiteralOrConst,
Movability, Statement,
Array, BindingAnnotation, CaptureBy, ClosureKind, Literal, LiteralOrConst, Movability,
Statement,
},
pretty::{print_generic_args, print_path, print_type_ref},
type_ref::TypeRef,

View file

@ -3,7 +3,7 @@
use std::{fmt, hash::BuildHasherDefault};
use base_db::CrateId;
use fst::{self, raw::IndexedValue, Automaton, Streamer};
use fst::{raw::IndexedValue, Automaton, Streamer};
use hir_expand::name::Name;
use indexmap::IndexMap;
use itertools::Itertools;
@ -477,7 +477,7 @@ mod tests {
use expect_test::{expect, Expect};
use test_fixture::WithFixture;
use crate::{db::DefDatabase, test_db::TestDB, ItemContainerId, Lookup};
use crate::{test_db::TestDB, ItemContainerId, Lookup};
use super::*;

View file

@ -44,13 +44,13 @@ use std::{
ops::{Index, Range},
};
use ast::{AstNode, HasName, StructKind};
use ast::{AstNode, StructKind};
use base_db::CrateId;
use either::Either;
use hir_expand::{
ast_id_map::{AstIdNode, FileAstId},
attrs::RawAttrs,
name::{name, AsName, Name},
name::Name,
ExpandTo, HirFileId, InFile,
};
use intern::Interned;
@ -67,7 +67,7 @@ use crate::{
attr::Attrs,
db::DefDatabase,
generics::{GenericParams, LifetimeParamData, TypeOrConstParamData},
path::{path, AssociatedTypeBinding, GenericArgs, ImportAlias, ModPath, Path, PathKind},
path::{GenericArgs, ImportAlias, ModPath, Path, PathKind},
type_ref::{Mutability, TraitRef, TypeBound, TypeRef},
visibility::{RawVisibility, VisibilityExplicitness},
BlockId, Lookup,

View file

@ -2,17 +2,33 @@
use std::collections::hash_map::Entry;
use hir_expand::{ast_id_map::AstIdMap, span_map::SpanMapRef, HirFileId};
use syntax::ast::{self, HasModuleItem, HasTypeBounds, IsString};
use hir_expand::{
ast_id_map::AstIdMap, mod_path::path, name, name::AsName, span_map::SpanMapRef, HirFileId,
};
use la_arena::Arena;
use syntax::{
ast::{self, HasModuleItem, HasName, HasTypeBounds, IsString},
AstNode,
};
use triomphe::Arc;
use crate::{
db::DefDatabase,
generics::{GenericParams, GenericParamsCollector, TypeParamData, TypeParamProvenance},
type_ref::{LifetimeRef, TraitBoundModifier, TraitRef},
item_tree::{
AssocItem, AttrOwner, Const, Either, Enum, ExternBlock, ExternCrate, Field, FieldAstId,
Fields, FileItemTreeId, FnFlags, Function, GenericArgs, Idx, IdxRange, Impl, ImportAlias,
Interned, ItemTree, ItemTreeData, ItemTreeNode, Macro2, MacroCall, MacroRules, Mod,
ModItem, ModKind, ModPath, Mutability, Name, Param, ParamAstId, Path, Range, RawAttrs,
RawIdx, RawVisibilityId, Static, Struct, StructKind, Trait, TraitAlias, TypeAlias, Union,
Use, UseTree, UseTreeKind, Variant,
},
path::AssociatedTypeBinding,
type_ref::{LifetimeRef, TraitBoundModifier, TraitRef, TypeBound, TypeRef},
visibility::RawVisibility,
LocalLifetimeParamId, LocalTypeOrConstParamId,
};
use super::*;
fn id<N: ItemTreeNode>(index: Idx<N>) -> FileItemTreeId<N> {
FileItemTreeId(index)
}

View file

@ -6,12 +6,17 @@ use span::ErasedFileAstId;
use crate::{
generics::{TypeOrConstParamData, WherePredicate, WherePredicateTypeTarget},
item_tree::{
AttrOwner, Const, DefDatabase, Enum, ExternBlock, ExternCrate, Field, FieldAstId, Fields,
FileItemTreeId, FnFlags, Function, GenericParams, Impl, Interned, ItemTree, Macro2,
MacroCall, MacroRules, Mod, ModItem, ModKind, Param, ParamAstId, Path, RawAttrs,
RawVisibilityId, Static, Struct, Trait, TraitAlias, TypeAlias, TypeBound, TypeRef, Union,
Use, UseTree, UseTreeKind, Variant,
},
pretty::{print_path, print_type_bounds, print_type_ref},
visibility::RawVisibility,
};
use super::*;
pub(super) fn print_item_tree(db: &dyn DefDatabase, tree: &ItemTree) -> String {
let mut p = Printer { db, tree, buf: String::new(), indent_level: 0, needs_indent: true };

View file

@ -57,7 +57,7 @@ pub mod proc_macro;
#[cfg(test)]
mod tests;
use std::{cmp::Ord, ops::Deref};
use std::ops::Deref;
use base_db::{CrateId, Edition, FileId};
use hir_expand::{

View file

@ -2446,7 +2446,7 @@ mod tests {
use base_db::SourceDatabase;
use test_fixture::WithFixture;
use crate::{db::DefDatabase, test_db::TestDB};
use crate::test_db::TestDB;
use super::*;

View file

@ -1,10 +1,7 @@
use expect_test::expect;
use test_fixture::WithFixture;
use itertools::Itertools;
use crate::nameres::tests::check;
use super::*;
#[test]