diff --git a/src/etc/natvis/liballoc.natvis b/src/etc/natvis/liballoc.natvis
index 83ca8ed932e46..912418fa7d1eb 100644
--- a/src/etc/natvis/liballoc.natvis
+++ b/src/etc/natvis/liballoc.natvis
@@ -59,39 +59,133 @@
+
+
- {ptr.pointer->value}
+ {ptr.pointer->value}
- ptr.pointer->value
- - ptr.pointer->strong
- - ptr.pointer->weak
+
+ ptr.pointer->value
+ - ptr.pointer->strong
+ - ptr.pointer->weak
+
+
+ - ptr.pointer.pointer->strong
+ - ptr.pointer.pointer->weak
+
+
+
+
+
+ {{ len={ptr.pointer.length} }}
+
+ - ptr.pointer.length
+ - ptr.pointer.data_ptr->strong
+ - ptr.pointer.data_ptr->weak
+
+ ptr.pointer.length
+
+ ($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)
+
+
+
- {ptr.pointer->value}
+ {ptr.pointer->value}
+
+
+ ptr.pointer->value
+ - ptr.pointer->strong
+ - ptr.pointer->weak
+
+
+ - ptr.pointer.pointer->strong
+ - ptr.pointer.pointer->weak
+
+
+
+
+
+ {{ len={ptr.pointer.length} }}
- ptr.pointer->value
- - ptr.pointer->strong
- - ptr.pointer->weak
+ - ptr.pointer.length
+ - ptr.pointer.data_ptr->strong
+ - ptr.pointer.data_ptr->weak
+
+ ptr.pointer.length
+ ($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)
+
+
- {ptr.pointer->data}
+ {ptr.pointer->data}
- ptr.pointer->data
- - ptr.pointer->strong
- - ptr.pointer->weak
+
+ ptr.pointer->data
+ - ptr.pointer->strong
+ - ptr.pointer->weak
+
+
+ - ptr.pointer.pointer->strong
+ - ptr.pointer.pointer->weak
+
+
+
+
+
+ {{ len={ptr.pointer.length} }}
+
+ - ptr.pointer.length
+ - ptr.pointer.data_ptr->strong
+ - ptr.pointer.data_ptr->weak
+
+ ptr.pointer.length
+ ($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)
+
+
+
- {ptr.pointer->data}
+ {ptr.pointer->data}
- ptr.pointer->data
- - ptr.pointer->strong
- - ptr.pointer->weak
+
+ ptr.pointer->data
+ - ptr.pointer->strong
+ - ptr.pointer->weak
+
+
+ - ptr.pointer.pointer->strong
+ - ptr.pointer.pointer->weak
+
+
+
+
+
+ {{ len={ptr.pointer.length} }}
+
+ - ptr.pointer.length
+ - ptr.pointer.data_ptr->strong
+ - ptr.pointer.data_ptr->weak
+
+ ptr.pointer.length
+ ($T1*)(((size_t*)ptr.pointer.data_ptr) + 2)
+
+
Borrowed({__0})
Owned({__0})
diff --git a/src/test/debuginfo/rc_arc.rs b/src/test/debuginfo/rc_arc.rs
index 8470ace24b845..c05c565d95634 100644
--- a/src/test/debuginfo/rc_arc.rs
+++ b/src/test/debuginfo/rc_arc.rs
@@ -8,74 +8,138 @@
// gdb-command:run
-// gdb-command:print r
-// gdb-check:[...]$1 = Rc(strong=2, weak=1) = {value = 42, strong = 2, weak = 1}
-// gdb-command:print a
-// gdb-check:[...]$2 = Arc(strong=2, weak=1) = {value = 42, strong = 2, weak = 1}
-
+// gdb-command:print rc
+// gdb-check:[...]$1 = Rc(strong=11, weak=1) = {value = 111, strong = 11, weak = 1}
+// gdb-command:print arc
+// gdb-check:[...]$2 = Arc(strong=21, weak=1) = {value = 222, strong = 21, weak = 1}
// === LLDB TESTS ==================================================================================
// lldb-command:run
-// lldb-command:print r
-// lldb-check:[...]$0 = strong=2, weak=1 { value = 42 }
-// lldb-command:print a
-// lldb-check:[...]$1 = strong=2, weak=1 { data = 42 }
+// lldb-command:print rc
+// lldb-check:[...]$0 = strong=11, weak=1 { value = 111 }
+// lldb-command:print arc
+// lldb-check:[...]$1 = strong=21, weak=1 { data = 222 }
// === CDB TESTS ==================================================================================
// cdb-command:g
-// cdb-command:dx r,d
-// cdb-check:r,d : 42 [Type: alloc::rc::Rc]
-// cdb-check: [] [Type: alloc::rc::Rc]
-// cdb-check: [Reference count] : 2 [Type: core::cell::Cell]
+// cdb-command:dx rc,d
+// cdb-check:rc,d : 111 [Type: alloc::rc::Rc]
+// cdb-check: [Reference count] : 11 [Type: core::cell::Cell]
+// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell]
+
+// cdb-command:dx weak_rc,d
+// cdb-check:weak_rc,d : 111 [Type: alloc::rc::Weak]
+// cdb-check: [Reference count] : 11 [Type: core::cell::Cell]
+// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell]
+
+// cdb-command:dx arc,d
+// cdb-check:arc,d : 222 [Type: alloc::sync::Arc]
+// cdb-check: [Reference count] : 21 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+
+// cdb-command:dx weak_arc,d
+// cdb-check:weak_arc,d : 222 [Type: alloc::sync::Weak]
+// cdb-check: [Reference count] : 21 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+
+// cdb-command:dx dyn_rc,d
+// cdb-check:dyn_rc,d [Type: alloc::rc::Rc >]
+// cdb-check: [Reference count] : 31 [Type: core::cell::Cell]
// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell]
-// cdb-command:dx r1,d
-// cdb-check:r1,d : 42 [Type: alloc::rc::Rc]
-// cdb-check: [] [Type: alloc::rc::Rc]
-// cdb-check: [Reference count] : 2 [Type: core::cell::Cell]
+// cdb-command:dx dyn_rc_weak,d
+// cdb-check:dyn_rc_weak,d [Type: alloc::rc::Weak >]
+// cdb-check: [Reference count] : 31 [Type: core::cell::Cell]
// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell]
-// cdb-command:dx w1,d
-// cdb-check:w1,d : 42 [Type: alloc::rc::Weak]
-// cdb-check: [] [Type: alloc::rc::Weak]
-// cdb-check: [Reference count] : 2 [Type: core::cell::Cell]
+// cdb-command:dx slice_rc,d
+// cdb-check:slice_rc,d : { len=3 } [Type: alloc::rc::Rc >]
+// cdb-check: [Length] : 3 [Type: [...]]
+// cdb-check: [Reference count] : 41 [Type: core::cell::Cell]
// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell]
+// cdb-check: [0] : 1 [Type: u32]
+// cdb-check: [1] : 2 [Type: u32]
+// cdb-check: [2] : 3 [Type: u32]
+
+// cdb-command:dx slice_rc_weak,d
+// cdb-check:slice_rc_weak,d : { len=3 } [Type: alloc::rc::Weak >]
+// cdb-check: [Length] : 3 [Type: [...]]
+// cdb-check: [Reference count] : 41 [Type: core::cell::Cell]
+// cdb-check: [Weak reference count] : 2 [Type: core::cell::Cell]
+// cdb-check: [0] : 1 [Type: u32]
+// cdb-check: [1] : 2 [Type: u32]
+// cdb-check: [2] : 3 [Type: u32]
-// cdb-command:dx a,d
-// cdb-check:a,d : 42 [Type: alloc::sync::Arc]
-// cdb-check: [] [Type: alloc::sync::Arc]
-// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+// cdb-command:dx dyn_arc,d
+// cdb-check:dyn_arc,d [Type: alloc::sync::Arc >]
+// cdb-check: [Reference count] : 51 [Type: core::sync::atomic::AtomicUsize]
// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
-// cdb-command:dx a1,d
-// cdb-check:a1,d : 42 [Type: alloc::sync::Arc]
-// cdb-check: [] [Type: alloc::sync::Arc]
-// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+// cdb-command:dx dyn_arc_weak,d
+// cdb-check:dyn_arc_weak,d [Type: alloc::sync::Weak >]
+// cdb-check: [Reference count] : 51 [Type: core::sync::atomic::AtomicUsize]
// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
-// cdb-command:dx w2,d
-// cdb-check:w2,d : 42 [Type: alloc::sync::Weak]
-// cdb-check: [] [Type: alloc::sync::Weak]
-// cdb-check: [Reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+// cdb-command:dx slice_arc,d
+// cdb-check:slice_arc,d : { len=3 } [Type: alloc::sync::Arc >]
+// cdb-check: [Length] : 3 [Type: [...]]
+// cdb-check: [Reference count] : 61 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [0] : 4 [Type: u32]
+// cdb-check: [1] : 5 [Type: u32]
+// cdb-check: [2] : 6 [Type: u32]
+
+// cdb-command:dx slice_arc_weak,d
+// cdb-check:slice_arc_weak,d : { len=3 } [Type: alloc::sync::Weak >]
+// cdb-check: [Length] : 3 [Type: [...]]
+// cdb-check: [Reference count] : 61 [Type: core::sync::atomic::AtomicUsize]
// cdb-check: [Weak reference count] : 2 [Type: core::sync::atomic::AtomicUsize]
+// cdb-check: [0] : 4 [Type: u32]
+// cdb-check: [1] : 5 [Type: u32]
+// cdb-check: [2] : 6 [Type: u32]
+use std::fmt::Debug;
use std::rc::Rc;
use std::sync::Arc;
fn main() {
- let r = Rc::new(42);
- let r1 = Rc::clone(&r);
- let w1 = Rc::downgrade(&r);
+ let rc = Rc::new(111);
+ inc_ref_count(&rc, 10);
+ let weak_rc = Rc::downgrade(&rc);
+
+ let arc = Arc::new(222);
+ inc_ref_count(&arc, 20);
+ let weak_arc = Arc::downgrade(&arc);
+
+ let dyn_rc: Rc = Rc::new(333);
+ inc_ref_count(&dyn_rc, 30);
+ let dyn_rc_weak = Rc::downgrade(&dyn_rc);
+
+ let slice_rc: Rc<[u32]> = Rc::from(vec![1, 2, 3]);
+ inc_ref_count(&slice_rc, 40);
+ let slice_rc_weak = Rc::downgrade(&slice_rc);
- let a = Arc::new(42);
- let a1 = Arc::clone(&a);
- let w2 = Arc::downgrade(&a);
+ let dyn_arc: Arc = Arc::new(444);
+ inc_ref_count(&dyn_arc, 50);
+ let dyn_arc_weak = Arc::downgrade(&dyn_arc);
+
+ let slice_arc: Arc<[u32]> = Arc::from(vec![4, 5, 6]);
+ inc_ref_count(&slice_arc, 60);
+ let slice_arc_weak = Arc::downgrade(&slice_arc);
zzz(); // #break
}
-fn zzz() { () }
+fn inc_ref_count(rc: &T, count: usize) {
+ for _ in 0..count {
+ std::mem::forget(rc.clone());
+ }
+}
+
+fn zzz() {
+ ()
+}