Skip to content

Commit f03d9e7

Browse files
committed
libs: Return dummy location in Location::caller
Fixes #227.
1 parent 7e12cec commit f03d9e7

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

libs/Patches.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ into the main commit for that patch, and then the *Update* line can be removed.
238238
This feature was using an `AtomicPtr<()>` with a cast from function
239239
pointer to `*mut ()` that we don't support in its initializer.
240240

241+
* Return dummy location in `Location::caller` (last applied: January 22, 2026)
242+
243+
`crucible-mir` does not currently support the `intrinsics::caller_location()`
244+
intrinsic. To prevent this function from throwing translation errors, we have
245+
it return a constant dummy location.
246+
241247
# Notes
242248

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

libs/core/src/panic/location.rs

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

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

0 commit comments

Comments
 (0)