Skip to content

Commit 5553e60

Browse files
authored
Merge pull request #231 from GaloisInc/T227-caller-dummy-location
`libs`: Return dummy location in `Location::caller`
2 parents 720d546 + 313ea2f commit 5553e60

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

libs/Patches.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ into the main commit for that patch, and then the *Update* line can be removed.
255255
slightly such that we build a `&mut [u8]` slice and then cast it to a `*mut
256256
u8`, thereby avoiding the need for `u32` altogether.
257257

258+
* Return dummy location in `Location::caller` (last applied: January 22, 2026)
259+
260+
`crucible-mir` does not currently support the `intrinsics::caller_location()`
261+
intrinsic. To prevent this function from throwing translation errors, we have
262+
it return a constant dummy location.
263+
258264
# Notes
259265

260266
This section contains more detailed notes about why certain patches are written

libs/core/src/panic/location.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ impl<'a> Location<'a> {
144144
#[track_caller]
145145
#[inline]
146146
pub const fn caller() -> &'static Location<'static> {
147-
crate::intrinsics::caller_location()
147+
static DUMMY_LOCATION: Location<'static> = Location {
148+
filename: NonNull::from_ref("dummy.rs"),
149+
line: 0,
150+
col: 0,
151+
_filename: PhantomData,
152+
};
153+
&DUMMY_LOCATION
148154
}
149155

150156
/// Returns the name of the source file from which the panic originated.

0 commit comments

Comments
 (0)