Skip to content

Commit a5d725c

Browse files
committed
cleanup: Refactor away DtorKind
1 parent 4a4f8ff commit a5d725c

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

src/librustc/ty/mod.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
pub use self::Variance::*;
12-
pub use self::DtorKind::*;
1312
pub use self::AssociatedItemContainer::*;
1413
pub use self::BorrowKind::*;
1514
pub use self::IntVarValue::*;
@@ -120,21 +119,6 @@ pub struct Resolutions {
120119
pub maybe_unused_trait_imports: NodeSet,
121120
}
122121

123-
#[derive(Copy, Clone)]
124-
pub enum DtorKind {
125-
NoDtor,
126-
TraitDtor
127-
}
128-
129-
impl DtorKind {
130-
pub fn is_present(&self) -> bool {
131-
match *self {
132-
TraitDtor => true,
133-
_ => false
134-
}
135-
}
136-
}
137-
138122
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
139123
pub enum AssociatedItemContainer {
140124
TraitContainer(DefId),
@@ -1480,7 +1464,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
14801464

14811465
/// Returns whether this type has a destructor.
14821466
pub fn has_dtor(&self) -> bool {
1483-
self.dtor_kind().is_present()
1467+
self.destructor.get().is_some()
14841468
}
14851469

14861470
/// Asserts this is a struct and returns the struct's unique
@@ -1543,13 +1527,6 @@ impl<'a, 'gcx, 'tcx> AdtDef {
15431527
self.destructor.set(Some(dtor));
15441528
}
15451529

1546-
pub fn dtor_kind(&self) -> DtorKind {
1547-
match self.destructor.get() {
1548-
Some(_) => TraitDtor,
1549-
None => NoDtor,
1550-
}
1551-
}
1552-
15531530
/// Returns a simpler type such that `Self: Sized` if and only
15541531
/// if that type is Sized, or `TyErr` if this type is recursive.
15551532
///

src/librustc_trans/glue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ pub fn implement_drop_glue<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, g: DropGlueKi
235235
bcx.call(dtor, &[ptr.llval], None);
236236
bcx
237237
}
238-
ty::TyAdt(def, ..) if def.dtor_kind().is_present() && !skip_dtor => {
238+
ty::TyAdt(def, ..) if def.has_dtor() && !skip_dtor => {
239239
let shallow_drop = def.is_union();
240240
let tcx = bcx.tcx();
241241

0 commit comments

Comments
 (0)