codelldb icon indicating copy to clipboard operation
codelldb copied to clipboard

Rust: &&Vec<_> is showing as empty vec

Open Ten0 opened this issue 4 years ago • 2 comments

Configuration

OS: ArchLinux latest VSCode version: 1.58.0 (latest) Extension version: 1.6.5 (latest) Compiler: Rust 1.53 (latest stable) Build target: Linux AMD64

Issue

With the following code:

fn main() {
	let v = vec![1, 2, 3];
	let v_ref = &v;
	let v_ref2 = &&v;
	let v_ref3 = &&&v;
	std::mem::drop(v_ref3);
}

&&Vec<_> (and further) is showing as empty vec[]:

image

This is a pretty common pattern when manipulating multi-dimensional arrays: patterns such as:

vec![vec![1,2,3]].iter().filter(|v| {/* ... */})

will have v be a &&Vec<_>.

This can be pretty misleading ^^

Ten0 avatar Jul 14 '21 00:07 Ten0

I get incorrect output for &&str as well.

danielkeller avatar Dec 22 '21 10:12 danielkeller

&Vec works because we set eTypeOptionSkipReferences for Vec formatter, however this does not work with more indirection levels.

vadimcn avatar Mar 13 '22 21:03 vadimcn