librustc: Fix bug with newtype structs containing dtors
This commit is contained in:
parent
a376f46862
commit
3b2fcf9f59
2 changed files with 17 additions and 2 deletions
|
|
@ -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 => {
|
||||
|
|
|
|||
17
src/test/run-pass/newtype-struct-with-dtor.rs
Normal file
17
src/test/run-pass/newtype-struct-with-dtor.rs
Normal file
|
|
@ -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() {
|
||||
}
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue