Add a test for OOB ranges
This commit is contained in:
parent
d7f5d784d7
commit
9b6f8e500c
15
src/test/ui/layout/valid_range_oob.rs
Normal file
15
src/test/ui/layout/valid_range_oob.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// failure-status: 101
|
||||
// normalize-stderr-test "note: .*\n\n" -> ""
|
||||
// normalize-stderr-test "thread 'rustc' panicked.*\n" -> ""
|
||||
// rustc-env:RUST_BACKTRACE=0
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
#[rustc_layout_scalar_valid_range_end(257)]
|
||||
struct Foo(i8);
|
||||
|
||||
// Need to do in a constant, as runtime codegen
|
||||
// does not compute the layout of `Foo` in check builds.
|
||||
const FOO: Foo = unsafe { Foo(1) };
|
||||
|
||||
fn main() {}
|
6
src/test/ui/layout/valid_range_oob.stderr
Normal file
6
src/test/ui/layout/valid_range_oob.stderr
Normal file
@ -0,0 +1,6 @@
|
||||
error: internal compiler error: unexpected panic
|
||||
|
||||
query stack during panic:
|
||||
#0 [layout_of] computing layout of `Foo`
|
||||
#1 [eval_to_allocation_raw] const-evaluating + checking `FOO`
|
||||
end of query stack
|
Loading…
x
Reference in New Issue
Block a user