From d6dc75f9f22b73faf8c526be69ca43e52d6db1bf Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Tue, 7 May 2019 18:53:16 +0200 Subject: Handle auto traits & negative impls We don't pass field types to Chalk yet though, so the auto trait inference won't be correct. --- crates/ra_hir/src/impl_block.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir/src/impl_block.rs') diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs index a8a466e43..b7dd775f1 100644 --- a/crates/ra_hir/src/impl_block.rs +++ b/crates/ra_hir/src/impl_block.rs @@ -93,6 +93,10 @@ impl ImplBlock { db.impls_in_module(self.module).impls[self.impl_id].items().to_vec() } + pub fn is_negative(&self, db: &impl DefDatabase) -> bool { + db.impls_in_module(self.module).impls[self.impl_id].negative + } + pub(crate) fn resolver(&self, db: &impl DefDatabase) -> Resolver { let r = self.module().resolver(db); // add generic params, if present @@ -108,6 +112,7 @@ pub struct ImplData { target_trait: Option, target_type: TypeRef, items: Vec, + negative: bool, } impl ImplData { @@ -120,6 +125,7 @@ impl ImplData { let target_trait = node.target_trait().map(TypeRef::from_ast); let target_type = TypeRef::from_ast_opt(node.target_type()); let ctx = LocationCtx::new(db, module, file_id); + let negative = node.is_negative(); let items = if let Some(item_list) = node.item_list() { item_list .impl_items() @@ -132,7 +138,7 @@ impl ImplData { } else { Vec::new() }; - ImplData { target_trait, target_type, items } + ImplData { target_trait, target_type, items, negative } } pub fn target_trait(&self) -> Option<&TypeRef> { -- cgit v1.2.3