diff --git a/src/librustc_trans/adt.rs b/src/librustc_trans/adt.rs index 7fd02ab82a3f8..15a9d58c9b574 100644 --- a/src/librustc_trans/adt.rs +++ b/src/librustc_trans/adt.rs @@ -749,12 +749,12 @@ fn generic_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, }; match name { None => { - TypeContext::direct(Type::struct_(cx, &[fill_ty], un.packed)) + Type::struct_(cx, &[fill_ty], un.packed) } Some(name) => { let mut llty = Type::named_struct(cx, name); llty.set_struct_body(&[fill_ty], un.packed); - TypeContext::direct(llty) + llty } } } diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs index a3a7a79fb58be..20a33498475a2 100644 --- a/src/librustc_trans/debuginfo/mod.rs +++ b/src/librustc_trans/debuginfo/mod.rs @@ -421,7 +421,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, // Only "class" methods are generally understood by LLVM, // so avoid methods on other types (e.g. `<*mut T>::null`). match impl_self_ty.sty { - ty::TyStruct(..) | ty::TyEnum(..) => { + ty::TyStruct(..) | ty::TyUnion(..) | ty::TyEnum(..) => { Some(type_metadata(cx, impl_self_ty, syntax_pos::DUMMY_SP)) } _ => None diff --git a/src/librustc_trans/glue.rs b/src/librustc_trans/glue.rs index 0d62a63b89fc9..bb77db8fd6947 100644 --- a/src/librustc_trans/glue.rs +++ b/src/librustc_trans/glue.rs @@ -489,7 +489,7 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, g: DropGlueK } ty::TyStruct(def, _) | ty::TyEnum(def, _) if def.dtor_kind().is_present() && !skip_dtor => { - trans_struct_drop(bcx, t, v0) + trans_struct_drop(bcx, t, v0, false) } ty::TyUnion(def, _) => { if def.dtor_kind().is_present() && !skip_dtor { diff --git a/src/test/compile-fail/deriving-non-type.rs b/src/test/compile-fail/deriving-non-type.rs index 5b215f3ccd961..84dd22435b888 100644 --- a/src/test/compile-fail/deriving-non-type.rs +++ b/src/test/compile-fail/deriving-non-type.rs @@ -12,29 +12,29 @@ struct S; -#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums +#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions trait T { } -#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums +#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions impl S { } -#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums +#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions impl T for S { } -#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums +#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions static s: usize = 0; -#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums +#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions const c: usize = 0; -#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums +#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions mod m { } -#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums +#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions extern "C" { } -#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums +#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions type A = usize; -#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums +#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions fn main() { } diff --git a/src/test/debuginfo/union-smoke.rs b/src/test/debuginfo/union-smoke.rs index 11ee5031ca771..17dea300ff9d6 100644 --- a/src/test/debuginfo/union-smoke.rs +++ b/src/test/debuginfo/union-smoke.rs @@ -16,17 +16,17 @@ // gdb-command:run // gdb-command:print u -// gdb-check:$1 = {a = 11 '\v', b = 11} +// gdb-check:$1 = {a = {__0 = 2 '\002', __1 = 2 '\002'}, b = 514} // gdb-command:print union_smoke::SU -// gdb-check:$2 = {a = 10 '\n', b = 10} +// gdb-check:$2 = {a = {__0 = 1 '\001', __1 = 1 '\001'}, b = 257} // === LLDB TESTS ================================================================================== // lldb-command:run // lldb-command:print a -// lldb-check:[...]$0 = {a = 11 '\v', b = 11} +// lldb-check:[...]$0 = {a = {__0 = 2 '\002', __1 = 2 '\002'}, b = 514} // lldb-command:print union_smoke::SU -// lldb-check:[...]$1 = {a = 10 '\n', b = 10} +// lldb-check:[...]$1 = {a = {__0 = 1 '\001', __1 = 1 '\001'}, b = 257} #![allow(unused)] #![feature(omit_gdb_pretty_printer_section)] @@ -34,14 +34,15 @@ #![feature(untagged_unions)] union U { - a: u8, - b: u64, + a: (u8, u8), + b: u16, } -static SU: U = U { a: 10 }; +static mut SU: U = U { a: (1, 1) }; fn main() { - let u = U { b: 11 }; + let u = U { b: (2 << 8) + 2 }; + unsafe { SU = U { a: (1, 1) } } zzz(); // #break } diff --git a/src/test/incremental/struct_change_field_name.rs b/src/test/incremental/struct_change_field_name.rs index ba469c62002e4..c27294442e7a4 100644 --- a/src/test/incremental/struct_change_field_name.rs +++ b/src/test/incremental/struct_change_field_name.rs @@ -37,7 +37,7 @@ pub struct Y { #[rustc_dirty(label="TypeckItemBody", cfg="cfail2")] pub fn use_X() -> u32 { let x: X = X { x: 22 }; - //[cfail2]~^ ERROR structure `X` has no field named `x` + //[cfail2]~^ ERROR struct `X` has no field named `x` x.x as u32 //[cfail2]~^ ERROR attempted access of field `x` }