2017-05-13 09:54:50 +00:00
|
|
|
// run-pass
|
|
|
|
|
2016-08-22 23:51:37 +00:00
|
|
|
#![warn(variant_size_differences)]
|
2014-05-19 21:57:24 +00:00
|
|
|
#![allow(dead_code)]
|
|
|
|
|
2016-11-21 19:23:15 +00:00
|
|
|
// Note that the following test works because all fields of the enum variants are of the same size.
|
|
|
|
// If this test is modified and the reordering logic in librustc/ty/layout.rs kicks in, it fails.
|
2016-11-16 22:00:35 +00:00
|
|
|
|
2014-05-19 21:57:24 +00:00
|
|
|
enum Enum1 { }
|
|
|
|
|
|
|
|
enum Enum2 { A, B, C }
|
|
|
|
|
2017-07-06 05:54:58 +00:00
|
|
|
enum Enum3 { D(i64), E, F }
|
2014-05-19 21:57:24 +00:00
|
|
|
|
2017-07-06 05:54:58 +00:00
|
|
|
enum Enum4 { H(i64), I(i64), J }
|
2014-05-19 21:57:24 +00:00
|
|
|
|
2016-08-22 23:51:37 +00:00
|
|
|
enum Enum5 {
|
2017-07-06 05:54:58 +00:00
|
|
|
L(i64, i64, i64, i64), //~ WARNING three times larger
|
|
|
|
M(i64),
|
2014-05-19 21:57:24 +00:00
|
|
|
N
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Enum6<T, U> {
|
|
|
|
O(T),
|
|
|
|
P(U),
|
2017-07-06 05:54:58 +00:00
|
|
|
Q(i64)
|
2014-05-19 21:57:24 +00:00
|
|
|
}
|
|
|
|
|
2016-08-22 23:51:37 +00:00
|
|
|
#[allow(variant_size_differences)]
|
2014-05-19 21:57:24 +00:00
|
|
|
enum Enum7 {
|
2017-07-06 05:54:58 +00:00
|
|
|
R(i64, i64, i64, i64),
|
|
|
|
S(i64),
|
2014-05-19 21:57:24 +00:00
|
|
|
T
|
|
|
|
}
|
|
|
|
pub fn main() { }
|