Skip to content

Commit e377292

Browse files
authored
Merge pull request #1279 from RealKC/track-caller
glib: Mark panicky `BoxedAnyObject` methods as `track_caller`
2 parents d08bf24 + b3e4322 commit e377292

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

glib/src/boxed_any_object.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl BoxedAnyObject {
9898
// rustdoc-stripper-ignore-next
9999
/// Replaces the wrapped value with a new one, returning the old value, without deinitializing either one.
100100
/// The returned value is inside a `Box` and must be manually downcasted if needed.
101+
#[track_caller]
101102
pub fn replace<T: 'static>(&self, t: T) -> Box<dyn Any> {
102103
self.imp().value.replace(Box::new(t) as Box<dyn Any>)
103104
}
@@ -158,6 +159,7 @@ impl BoxedAnyObject {
158159
///
159160
/// For a non-panicking variant, use
160161
/// [`try_borrow`](#method.try_borrow).
162+
#[track_caller]
161163
pub fn borrow<T: 'static>(&self) -> Ref<'_, T> {
162164
Ref::map(self.imp().value.borrow(), |value| {
163165
value
@@ -180,6 +182,7 @@ impl BoxedAnyObject {
180182
///
181183
/// For a non-panicking variant, use
182184
/// [`try_borrow_mut`](#method.try_borrow_mut).
185+
#[track_caller]
183186
pub fn borrow_mut<T: 'static>(&self) -> RefMut<'_, T> {
184187
RefMut::map(self.imp().value.borrow_mut(), |value| {
185188
value

0 commit comments

Comments
 (0)