willcrichton/flowistry

Panic on slicing const string

willcrichton opened this issue · 0 comments

ex:

fn foo() { 
  const FOO: &str = "bar";
}

select FOO, get Unknown arg span for owner_node

Issue is that const FOO: .. is treated as a standalone item, not a variable declaration within foo, (e.g. similar if you nested fn bar() {} inside of foo). So the broader issue is attempting to slice items that aren't functions.

But also: is it possible to be able to slice FOO? Even if this doesn't panic, it's confusing for a user.