We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4652a13 commit 01f36c5Copy full SHA for 01f36c5
library/core/tests/mem.rs
@@ -250,14 +250,19 @@ fn uninit_write_slice_cloned_mid_panic() {
250
251
#[test]
252
fn uninit_write_slice_cloned_no_drop() {
253
- let rc = Rc::new(());
+ #[derive(Clone)]
254
+ struct Bomb;
255
+
256
+ impl Drop for Bomb {
257
+ fn drop(&mut self) {
258
+ panic!("dropped a bomb! kaboom")
259
+ }
260
261
262
let mut dst = [MaybeUninit::uninit()];
- let src = [rc.clone()];
263
+ let src = [Bomb];
264
265
MaybeUninit::write_slice_cloned(&mut dst, &src);
266
- drop(src);
-
- assert_eq!(Rc::strong_count(&rc), 2);
267
+ forget(src);
268
}
0 commit comments