Open omerbenamram opened 10 months ago
Mojo has plans for lifetimes and references, but it's not ready yet. Check out their proposals on lifetime tracking and provenance, and also on their Roadmap section
What I am interested in though, because I have seen no documentation of it anywhere, is whether mojo will ultimately allow programmers to use raw Pointers (like now) just as easily as references. If there's no equivalent of rust's unsafe
, I think that will be a big problem.
I see - still i suppose it shouldn't segfault 😅
Bug description
The following code:
produces:
Coming from some background in rust, we cannot have both a mutable and an immutable reference living at the same time to the same variable in the loop.
This does not crash:
I'm not sure if mojo has any notion of a borrow checker, but AFAIK this should be a compile error.
Steps to reproduce
Running the code always produces a crash.
System information