Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8578ccc

Browse files
committedNov 23, 2024
Remove #[cfg(test)] related stubs
1 parent 3d67fd4 commit 8578ccc

File tree

6 files changed

+10
-57
lines changed

6 files changed

+10
-57
lines changed
 

‎tests/ui/layout/aggregate-lang/struct-align.rs

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ struct ReprRustStruct {
1616
b: Overaligned,
1717
}
1818

19-
#[cfg_attr(test, test)]
2019
fn test_alignment_contains_all_fields() {
2120
assert!(core::mem::align_of::<ReprRustStruct>() >= core::mem::align_of::<i32>());
2221
assert!(core::mem::align_of::<ReprRustStruct>() >= core::mem::align_of::<[u32; 4]>());
@@ -25,7 +24,6 @@ fn test_alignment_contains_all_fields() {
2524
assert!(core::mem::align_of::<ReprRustStruct>() >= core::mem::align_of::<Overaligned>());
2625
}
2726

28-
#[cfg(not(test))]
2927
fn main() {
3028
test_alignment_contains_all_fields();
3129
}

‎tests/ui/layout/aggregate-lang/struct-offsets.rs

+4-19
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ fn test_non_overlapping(a: &(usize, usize), b: &(usize, usize)) {
3636
assert!((a.1 <= b.0) || (b.1 <= a.0));
3737
}
3838

39-
#[cfg_attr(test, test)]
4039
fn test_fields_non_overlapping() {
4140
let fields = [
4241
span_of!(ReprRustStruct, x),
@@ -62,31 +61,17 @@ fn test_fields_non_overlapping() {
6261
test_non_overlapping(&fields[3], &fields[4]);
6362
}
6463

65-
#[cfg_attr(test, test)]
6664
fn test_fields_aligned() {
67-
assert_eq!(
68-
(core::mem::offset_of!(ReprRustStruct, x) % (core::mem::align_of::<i32>())),
69-
0
70-
);
71-
assert_eq!(
72-
(core::mem::offset_of!(ReprRustStruct, y) % (core::mem::align_of::<[u32; 4]>())),
73-
0
74-
);
75-
assert_eq!(
76-
(core::mem::offset_of!(ReprRustStruct, z) % (core::mem::align_of::<f32>())),
77-
0
78-
);
79-
assert_eq!(
80-
(core::mem::offset_of!(ReprRustStruct, a) % (core::mem::align_of::<u128>())),
81-
0
82-
);
65+
assert_eq!((core::mem::offset_of!(ReprRustStruct, x) % (core::mem::align_of::<i32>())), 0);
66+
assert_eq!((core::mem::offset_of!(ReprRustStruct, y) % (core::mem::align_of::<[u32; 4]>())), 0);
67+
assert_eq!((core::mem::offset_of!(ReprRustStruct, z) % (core::mem::align_of::<f32>())), 0);
68+
assert_eq!((core::mem::offset_of!(ReprRustStruct, a) % (core::mem::align_of::<u128>())), 0);
8369
assert_eq!(
8470
(core::mem::offset_of!(ReprRustStruct, b) % (core::mem::align_of::<Overaligned>())),
8571
0
8672
);
8773
}
8874

89-
#[cfg(not(test))]
9075
fn main() {
9176
test_fields_non_overlapping();
9277
test_fields_aligned();

‎tests/ui/layout/aggregate-lang/struct-size.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ struct ReprRustStruct {
1010
a: u128,
1111
}
1212

13-
#[cfg_attr(test, test)]
1413
fn test_size_contains_all_types() {
1514
assert!(
1615
core::mem::size_of::<ReprRustStruct>()
@@ -21,7 +20,6 @@ fn test_size_contains_all_types() {
2120
);
2221
}
2322

24-
#[cfg_attr(test, test)]
2523
fn test_size_contains_all_fields() {
2624
assert!(
2725
(core::mem::offset_of!(ReprRustStruct, x) + core::mem::size_of::<i32>())
@@ -41,15 +39,10 @@ fn test_size_contains_all_fields() {
4139
);
4240
}
4341

44-
#[cfg_attr(test, test)]
4542
fn test_size_modulo_align() {
46-
assert_eq!(
47-
core::mem::size_of::<ReprRustStruct>() % core::mem::align_of::<ReprRustStruct>(),
48-
0
49-
);
43+
assert_eq!(core::mem::size_of::<ReprRustStruct>() % core::mem::align_of::<ReprRustStruct>(), 0);
5044
}
5145

52-
#[cfg(not(test))]
5346
fn main() {
5447
test_size_contains_all_fields();
5548
test_size_contains_all_types();

‎tests/ui/layout/aggregate-lang/union-align.rs

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ union ReprRustUnion {
1616
b: Overaligned,
1717
}
1818

19-
#[cfg_attr(test, test)]
2019
fn test_alignment_contains_all_fields() {
2120
assert!(core::mem::align_of::<ReprRustUnion>() >= core::mem::align_of::<i32>());
2221
assert!(core::mem::align_of::<ReprRustUnion>() >= core::mem::align_of::<[u32; 4]>());
@@ -25,7 +24,6 @@ fn test_alignment_contains_all_fields() {
2524
assert!(core::mem::align_of::<ReprRustUnion>() >= core::mem::align_of::<Overaligned>());
2625
}
2726

28-
#[cfg(not(test))]
2927
fn main() {
3028
test_alignment_contains_all_fields();
3129
}

‎tests/ui/layout/aggregate-lang/union-offsets.rs

+4-18
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,17 @@ union ReprRustUnion {
1616
b: Overaligned,
1717
}
1818

19-
#[cfg_attr(test, test)]
2019
fn test_fields_aligned() {
21-
assert_eq!(
22-
(core::mem::offset_of!(ReprRustUnion, x) % (core::mem::align_of::<i32>())),
23-
0
24-
);
25-
assert_eq!(
26-
(core::mem::offset_of!(ReprRustUnion, y) % (core::mem::align_of::<[u32; 4]>())),
27-
0
28-
);
29-
assert_eq!(
30-
(core::mem::offset_of!(ReprRustUnion, z) % (core::mem::align_of::<f32>())),
31-
0
32-
);
33-
assert_eq!(
34-
(core::mem::offset_of!(ReprRustUnion, a) % (core::mem::align_of::<u128>())),
35-
0
36-
);
20+
assert_eq!((core::mem::offset_of!(ReprRustUnion, x) % (core::mem::align_of::<i32>())), 0);
21+
assert_eq!((core::mem::offset_of!(ReprRustUnion, y) % (core::mem::align_of::<[u32; 4]>())), 0);
22+
assert_eq!((core::mem::offset_of!(ReprRustUnion, z) % (core::mem::align_of::<f32>())), 0);
23+
assert_eq!((core::mem::offset_of!(ReprRustUnion, a) % (core::mem::align_of::<u128>())), 0);
3724
assert_eq!(
3825
(core::mem::offset_of!(ReprRustUnion, b) % (core::mem::align_of::<Overaligned>())),
3926
0
4027
);
4128
}
4229

43-
#[cfg(not(test))]
4430
fn main() {
4531
test_fields_aligned();
4632
}

‎tests/ui/layout/aggregate-lang/union-size.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ union ReprRustUnion {
1010
a: u128,
1111
}
1212

13-
#[cfg_attr(test, test)]
1413
fn test_size_contains_each_type() {
1514
assert!(core::mem::size_of::<i32>() <= core::mem::size_of::<ReprRustUnion>());
1615
assert!(core::mem::size_of::<[u32; 4]>() <= core::mem::size_of::<ReprRustUnion>());
1716
assert!(core::mem::size_of::<f32>() <= core::mem::size_of::<ReprRustUnion>());
1817
assert!(core::mem::size_of::<u128>() <= core::mem::size_of::<ReprRustUnion>());
1918
}
2019

21-
#[cfg_attr(test, test)]
2220
fn test_size_contains_all_fields() {
2321
assert!(
2422
(core::mem::offset_of!(ReprRustUnion, x) + core::mem::size_of::<i32>())
@@ -38,15 +36,10 @@ fn test_size_contains_all_fields() {
3836
);
3937
}
4038

41-
#[cfg_attr(test, test)]
4239
fn test_size_modulo_align() {
43-
assert_eq!(
44-
core::mem::size_of::<ReprRustUnion>() % core::mem::align_of::<ReprRustUnion>(),
45-
0
46-
);
40+
assert_eq!(core::mem::size_of::<ReprRustUnion>() % core::mem::align_of::<ReprRustUnion>(), 0);
4741
}
4842

49-
#[cfg(not(test))]
5043
fn main() {
5144
test_size_contains_each_type();
5245
test_size_contains_all_fields();

0 commit comments

Comments
 (0)
Failed to load comments.