Skip to content

Commit 462984b

Browse files
committed
Add runtime check
1 parent bd03805 commit 462984b

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎tests/unit/out/refcount/constexpr_function.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ pub fn main() {
5454
std::process::exit(main_0());
5555
}
5656
fn main_0() -> i32 {
57+
let mut runtime_context: bool = ({ in_constant_context_6() });
58+
assert!(!(runtime_context));
5759
let arr: Value<Box<[i32]>> = Rc::new(RefCell::new(Box::new([7, 8])));
5860
assert!((({ first_1((arr.as_pointer() as Ptr::<i32>),) }) == 7));
5961
assert!((({ first_1((arr.as_pointer() as Ptr::<i32>).offset((1) as isize),) }) == 8));

‎tests/unit/out/unsafe/constexpr_function.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ pub fn main() {
6363
}
6464
}
6565
unsafe fn main_0() -> i32 {
66+
let mut runtime_context: bool = (unsafe { in_constant_context_6() });
67+
assert!(!(runtime_context));
6668
let mut arr: [i32; 2] = [7, 8];
6769
assert!(((unsafe { first_1((arr.as_mut_ptr()).cast_const(),) }) == (7)));
6870
assert!(((unsafe { first_1((arr.as_mut_ptr().offset((1) as isize)).cast_const(),) }) == (8)));

0 commit comments

Comments
 (0)