Zulip Chat Archive

Stream: lean4

Topic: ST.Ref type unsafety


Mario Carneiro (Jun 03 2021 at 11:53):

#eval runST fun σ => do
  let r  ST.Prim.mkRef 1
  let r' : ST.Ref σ String := r.1, ""⟩⟩
  r'.get

This doesn't cause any unsoundness that I can tell, but it can be used to cause memory unsafety. This code will just crash the lean server if you run it.

Sebastian Ullrich (Jun 03 2021 at 18:02):

Looks like another case for https://github.com/leanprover/lean4/issues/418

Mario Carneiro (Jun 03 2021 at 19:05):

I think that rather than private, this needs unsafe

Mario Carneiro (Jun 03 2021 at 19:05):

specifically, ST.Ref.mk is unsafe


Last updated: Dec 20 2023 at 11:08 UTC