aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/code_model.rs2
-rw-r--r--crates/ra_hir/src/from_source.rs6
-rw-r--r--crates/ra_hir/src/has_source.rs2
-rw-r--r--crates/ra_hir_def/src/attr.rs2
-rw-r--r--crates/ra_hir_def/src/child_by_source.rs4
-rw-r--r--crates/ra_hir_def/src/data.rs6
-rw-r--r--crates/ra_hir_def/src/db.rs6
-rw-r--r--crates/ra_hir_def/src/docs.rs2
-rw-r--r--crates/ra_hir_def/src/generics.rs2
-rw-r--r--crates/ra_hir_def/src/keys.rs4
-rw-r--r--crates/ra_hir_def/src/lib.rs30
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs9
-rw-r--r--crates/ra_hir_def/src/resolver.rs8
-rw-r--r--crates/ra_hir_def/src/src.rs11
-rw-r--r--crates/ra_hir_expand/src/builtin_macro.rs5
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs6
16 files changed, 70 insertions, 35 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 117ca2fe3..78c7792bf 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -577,7 +577,7 @@ pub struct Trait {
577 577
578impl Trait { 578impl Trait {
579 pub fn module(self, db: &impl DefDatabase) -> Module { 579 pub fn module(self, db: &impl DefDatabase) -> Module {
580 Module { id: self.id.module(db) } 580 Module { id: self.id.lookup(db).container }
581 } 581 }
582 582
583 pub fn name(self, db: &impl DefDatabase) -> Name { 583 pub fn name(self, db: &impl DefDatabase) -> Name {
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index b35188a21..0cf4bcae1 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -44,8 +44,10 @@ impl FromSource for Enum {
44impl FromSource for Trait { 44impl FromSource for Trait {
45 type Ast = ast::TraitDef; 45 type Ast = ast::TraitDef;
46 fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> { 46 fn from_source(db: &(impl DefDatabase + AstDatabase), src: InFile<Self::Ast>) -> Option<Self> {
47 let id = from_source(db, src)?; 47 // XXX: use `.parent()` to avoid finding ourselves
48 Some(Trait { id }) 48 let parent = src.value.syntax().parent()?;
49 let container = Container::find(db, src.with_value(parent).as_ref())?;
50 container.child_by_source(db)[keys::TRAIT].get(&src).copied().map(Trait::from)
49 } 51 }
50} 52}
51impl FromSource for Function { 53impl FromSource for Function {
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs
index a888fe995..c4c6d66b7 100644
--- a/crates/ra_hir/src/has_source.rs
+++ b/crates/ra_hir/src/has_source.rs
@@ -93,7 +93,7 @@ impl HasSource for Static {
93impl HasSource for Trait { 93impl HasSource for Trait {
94 type Ast = ast::TraitDef; 94 type Ast = ast::TraitDef;
95 fn source(self, db: &impl DefDatabase) -> InFile<ast::TraitDef> { 95 fn source(self, db: &impl DefDatabase) -> InFile<ast::TraitDef> {
96 self.id.source(db) 96 self.id.lookup(db).source(db)
97 } 97 }
98} 98}
99impl HasSource for TypeAlias { 99impl HasSource for TypeAlias {
diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs
index 12d4e777a..3347d819c 100644
--- a/crates/ra_hir_def/src/attr.rs
+++ b/crates/ra_hir_def/src/attr.rs
@@ -60,7 +60,7 @@ impl Attrs {
60 AdtId::EnumId(it) => attrs_from_ast(it.lookup_intern(db).ast_id, db), 60 AdtId::EnumId(it) => attrs_from_ast(it.lookup_intern(db).ast_id, db),
61 AdtId::UnionId(it) => attrs_from_ast(it.lookup_intern(db).ast_id, db), 61 AdtId::UnionId(it) => attrs_from_ast(it.lookup_intern(db).ast_id, db),
62 }, 62 },
63 AttrDefId::TraitId(it) => attrs_from_ast(it.lookup_intern(db).ast_id, db), 63 AttrDefId::TraitId(it) => attrs_from_loc(it.lookup(db), db),
64 AttrDefId::MacroDefId(it) => { 64 AttrDefId::MacroDefId(it) => {
65 it.ast_id.map_or_else(Default::default, |ast_id| attrs_from_ast(ast_id, db)) 65 it.ast_id.map_or_else(Default::default, |ast_id| attrs_from_ast(ast_id, db))
66 } 66 }
diff --git a/crates/ra_hir_def/src/child_by_source.rs b/crates/ra_hir_def/src/child_by_source.rs
index 821549bd5..88c2d3f24 100644
--- a/crates/ra_hir_def/src/child_by_source.rs
+++ b/crates/ra_hir_def/src/child_by_source.rs
@@ -94,6 +94,10 @@ impl ChildBySource for ModuleId {
94 let src = ty.lookup(db).source(db); 94 let src = ty.lookup(db).source(db);
95 res[keys::TYPE_ALIAS].insert(src, ty) 95 res[keys::TYPE_ALIAS].insert(src, ty)
96 } 96 }
97 ModuleDefId::TraitId(trait_) => {
98 let src = trait_.lookup(db).source(db);
99 res[keys::TRAIT].insert(src, trait_)
100 }
97 _ => (), 101 _ => (),
98 } 102 }
99 } 103 }
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs
index 42821b9b1..b2dac183e 100644
--- a/crates/ra_hir_def/src/data.rs
+++ b/crates/ra_hir_def/src/data.rs
@@ -12,8 +12,8 @@ use crate::{
12 db::DefDatabase, 12 db::DefDatabase,
13 src::HasSource, 13 src::HasSource,
14 type_ref::{Mutability, TypeRef}, 14 type_ref::{Mutability, TypeRef},
15 AssocItemId, AstItemDef, ConstId, ConstLoc, ContainerId, FunctionId, FunctionLoc, ImplId, 15 AssocItemId, ConstId, ConstLoc, ContainerId, FunctionId, FunctionLoc, ImplId, Intern, Lookup,
16 Intern, Lookup, StaticId, TraitId, TypeAliasId, TypeAliasLoc, 16 StaticId, TraitId, TypeAliasId, TypeAliasLoc,
17}; 17};
18 18
19#[derive(Debug, Clone, PartialEq, Eq)] 19#[derive(Debug, Clone, PartialEq, Eq)]
@@ -94,7 +94,7 @@ pub struct TraitData {
94 94
95impl TraitData { 95impl TraitData {
96 pub(crate) fn trait_data_query(db: &impl DefDatabase, tr: TraitId) -> Arc<TraitData> { 96 pub(crate) fn trait_data_query(db: &impl DefDatabase, tr: TraitId) -> Arc<TraitData> {
97 let src = tr.source(db); 97 let src = tr.lookup(db).source(db);
98 let name = src.value.name().map_or_else(Name::missing, |n| n.as_name()); 98 let name = src.value.name().map_or_else(Name::missing, |n| n.as_name());
99 let auto = src.value.is_auto(); 99 let auto = src.value.is_auto();
100 let ast_id_map = db.ast_id_map(src.file_id); 100 let ast_id_map = db.ast_id_map(src.file_id);
diff --git a/crates/ra_hir_def/src/db.rs b/crates/ra_hir_def/src/db.rs
index 8907aacca..f0c2ae559 100644
--- a/crates/ra_hir_def/src/db.rs
+++ b/crates/ra_hir_def/src/db.rs
@@ -18,8 +18,8 @@ use crate::{
18 CrateDefMap, 18 CrateDefMap,
19 }, 19 },
20 AttrDefId, ConstId, ConstLoc, DefWithBodyId, EnumId, FunctionId, FunctionLoc, GenericDefId, 20 AttrDefId, ConstId, ConstLoc, DefWithBodyId, EnumId, FunctionId, FunctionLoc, GenericDefId,
21 ImplId, ImplLoc, ItemLoc, ModuleId, StaticId, StaticLoc, StructId, TraitId, TypeAliasId, 21 ImplId, ImplLoc, ItemLoc, ModuleId, StaticId, StaticLoc, StructId, TraitId, TraitLoc,
22 TypeAliasLoc, UnionId, 22 TypeAliasId, TypeAliasLoc, UnionId,
23}; 23};
24 24
25#[salsa::query_group(InternDatabaseStorage)] 25#[salsa::query_group(InternDatabaseStorage)]
@@ -37,7 +37,7 @@ pub trait InternDatabase: SourceDatabase {
37 #[salsa::interned] 37 #[salsa::interned]
38 fn intern_static(&self, loc: StaticLoc) -> StaticId; 38 fn intern_static(&self, loc: StaticLoc) -> StaticId;
39 #[salsa::interned] 39 #[salsa::interned]
40 fn intern_trait(&self, loc: ItemLoc<ast::TraitDef>) -> TraitId; 40 fn intern_trait(&self, loc: TraitLoc) -> TraitId;
41 #[salsa::interned] 41 #[salsa::interned]
42 fn intern_type_alias(&self, loc: TypeAliasLoc) -> TypeAliasId; 42 fn intern_type_alias(&self, loc: TypeAliasLoc) -> TypeAliasId;
43 #[salsa::interned] 43 #[salsa::interned]
diff --git a/crates/ra_hir_def/src/docs.rs b/crates/ra_hir_def/src/docs.rs
index 61727bd26..1921681fb 100644
--- a/crates/ra_hir_def/src/docs.rs
+++ b/crates/ra_hir_def/src/docs.rs
@@ -59,7 +59,7 @@ impl Documentation {
59 let src = it.parent.child_source(db); 59 let src = it.parent.child_source(db);
60 docs_from_ast(&src.value[it.local_id]) 60 docs_from_ast(&src.value[it.local_id])
61 } 61 }
62 AttrDefId::TraitId(it) => docs_from_ast(&it.source(db).value), 62 AttrDefId::TraitId(it) => docs_from_ast(&it.lookup(db).source(db).value),
63 AttrDefId::MacroDefId(it) => docs_from_ast(&it.ast_id?.to_node(db)), 63 AttrDefId::MacroDefId(it) => docs_from_ast(&it.ast_id?.to_node(db)),
64 AttrDefId::ConstId(it) => docs_from_ast(&it.lookup(db).source(db).value), 64 AttrDefId::ConstId(it) => docs_from_ast(&it.lookup(db).source(db).value),
65 AttrDefId::StaticId(it) => docs_from_ast(&it.lookup(db).source(db).value), 65 AttrDefId::StaticId(it) => docs_from_ast(&it.lookup(db).source(db).value),
diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs
index 5d1100945..cbfc3ff04 100644
--- a/crates/ra_hir_def/src/generics.rs
+++ b/crates/ra_hir_def/src/generics.rs
@@ -86,7 +86,7 @@ impl GenericParams {
86 src.file_id 86 src.file_id
87 } 87 }
88 GenericDefId::TraitId(it) => { 88 GenericDefId::TraitId(it) => {
89 let src = it.source(db); 89 let src = it.lookup(db).source(db);
90 90
91 // traits get the Self type as an implicit first type parameter 91 // traits get the Self type as an implicit first type parameter
92 let self_param_id = 92 let self_param_id =
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs
index d318b2451..6ec58f5f9 100644
--- a/crates/ra_hir_def/src/keys.rs
+++ b/crates/ra_hir_def/src/keys.rs
@@ -8,7 +8,8 @@ use rustc_hash::FxHashMap;
8 8
9use crate::{ 9use crate::{
10 dyn_map::{DynMap, Policy}, 10 dyn_map::{DynMap, Policy},
11 ConstId, EnumVariantId, FunctionId, ImplId, StaticId, StructFieldId, TypeAliasId, TypeParamId, 11 ConstId, EnumVariantId, FunctionId, ImplId, StaticId, StructFieldId, TraitId, TypeAliasId,
12 TypeParamId,
12}; 13};
13 14
14type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>; 15type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>;
@@ -18,6 +19,7 @@ pub const CONST: Key<ast::ConstDef, ConstId> = Key::new();
18pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new(); 19pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new();
19pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new(); 20pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new();
20pub const IMPL: Key<ast::ImplBlock, ImplId> = Key::new(); 21pub const IMPL: Key<ast::ImplBlock, ImplId> = Key::new();
22pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new();
21 23
22pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new(); 24pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new();
23pub const TUPLE_FIELD: Key<ast::TupleFieldDef, StructFieldId> = Key::new(); 25pub const TUPLE_FIELD: Key<ast::TupleFieldDef, StructFieldId> = Key::new();
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs
index 5564b166b..0fcc2cde4 100644
--- a/crates/ra_hir_def/src/lib.rs
+++ b/crates/ra_hir_def/src/lib.rs
@@ -253,12 +253,24 @@ impl Lookup for StaticId {
253#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 253#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
254pub struct TraitId(salsa::InternId); 254pub struct TraitId(salsa::InternId);
255impl_intern_key!(TraitId); 255impl_intern_key!(TraitId);
256impl AstItemDef<ast::TraitDef> for TraitId { 256
257 fn intern(db: &impl InternDatabase, loc: ItemLoc<ast::TraitDef>) -> Self { 257#[derive(Debug, Clone, PartialEq, Eq, Hash)]
258 db.intern_trait(loc) 258pub struct TraitLoc {
259 pub container: ModuleId,
260 pub ast_id: AstId<ast::TraitDef>,
261}
262
263impl Intern for TraitLoc {
264 type ID = TraitId;
265 fn intern(self, db: &impl db::DefDatabase) -> TraitId {
266 db.intern_trait(self)
259 } 267 }
260 fn lookup_intern(self, db: &impl InternDatabase) -> ItemLoc<ast::TraitDef> { 268}
261 db.lookup_intern_trait(self) 269
270impl Lookup for TraitId {
271 type Data = TraitLoc;
272 fn lookup(&self, db: &impl db::DefDatabase) -> TraitLoc {
273 db.lookup_intern_trait(*self)
262 } 274 }
263} 275}
264 276
@@ -492,7 +504,7 @@ impl HasModule for FunctionLoc {
492 match self.container { 504 match self.container {
493 ContainerId::ModuleId(it) => it, 505 ContainerId::ModuleId(it) => it,
494 ContainerId::ImplId(it) => it.lookup(db).container, 506 ContainerId::ImplId(it) => it.lookup(db).container,
495 ContainerId::TraitId(it) => it.module(db), 507 ContainerId::TraitId(it) => it.lookup(db).container,
496 } 508 }
497 } 509 }
498} 510}
@@ -502,7 +514,7 @@ impl HasModule for TypeAliasLoc {
502 match self.container { 514 match self.container {
503 ContainerId::ModuleId(it) => it, 515 ContainerId::ModuleId(it) => it,
504 ContainerId::ImplId(it) => it.lookup(db).container, 516 ContainerId::ImplId(it) => it.lookup(db).container,
505 ContainerId::TraitId(it) => it.module(db), 517 ContainerId::TraitId(it) => it.lookup(db).container,
506 } 518 }
507 } 519 }
508} 520}
@@ -512,7 +524,7 @@ impl HasModule for ConstLoc {
512 match self.container { 524 match self.container {
513 ContainerId::ModuleId(it) => it, 525 ContainerId::ModuleId(it) => it,
514 ContainerId::ImplId(it) => it.lookup(db).container, 526 ContainerId::ImplId(it) => it.lookup(db).container,
515 ContainerId::TraitId(it) => it.module(db), 527 ContainerId::TraitId(it) => it.lookup(db).container,
516 } 528 }
517 } 529 }
518} 530}
@@ -542,7 +554,7 @@ impl HasModule for GenericDefId {
542 match self { 554 match self {
543 GenericDefId::FunctionId(it) => it.lookup(db).module(db), 555 GenericDefId::FunctionId(it) => it.lookup(db).module(db),
544 GenericDefId::AdtId(it) => it.module(db), 556 GenericDefId::AdtId(it) => it.module(db),
545 GenericDefId::TraitId(it) => it.module(db), 557 GenericDefId::TraitId(it) => it.lookup(db).container,
546 GenericDefId::TypeAliasId(it) => it.lookup(db).module(db), 558 GenericDefId::TypeAliasId(it) => it.lookup(db).module(db),
547 GenericDefId::ImplId(it) => it.lookup(db).container, 559 GenericDefId::ImplId(it) => it.lookup(db).container,
548 GenericDefId::EnumVariantId(it) => it.parent.module(db), 560 GenericDefId::EnumVariantId(it) => it.parent.module(db),
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index b33507a9a..a7bdd620b 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -26,7 +26,7 @@ use crate::{
26 per_ns::PerNs, 26 per_ns::PerNs,
27 AdtId, AstId, AstItemDef, ConstLoc, ContainerId, EnumId, EnumVariantId, FunctionLoc, ImplLoc, 27 AdtId, AstId, AstItemDef, ConstLoc, ContainerId, EnumId, EnumVariantId, FunctionLoc, ImplLoc,
28 Intern, LocalImportId, LocalModuleId, LocationCtx, ModuleDefId, ModuleId, StaticLoc, StructId, 28 Intern, LocalImportId, LocalModuleId, LocationCtx, ModuleDefId, ModuleId, StaticLoc, StructId,
29 TraitId, TypeAliasLoc, UnionId, 29 TraitLoc, TypeAliasLoc, UnionId,
30}; 30};
31 31
32pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap { 32pub(super) fn collect_defs(db: &impl DefDatabase, mut def_map: CrateDefMap) -> CrateDefMap {
@@ -796,7 +796,12 @@ where
796 796
797 PerNs::values(def.into()) 797 PerNs::values(def.into())
798 } 798 }
799 raw::DefKind::Trait(ast_id) => PerNs::types(TraitId::from_ast_id(ctx, ast_id).into()), 799 raw::DefKind::Trait(ast_id) => {
800 let def = TraitLoc { container: module, ast_id: AstId::new(self.file_id, ast_id) }
801 .intern(self.def_collector.db);
802
803 PerNs::types(def.into())
804 }
800 raw::DefKind::TypeAlias(ast_id) => { 805 raw::DefKind::TypeAlias(ast_id) => {
801 let def = TypeAliasLoc { 806 let def = TypeAliasLoc {
802 container: ContainerId::ModuleId(module), 807 container: ContainerId::ModuleId(module),
diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs
index f87b16b44..17b2169d2 100644
--- a/crates/ra_hir_def/src/resolver.rs
+++ b/crates/ra_hir_def/src/resolver.rs
@@ -17,9 +17,9 @@ use crate::{
17 nameres::{BuiltinShadowMode, CrateDefMap}, 17 nameres::{BuiltinShadowMode, CrateDefMap},
18 path::{Path, PathKind}, 18 path::{Path, PathKind},
19 per_ns::PerNs, 19 per_ns::PerNs,
20 AdtId, AstItemDef, ConstId, ContainerId, DefWithBodyId, EnumId, EnumVariantId, FunctionId, 20 AdtId, ConstId, ContainerId, DefWithBodyId, EnumId, EnumVariantId, FunctionId, GenericDefId,
21 GenericDefId, HasModule, ImplId, LocalModuleId, Lookup, ModuleDefId, ModuleId, StaticId, 21 HasModule, ImplId, LocalModuleId, Lookup, ModuleDefId, ModuleId, StaticId, StructId, TraitId,
22 StructId, TraitId, TypeAliasId, TypeParamId, VariantId, 22 TypeAliasId, TypeParamId, VariantId,
23}; 23};
24 24
25#[derive(Debug, Clone, Default)] 25#[derive(Debug, Clone, Default)]
@@ -524,7 +524,7 @@ impl HasResolver for ModuleId {
524 524
525impl HasResolver for TraitId { 525impl HasResolver for TraitId {
526 fn resolver(self, db: &impl DefDatabase) -> Resolver { 526 fn resolver(self, db: &impl DefDatabase) -> Resolver {
527 self.module(db).resolver(db).push_generic_params_scope(db, self.into()) 527 self.lookup(db).container.resolver(db).push_generic_params_scope(db, self.into())
528 } 528 }
529} 529}
530 530
diff --git a/crates/ra_hir_def/src/src.rs b/crates/ra_hir_def/src/src.rs
index a5c4359a7..858e4861e 100644
--- a/crates/ra_hir_def/src/src.rs
+++ b/crates/ra_hir_def/src/src.rs
@@ -4,7 +4,7 @@ use hir_expand::InFile;
4use ra_arena::map::ArenaMap; 4use ra_arena::map::ArenaMap;
5use ra_syntax::ast; 5use ra_syntax::ast;
6 6
7use crate::{db::DefDatabase, ConstLoc, FunctionLoc, ImplLoc, StaticLoc, TypeAliasLoc}; 7use crate::{db::DefDatabase, ConstLoc, FunctionLoc, ImplLoc, StaticLoc, TraitLoc, TypeAliasLoc};
8 8
9pub trait HasSource { 9pub trait HasSource {
10 type Value; 10 type Value;
@@ -56,6 +56,15 @@ impl HasSource for ImplLoc {
56 } 56 }
57} 57}
58 58
59impl HasSource for TraitLoc {
60 type Value = ast::TraitDef;
61
62 fn source(&self, db: &impl DefDatabase) -> InFile<ast::TraitDef> {
63 let node = self.ast_id.to_node(db);
64 InFile::new(self.ast_id.file_id, node)
65 }
66}
67
59pub trait HasChildSource { 68pub trait HasChildSource {
60 type ChildId; 69 type ChildId;
61 type Value; 70 type Value;
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs
index ec5ace757..be5f3cbe3 100644
--- a/crates/ra_hir_expand/src/builtin_macro.rs
+++ b/crates/ra_hir_expand/src/builtin_macro.rs
@@ -367,6 +367,9 @@ mod tests {
367 BuiltinFnLikeExpander::FormatArgs, 367 BuiltinFnLikeExpander::FormatArgs,
368 ); 368 );
369 369
370 assert_eq!(expanded, r#"std::fmt::Arguments::new_v1(&[] ,&[std::fmt::ArgumentV1::new(&(arg1(a,b,c)),std::fmt::Display::fmt),std::fmt::ArgumentV1::new(&(arg2),std::fmt::Display::fmt),])"#); 370 assert_eq!(
371 expanded,
372 r#"std::fmt::Arguments::new_v1(&[] ,&[std::fmt::ArgumentV1::new(&(arg1(a,b,c)),std::fmt::Display::fmt),std::fmt::ArgumentV1::new(&(arg2),std::fmt::Display::fmt),])"#
373 );
371 } 374 }
372} 375}
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index ff299f511..fc21872b2 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -9,9 +9,7 @@ use chalk_ir::{
9}; 9};
10use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum}; 10use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum};
11 11
12use hir_def::{ 12use hir_def::{AssocItemId, ContainerId, GenericDefId, ImplId, Lookup, TraitId, TypeAliasId};
13 AssocItemId, AstItemDef, ContainerId, GenericDefId, ImplId, Lookup, TraitId, TypeAliasId,
14};
15use ra_db::{ 13use ra_db::{
16 salsa::{InternId, InternKey}, 14 salsa::{InternId, InternKey},
17 CrateId, 15 CrateId,
@@ -593,7 +591,7 @@ pub(crate) fn trait_datum_query(
593 let bound_vars = Substs::bound_vars(&generic_params); 591 let bound_vars = Substs::bound_vars(&generic_params);
594 let flags = chalk_rust_ir::TraitFlags { 592 let flags = chalk_rust_ir::TraitFlags {
595 auto: trait_data.auto, 593 auto: trait_data.auto,
596 upstream: trait_.module(db).krate != krate, 594 upstream: trait_.lookup(db).container.krate != krate,
597 non_enumerable: true, 595 non_enumerable: true,
598 coinductive: false, // only relevant for Chalk testing 596 coinductive: false, // only relevant for Chalk testing
599 // FIXME set these flags correctly 597 // FIXME set these flags correctly