Create TraitEnvironment through a query

This commit is contained in:
Florian Diebold
2021-03-13 20:38:11 +01:00
parent 17eeb2a6d2
commit c82d1823a1
6 changed files with 77 additions and 51 deletions

View File

@@ -341,6 +341,16 @@ pub enum DefWithBodyId {
impl_from!(FunctionId, ConstId, StaticId for DefWithBodyId);
impl DefWithBodyId {
pub fn as_generic_def_id(self) -> Option<GenericDefId> {
match self {
DefWithBodyId::FunctionId(f) => Some(f.into()),
DefWithBodyId::StaticId(_) => None,
DefWithBodyId::ConstId(c) => Some(c.into()),
}
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum AssocItemId {
FunctionId(FunctionId),