Skip to content

Commit 5f5e6b9

Browse files
committed
test that both size_of_val and align_of_val panic
1 parent f4d8faa commit 5f5e6b9

3 files changed

+10
-2
lines changed

tests/ui/extern/extern-types-size_of_val.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-fail
22
// check-run-results
3+
// revisions: size align
34
// normalize-stderr-test "panicking\.rs:\d+:\d+:" -> "panicking.rs:"
45
#![feature(extern_types)]
56

@@ -13,6 +14,9 @@ fn main() {
1314
let x: &A = unsafe { &*(1usize as *const A) };
1415

1516
// These don't have a dynamic size, so this should panic.
16-
assert_eq!(size_of_val(x), 0);
17-
assert_eq!(align_of_val(x), 1);
17+
if cfg!(size) {
18+
assert_eq!(size_of_val(x), 0);
19+
} else {
20+
assert_eq!(align_of_val(x), 1);
21+
}
1822
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
thread 'main' panicked at library/core/src/panicking.rs:
2+
attempted to compute the size or alignment of extern type `A`
3+
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
4+
thread caused non-unwinding panic. aborting.

0 commit comments

Comments
 (0)