diff options
| -rw-r--r-- | src/librustc/middle/trans/datum.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/newtype-struct-with-dtor.rs | 17 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index bb7fae9ae33..f81973e169d 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -679,7 +679,6 @@ pub impl Datum { } let repr = adt::represent_type(ccx, self.ty); - fail_unless!(adt::is_newtypeish(repr)); let ty = ty::subst(ccx.tcx, substs, variants[0].args[0]); return match self.mode { ByRef => { @@ -719,7 +718,6 @@ pub impl Datum { } let repr = adt::represent_type(ccx, self.ty); - fail_unless!(adt::is_newtypeish(repr)); let ty = fields[0].mt.ty; return match self.mode { ByRef => { diff --git a/src/test/run-pass/newtype-struct-with-dtor.rs b/src/test/run-pass/newtype-struct-with-dtor.rs new file mode 100644 index 00000000000..f4a059018d2 --- /dev/null +++ b/src/test/run-pass/newtype-struct-with-dtor.rs @@ -0,0 +1,17 @@ +use core::libc::c_int; +use core::libc; + +pub struct Fd(c_int); + +impl Drop for Fd { + fn finalize(&self) { + unsafe { + libc::close(**self); + } + } +} + +fn main() { +} + + |
