Skip to content

Commit 2755a04

Browse files
authored
Eliminate source of caller_location warnings in kani library (rust-lang#2032)
1 parent 81fda70 commit 2755a04

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

library/kani/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,13 @@ pub(crate) unsafe fn any_raw_internal<T, const SIZE_T: usize>() -> T {
136136
#[inline(never)]
137137
#[allow(dead_code)]
138138
fn any_raw_inner<T>() -> T {
139-
unimplemented!("Kani any_raw_inner");
139+
// while we could use `unreachable!()` or `panic!()` as the body of this
140+
// function, both cause Kani to produce a warning on any program that uses
141+
// kani::any() (see https://github.com/model-checking/kani/issues/2010).
142+
// This function is handled via a hook anyway, so we just need to put a body
143+
// that rustc does not complain about. An infinite loop works out nicely.
144+
#[allow(clippy::empty_loop)]
145+
loop {}
140146
}
141147

142148
/// Function used to generate panic with a static message as this is the only one currently

0 commit comments

Comments
 (0)