File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,25 @@ fn try_interleaved() {
84
84
}
85
85
}
86
86
87
+ // For Miri to catch issues when calling a function.
88
+ //
89
+ // See how this scenerio affects std::cell::RefCell implementation:
90
+ // https://github.com/rust-lang/rust/issues/63787
91
+ //
92
+ // Also see relevant unsafe code guidelines issue:
93
+ // https://github.com/rust-lang/unsafe-code-guidelines/issues/125
94
+ #[ test]
95
+ fn drop_and_borrow_in_fn_call ( ) {
96
+ fn drop_and_borrow ( cell : & AtomicRefCell < Bar > , borrow : AtomicRef < ' _ , Bar > ) {
97
+ drop ( borrow) ;
98
+ * cell. borrow_mut ( ) = Bar :: default ( ) ;
99
+ }
100
+
101
+ let a = AtomicRefCell :: new ( Bar :: default ( ) ) ;
102
+ let borrow = a. borrow ( ) ;
103
+ drop_and_borrow ( & a, borrow) ;
104
+ }
105
+
87
106
#[ test]
88
107
#[ should_panic( expected = "already immutably borrowed" ) ]
89
108
fn immutable_then_mutable ( ) {
You can’t perform that action at this time.
0 commit comments