Skip to content

Commit

Permalink
Fix rebase, fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Sep 3, 2016
1 parent 5f975e9 commit e67c228
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/librustc_trans/adt.rs
Expand Up @@ -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
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/debuginfo/mod.rs
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/glue.rs
Expand Up @@ -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 {
Expand Down
18 changes: 9 additions & 9 deletions src/test/compile-fail/deriving-non-type.rs
Expand Up @@ -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() { }
17 changes: 9 additions & 8 deletions src/test/debuginfo/union-smoke.rs
Expand Up @@ -16,32 +16,33 @@

// 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)]
#![omit_gdb_pretty_printer_section]
#![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
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/incremental/struct_change_field_name.rs
Expand Up @@ -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`
}
Expand Down

0 comments on commit e67c228

Please sign in to comment.