News for hackers. Stuff that matters.
Re:RustViz: Generates Visualizations of Rust Lifetime and Bo... by Animats on Monday July 05, 2021 @08:06PM (#27743019)
It's nice, but I suspect more an educational tool than a working programmer's tool. Rustc has good lifetime diagnostics, so it's not that huge a problem.

What I'd like to see is something that does static analysis for reference-counted items. To access a reference-counted item, you often have to call .borrow(), which checks to see if someone else already has it borrowed. This panics on a conflict. That's a good problem for static analysis - is the .borrow() always safe, always going to fail, or unknown? Much of the time, it's always safe and could be optimized out.

Re:RustViz: Generates Visualizations of Rust Lifetime and Bo... by zozbot234 on Monday July 05, 2021 @08:16PM (#27743069)
> What I'd like to see is something that does static analysis for reference-counted items.

This ought to be doable with GhostCell and similar efforts. https://plv.mpi-sws.org/rustbelt/ghostcell/ It doesn't cover the entire spectrum of "borrow safety proofs" but it can be used to address simple cases.

Re:RustViz: Generates Visualizations of Rust Lifetime and Bo... by muizelaar on Monday July 05, 2021 @08:12PM (#27743052)
How do you imagine this working? What are the scenarios where you want shared ownership but can prove that there's only one owner?
Re:RustViz: Generates Visualizations of Rust Lifetime and Bo... by remexre on Monday July 05, 2021 @08:16PM (#27743071)
e.g. there are exactly two owners and only one is &mut-ing at a time.
Re:RustViz: Generates Visualizations of Rust Lifetime and Bo... by Jweb_Guru on Monday July 05, 2021 @08:32PM (#27743155)
GhostCell is pretty much designed for this sort of use case.
Re:RustViz: Generates Visualizations of Rust Lifetime and Bo... by Animats on Tuesday July 06, 2021 @02:31AM (#27744865)
That is a very interesting paper. I need to read it again.