feat: allow the compiler to optimize unsafeCast

This commit is contained in:
Gabriel Ebner 2022-01-03 11:06:05 +01:00 committed by Leonardo de Moura
parent 5cdaeac36f
commit bc5bd5a671

View file

@ -1139,9 +1139,8 @@ def String.utf8ByteSize : (@& String) → Nat
stopPos := s.bsize
}
@[extern c inline "#3"]
unsafe def unsafeCast {α : Type u} {β : Type v} (a : α) : β :=
cast lcProof (PUnit.{v})
ULift.down.{max u v} (cast lcProof (ULift.up.{max u v} a))
@[neverExtract, extern "lean_panic_fn"]
constant panicCore {α : Type u} [Inhabited α] (msg : String) : α