diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-03-24 21:04:01 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-03-26 21:29:35 -0700 |
| commit | 3b2fcf9f5991effa96c0102adc155bad0b5a4feb (patch) | |
| tree | e8d49983f9ede1d02f614a4af6d3c0ec023c8c8d | |
| parent | a376f46862cef319ca6bb59b9b571e5e0ae55d8d (diff) | |
| download | rust-3b2fcf9f5991effa96c0102adc155bad0b5a4feb.tar.gz rust-3b2fcf9f5991effa96c0102adc155bad0b5a4feb.zip | |
librustc: Fix bug with newtype structs containing dtors
| -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() { +} + + |
