fix false positive for enum with no variants

This commit is contained in:
Josh Mcguigan
2020-04-14 16:06:57 -07:00
parent c82e7696e6
commit 360bdf653b
3 changed files with 51 additions and 3 deletions

View File

@@ -680,6 +680,16 @@ impl Ty {
}
}
pub fn strip_references(&self) -> &Ty {
let mut t: &Ty = self;
while let Ty::Apply(ApplicationTy { ctor: TypeCtor::Ref(_mutability), parameters }) = t {
t = parameters.as_single();
}
t
}
pub fn as_adt(&self) -> Option<(AdtId, &Substs)> {
match self {
Ty::Apply(ApplicationTy { ctor: TypeCtor::Adt(adt_def), parameters }) => {