Segmentation fault with List

Can anyone let me know why this code gives me this error?

var ls: List[String] = []

fn main():
    ls = ["Hello"]
    ls = ls[:1]
$ mojo life.mojo
Please submit a bug report to https://github.com/modular/modular/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0.	Program arguments: mojo life.mojo
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  mojo                      0x00005602f087e51b
1  mojo                      0x00005602f087c2b9
2  mojo                      0x00005602f087ebca
3  libc.so.6                 0x00007f4583867070
4  libc.so.6                 0x00007f45838c0334
5  libc.so.6                 0x00007f4583866fbe gsignal + 30
6  libAsyncRTMojoBindings.so 0x00007f45859b2832
7  libc.so.6                 0x00007f4583867070
8  (error)                   0x00007f448c002346
mojo crashed!
Please file a bug report.

Mojo doesn’t have global variable support so var must be included inside a function.

fn main():
    var ls: List[String] = []
    ls = ["Hello"]
    ls = ls[:1]
    print(ls[0])

Why this code supports global variable?

var ls: List[String] = []

fn main():
    ls.append("Hello")
    print(ls[0])
$ mojo life.mojo
Hello

It only works occasionally. Please don’t rely on it just yet.

Indeed. It is such a footgun that I think we should look at disabling it entirely. This is the problem with proactiely adding partial support for such an important feature.

+1 for disabling it. I’ve seen quite a few people with similar issues.

I too agree with disabling it. Currently the bad cases cover most of the useful instances of this feature anyways.