cleanup: Refactor away DtorKind

This commit is contained in:
Vadim Petrochenkov 2017-01-30 23:18:22 +03:00
parent 4a4f8ff0a3
commit a5d725cc82
2 changed files with 2 additions and 25 deletions

View File

@ -9,7 +9,6 @@
// except according to those terms.
pub use self::Variance::*;
pub use self::DtorKind::*;
pub use self::AssociatedItemContainer::*;
pub use self::BorrowKind::*;
pub use self::IntVarValue::*;
@ -120,21 +119,6 @@ pub struct Resolutions {
pub maybe_unused_trait_imports: NodeSet,
}
#[derive(Copy, Clone)]
pub enum DtorKind {
NoDtor,
TraitDtor
}
impl DtorKind {
pub fn is_present(&self) -> bool {
match *self {
TraitDtor => true,
_ => false
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum AssociatedItemContainer {
TraitContainer(DefId),
@ -1480,7 +1464,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
/// Returns whether this type has a destructor.
pub fn has_dtor(&self) -> bool {
self.dtor_kind().is_present()
self.destructor.get().is_some()
}
/// Asserts this is a struct and returns the struct's unique
@ -1543,13 +1527,6 @@ impl<'a, 'gcx, 'tcx> AdtDef {
self.destructor.set(Some(dtor));
}
pub fn dtor_kind(&self) -> DtorKind {
match self.destructor.get() {
Some(_) => TraitDtor,
None => NoDtor,
}
}
/// Returns a simpler type such that `Self: Sized` if and only
/// if that type is Sized, or `TyErr` if this type is recursive.
///

View File

@ -235,7 +235,7 @@ pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, g: DropGlueKi
bcx.call(dtor, &[ptr.llval], None);
bcx
}
ty::TyAdt(def, ..) if def.dtor_kind().is_present() && !skip_dtor => {
ty::TyAdt(def, ..) if def.has_dtor() && !skip_dtor => {
let shallow_drop = def.is_union();
let tcx = bcx.tcx();