Make univariant enums act like structs, so that they're aligned correctly.

Consts of such enums are aligned correctly, so we could either misalign
them to match the type_of, or fix the type_of.  The latter seems like a
better idea.
This commit is contained in:
Jed Davis 2013-02-10 11:44:47 -08:00
parent 9ea05a4d3e
commit d009c6330b
2 changed files with 29 additions and 3 deletions

View file

@ -0,0 +1,17 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
enum E = u32;
struct S { a: u8, b: E }
const C: S = S { a: 0xA5, b: E(0xDEADBEEF) };
fn main() {
assert C.b == 0xDEADBEEF;
}