Skip to content

Commit

Permalink
Normalize layout test to protect against android alignment differences
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Apr 8, 2024
1 parent 84acfe8 commit b6ab3ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions tests/ui/type/pattern_types/range_patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#![feature(core_pattern_types)]
#![allow(incomplete_features)]

//@ normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN"

use std::pat::pattern_type;

#[rustc_layout(debug)]
Expand Down
28 changes: 14 additions & 14 deletions tests/ui/type/pattern_types/range_patterns.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: layout_of(NonZero<u32>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(8 bytes),
pref: $SOME_ALIGN,
},
abi: Scalar(
Initialized {
Expand Down Expand Up @@ -37,7 +37,7 @@ error: layout_of(NonZero<u32>) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/range_patterns.rs:9:1
--> $DIR/range_patterns.rs:11:1
|
LL | type X = std::num::NonZeroU32;
| ^^^^^^
Expand All @@ -46,7 +46,7 @@ error: layout_of((u32) is 1..=) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(4 bytes),
pref: $SOME_ALIGN,
},
abi: Scalar(
Initialized {
Expand Down Expand Up @@ -74,7 +74,7 @@ error: layout_of((u32) is 1..=) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/range_patterns.rs:11:1
--> $DIR/range_patterns.rs:13:1
|
LL | type Y = pattern_type!(u32 is 1..);
| ^^^^^^
Expand All @@ -83,7 +83,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(8 bytes),
pref: $SOME_ALIGN,
},
abi: Scalar(
Initialized {
Expand Down Expand Up @@ -122,7 +122,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(8 bytes),
pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
Expand All @@ -142,7 +142,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(8 bytes),
pref: $SOME_ALIGN,
},
abi: Scalar(
Initialized {
Expand Down Expand Up @@ -182,7 +182,7 @@ error: layout_of(Option<(u32) is 1..=>) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/range_patterns.rs:13:1
--> $DIR/range_patterns.rs:15:1
|
LL | type Z = Option<pattern_type!(u32 is 1..)>;
| ^^^^^^
Expand All @@ -191,7 +191,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(8 bytes),
pref: $SOME_ALIGN,
},
abi: Scalar(
Initialized {
Expand Down Expand Up @@ -230,7 +230,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout {
size: Size(0 bytes),
align: AbiAndPrefAlign {
abi: Align(1 bytes),
pref: Align(8 bytes),
pref: $SOME_ALIGN,
},
abi: Aggregate {
sized: true,
Expand All @@ -250,7 +250,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(8 bytes),
pref: $SOME_ALIGN,
},
abi: Scalar(
Initialized {
Expand Down Expand Up @@ -290,7 +290,7 @@ error: layout_of(Option<NonZero<u32>>) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/range_patterns.rs:15:1
--> $DIR/range_patterns.rs:17:1
|
LL | type A = Option<std::num::NonZeroU32>;
| ^^^^^^
Expand All @@ -299,7 +299,7 @@ error: layout_of(NonZeroU32New) = Layout {
size: Size(4 bytes),
align: AbiAndPrefAlign {
abi: Align(4 bytes),
pref: Align(8 bytes),
pref: $SOME_ALIGN,
},
abi: Scalar(
Initialized {
Expand Down Expand Up @@ -334,7 +334,7 @@ error: layout_of(NonZeroU32New) = Layout {
max_repr_align: None,
unadjusted_abi_align: Align(4 bytes),
}
--> $DIR/range_patterns.rs:17:1
--> $DIR/range_patterns.rs:19:1
|
LL | struct NonZeroU32New(pattern_type!(u32 is 1..));
| ^^^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit b6ab3ee

Please sign in to comment.