@@ -35,6 +35,12 @@ impl<T> DomRefCell<T> {
35
35
/// Unlike RefCell::borrow, this method is unsafe because it does not return a Ref, thus leaving
36
36
/// the borrow flag untouched. Mutably borrowing the RefCell while the reference returned by
37
37
/// this method is alive is undefined behaviour.
38
+ ///
39
+ /// # Panics
40
+ ///
41
+ /// Panics if this is called from anywhere other than the layout thread
42
+ ///
43
+ /// Panics if the value is currently mutably borrowed.
38
44
#[ allow( unsafe_code) ]
39
45
pub unsafe fn borrow_for_layout ( & self ) -> & T {
40
46
assert_in_layout ( ) ;
@@ -50,6 +56,10 @@ impl<T> DomRefCell<T> {
50
56
/// Unlike RefCell::borrow, this method is unsafe because it does not return a Ref, thus leaving
51
57
/// the borrow flag untouched. Mutably borrowing the RefCell while the reference returned by
52
58
/// this method is alive is undefined behaviour.
59
+ ///
60
+ /// # Panics
61
+ ///
62
+ /// Panics if this is called from anywhere other than the script thread.
53
63
#[ allow( unsafe_code, clippy:: mut_from_ref) ]
54
64
pub unsafe fn borrow_for_script_deallocation ( & self ) -> & mut T {
55
65
assert_in_script ( ) ;
@@ -64,6 +74,10 @@ impl<T> DomRefCell<T> {
64
74
/// Unlike RefCell::borrow, this method is unsafe because it does not return a Ref, thus leaving
65
75
/// the borrow flag untouched. Mutably borrowing the RefCell while the reference returned by
66
76
/// this method is alive is undefined behaviour.
77
+ ///
78
+ /// # Panics
79
+ ///
80
+ /// Panics if this is called from anywhere other than the layout thread.
67
81
#[ allow( unsafe_code, clippy:: mut_from_ref) ]
68
82
pub unsafe fn borrow_mut_for_layout ( & self ) -> & mut T {
69
83
assert_in_layout ( ) ;
@@ -88,9 +102,8 @@ impl<T> DomRefCell<T> {
88
102
///
89
103
/// # Panics
90
104
///
91
- /// Panics if this is called off the script thread.
92
- ///
93
105
/// Panics if the value is currently mutably borrowed.
106
+ #[ track_caller]
94
107
pub fn borrow ( & self ) -> Ref < T > {
95
108
self . value . borrow ( )
96
109
}
@@ -102,9 +115,8 @@ impl<T> DomRefCell<T> {
102
115
///
103
116
/// # Panics
104
117
///
105
- /// Panics if this is called off the script thread.
106
- ///
107
118
/// Panics if the value is currently borrowed.
119
+ #[ track_caller]
108
120
pub fn borrow_mut ( & self ) -> RefMut < T > {
109
121
self . value . borrow_mut ( )
110
122
}
0 commit comments