diff options
| author | bors <bors@rust-lang.org> | 2013-05-30 23:31:48 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-30 23:31:48 -0700 |
| commit | 6fcb483609dec71ec6fd13aaf9bea9080990043a (patch) | |
| tree | 56540ff642c4bb2e78d08a4e9b3173036f14ba7c | |
| parent | 727274375eba491e01343a3802ac7fbe162d7c9e (diff) | |
| parent | 40b455792d441ef431dfb4de6bdfe082d104269b (diff) | |
| download | rust-6fcb483609dec71ec6fd13aaf9bea9080990043a.tar.gz rust-6fcb483609dec71ec6fd13aaf9bea9080990043a.zip | |
auto merge of #6848 : pcwalton/rust/issue-6352, r=pcwalton
r? @nikomatsakis
| -rw-r--r-- | src/librustc/middle/trans/adt.rs | 1 | ||||
| -rw-r--r-- | src/test/run-pass/const-struct-offsets.rs | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/librustc/middle/trans/adt.rs b/src/librustc/middle/trans/adt.rs index 4d1c4851e1f..b26f80fc355 100644 --- a/src/librustc/middle/trans/adt.rs +++ b/src/librustc/middle/trans/adt.rs @@ -563,6 +563,7 @@ fn build_const_struct(ccx: @CrateContext, st: &Struct, vals: &[ValueRef]) vals[i] }; cfields.push(val); + offset += machine::llsize_of_alloc(ccx, llty) as u64 } return cfields; diff --git a/src/test/run-pass/const-struct-offsets.rs b/src/test/run-pass/const-struct-offsets.rs new file mode 100644 index 00000000000..0966fa055bf --- /dev/null +++ b/src/test/run-pass/const-struct-offsets.rs @@ -0,0 +1,14 @@ +enum Foo { + IntVal(i32), + Int64Val(i64) +} + +struct Bar { + i: i32, + v: Foo +} + +static bar: Bar = Bar { i: 0, v: IntVal(0) }; + +fn main() {} + |
