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