Fix rebase, fix some tests

This commit is contained in:
Vadim Petrochenkov 2016-08-26 19:23:42 +03:00
parent 5f975e969b
commit e67c2282af
6 changed files with 23 additions and 22 deletions

View File

@ -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
}
}
}

View File

@ -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

View File

@ -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 {

View File

@ -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() { }

View File

@ -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
}

View File

@ -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`
}