2012-12-10 19:32:48 -06:00
|
|
|
// Copyright 2012 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.
|
|
|
|
|
2011-11-01 14:10:46 -05:00
|
|
|
// Issue #1112
|
|
|
|
// Alignment of interior pointers to dynamic-size types
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
struct X<T> {
|
2011-11-01 14:10:46 -05:00
|
|
|
a: T,
|
|
|
|
b: u8,
|
|
|
|
c: bool,
|
|
|
|
d: u8,
|
|
|
|
e: u16,
|
|
|
|
f: u8,
|
|
|
|
g: u8
|
2013-01-26 00:46:32 -06:00
|
|
|
}
|
2011-11-01 14:10:46 -05:00
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() {
|
2013-01-26 00:46:32 -06:00
|
|
|
let x: X<int> = X {
|
2011-11-01 14:10:46 -05:00
|
|
|
a: 12345678,
|
2015-03-03 02:42:26 -06:00
|
|
|
b: 9,
|
2011-11-01 14:10:46 -05:00
|
|
|
c: true,
|
2015-03-03 02:42:26 -06:00
|
|
|
d: 10,
|
|
|
|
e: 11,
|
|
|
|
f: 12,
|
|
|
|
g: 13
|
2011-11-01 14:10:46 -05:00
|
|
|
};
|
|
|
|
bar(x);
|
|
|
|
}
|
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
fn bar<T>(x: X<T>) {
|
2015-03-03 02:42:26 -06:00
|
|
|
assert_eq!(x.b, 9);
|
2013-05-18 21:02:45 -05:00
|
|
|
assert_eq!(x.c, true);
|
2015-03-03 02:42:26 -06:00
|
|
|
assert_eq!(x.d, 10);
|
|
|
|
assert_eq!(x.e, 11);
|
|
|
|
assert_eq!(x.f, 12);
|
|
|
|
assert_eq!(x.g, 13);
|
2012-12-13 15:05:22 -06:00
|
|
|
}
|