aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-03-13 19:38:11 +0000
committerFlorian Diebold <[email protected]>2021-03-13 19:38:45 +0000
commitc82d1823a1624f4990b1ebaba5b6173f15631381 (patch)
tree6c59a0786f78cc5878ddb74a589f1d221d907137 /crates/hir_def
parent17eeb2a6d2ea81b302b6707c63bf8fba489c2bdd (diff)
Create TraitEnvironment through a query
Diffstat (limited to 'crates/hir_def')
-rw-r--r--crates/hir_def/src/lib.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs
index 6d11c5be4..c6655c5fb 100644
--- a/crates/hir_def/src/lib.rs
+++ b/crates/hir_def/src/lib.rs
@@ -341,6 +341,16 @@ pub enum DefWithBodyId {
341 341
342impl_from!(FunctionId, ConstId, StaticId for DefWithBodyId); 342impl_from!(FunctionId, ConstId, StaticId for DefWithBodyId);
343 343
344impl DefWithBodyId {
345 pub fn as_generic_def_id(self) -> Option<GenericDefId> {
346 match self {
347 DefWithBodyId::FunctionId(f) => Some(f.into()),
348 DefWithBodyId::StaticId(_) => None,
349 DefWithBodyId::ConstId(c) => Some(c.into()),
350 }
351 }
352}
353
344#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] 354#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
345pub enum AssocItemId { 355pub enum AssocItemId {
346 FunctionId(FunctionId), 356 FunctionId(FunctionId),