Skip to content

Commit d93096e

Browse files
committed
internal: Fetch toolchain and datalayout for DetachedFiles
1 parent 2223b4f commit d93096e

File tree

29 files changed

+164
-80
lines changed

29 files changed

+164
-80
lines changed

crates/hir-def/src/body/pretty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use itertools::Itertools;
66

77
use crate::{
88
hir::{
9-
Array, BindingAnnotation, BindingId, CaptureBy, ClosureKind, Literal, LiteralOrConst,
10-
Movability, Statement,
9+
Array, BindingAnnotation, CaptureBy, ClosureKind, Literal, LiteralOrConst, Movability,
10+
Statement,
1111
},
1212
pretty::{print_generic_args, print_path, print_type_ref},
1313
type_ref::TypeRef,

crates/hir-def/src/import_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::{fmt, hash::BuildHasherDefault};
44

55
use base_db::CrateId;
6-
use fst::{self, raw::IndexedValue, Automaton, Streamer};
6+
use fst::{raw::IndexedValue, Automaton, Streamer};
77
use hir_expand::name::Name;
88
use indexmap::IndexMap;
99
use itertools::Itertools;
@@ -477,7 +477,7 @@ mod tests {
477477
use expect_test::{expect, Expect};
478478
use test_fixture::WithFixture;
479479

480-
use crate::{db::DefDatabase, test_db::TestDB, ItemContainerId, Lookup};
480+
use crate::{test_db::TestDB, ItemContainerId, Lookup};
481481

482482
use super::*;
483483

crates/hir-def/src/item_tree.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ use std::{
4444
ops::{Index, Range},
4545
};
4646

47-
use ast::{AstNode, HasName, StructKind};
47+
use ast::{AstNode, StructKind};
4848
use base_db::CrateId;
4949
use either::Either;
5050
use hir_expand::{
5151
ast_id_map::{AstIdNode, FileAstId},
5252
attrs::RawAttrs,
53-
name::{name, AsName, Name},
53+
name::Name,
5454
ExpandTo, HirFileId, InFile,
5555
};
5656
use intern::Interned;
@@ -67,7 +67,7 @@ use crate::{
6767
attr::Attrs,
6868
db::DefDatabase,
6969
generics::{GenericParams, LifetimeParamData, TypeOrConstParamData},
70-
path::{path, AssociatedTypeBinding, GenericArgs, ImportAlias, ModPath, Path, PathKind},
70+
path::{GenericArgs, ImportAlias, ModPath, Path, PathKind},
7171
type_ref::{Mutability, TraitRef, TypeBound, TypeRef},
7272
visibility::{RawVisibility, VisibilityExplicitness},
7373
BlockId, Lookup,

crates/hir-def/src/item_tree/lower.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,33 @@
22
33
use std::collections::hash_map::Entry;
44

5-
use hir_expand::{ast_id_map::AstIdMap, span_map::SpanMapRef, HirFileId};
6-
use syntax::ast::{self, HasModuleItem, HasTypeBounds, IsString};
5+
use hir_expand::{
6+
ast_id_map::AstIdMap, mod_path::path, name, name::AsName, span_map::SpanMapRef, HirFileId,
7+
};
8+
use la_arena::Arena;
9+
use syntax::{
10+
ast::{self, HasModuleItem, HasName, HasTypeBounds, IsString},
11+
AstNode,
12+
};
13+
use triomphe::Arc;
714

815
use crate::{
16+
db::DefDatabase,
917
generics::{GenericParams, GenericParamsCollector, TypeParamData, TypeParamProvenance},
10-
type_ref::{LifetimeRef, TraitBoundModifier, TraitRef},
18+
item_tree::{
19+
AssocItem, AttrOwner, Const, Either, Enum, ExternBlock, ExternCrate, Field, FieldAstId,
20+
Fields, FileItemTreeId, FnFlags, Function, GenericArgs, Idx, IdxRange, Impl, ImportAlias,
21+
Interned, ItemTree, ItemTreeData, ItemTreeNode, Macro2, MacroCall, MacroRules, Mod,
22+
ModItem, ModKind, ModPath, Mutability, Name, Param, ParamAstId, Path, Range, RawAttrs,
23+
RawIdx, RawVisibilityId, Static, Struct, StructKind, Trait, TraitAlias, TypeAlias, Union,
24+
Use, UseTree, UseTreeKind, Variant,
25+
},
26+
path::AssociatedTypeBinding,
27+
type_ref::{LifetimeRef, TraitBoundModifier, TraitRef, TypeBound, TypeRef},
28+
visibility::RawVisibility,
1129
LocalLifetimeParamId, LocalTypeOrConstParamId,
1230
};
1331

14-
use super::*;
15-
1632
fn id<N: ItemTreeNode>(index: Idx<N>) -> FileItemTreeId<N> {
1733
FileItemTreeId(index)
1834
}

crates/hir-def/src/item_tree/pretty.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ use span::ErasedFileAstId;
66

77
use crate::{
88
generics::{TypeOrConstParamData, WherePredicate, WherePredicateTypeTarget},
9+
item_tree::{
10+
AttrOwner, Const, DefDatabase, Enum, ExternBlock, ExternCrate, Field, FieldAstId, Fields,
11+
FileItemTreeId, FnFlags, Function, GenericParams, Impl, Interned, ItemTree, Macro2,
12+
MacroCall, MacroRules, Mod, ModItem, ModKind, Param, ParamAstId, Path, RawAttrs,
13+
RawVisibilityId, Static, Struct, Trait, TraitAlias, TypeAlias, TypeBound, TypeRef, Union,
14+
Use, UseTree, UseTreeKind, Variant,
15+
},
916
pretty::{print_path, print_type_bounds, print_type_ref},
1017
visibility::RawVisibility,
1118
};
1219

13-
use super::*;
14-
1520
pub(super) fn print_item_tree(db: &dyn DefDatabase, tree: &ItemTree) -> String {
1621
let mut p = Printer { db, tree, buf: String::new(), indent_level: 0, needs_indent: true };
1722

crates/hir-def/src/nameres.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub mod proc_macro;
5757
#[cfg(test)]
5858
mod tests;
5959

60-
use std::{cmp::Ord, ops::Deref};
60+
use std::ops::Deref;
6161

6262
use base_db::{CrateId, Edition, FileId};
6363
use hir_expand::{

crates/hir-def/src/nameres/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2446,7 +2446,7 @@ mod tests {
24462446
use base_db::SourceDatabase;
24472447
use test_fixture::WithFixture;
24482448

2449-
use crate::{db::DefDatabase, test_db::TestDB};
2449+
use crate::test_db::TestDB;
24502450

24512451
use super::*;
24522452

crates/hir-def/src/nameres/tests/macros.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
use expect_test::expect;
2-
use test_fixture::WithFixture;
32

43
use itertools::Itertools;
54

6-
use crate::nameres::tests::check;
7-
85
use super::*;
96

107
#[test]

crates/hir-ty/src/diagnostics/match_check/pat_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
//! Originates from `rustc_hir::pat_util`
44
5-
use std::iter::{Enumerate, ExactSizeIterator};
5+
use std::iter::Enumerate;
66

77
pub(crate) struct EnumerateAndAdjust<I> {
88
enumerate: Enumerate<I>,

crates/hir-ty/src/mir/eval/shim.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ use hir_def::{
88
builtin_type::{BuiltinInt, BuiltinUint},
99
resolver::HasResolver,
1010
};
11-
use hir_expand::mod_path::ModPath;
1211

13-
use super::*;
12+
use crate::mir::eval::{
13+
name, pad16, static_lifetime, Address, AdtId, Arc, BuiltinType, Evaluator, FunctionId,
14+
HasModule, HirDisplay, Interned, InternedClosure, Interner, Interval, IntervalAndTy,
15+
IntervalOrOwned, ItemContainerId, LangItem, Layout, Locals, Lookup, MirEvalError, MirSpan,
16+
ModPath, Mutability, Result, Substitution, Ty, TyBuilder, TyExt,
17+
};
1418

1519
mod simd;
1620

0 commit comments

Comments
 (0)