Source context

Rust library

branch

This is Rust standard-library source from the compiler version used in the run.

2776     }2777 2778     #[inline]2779     fn branch(self) -> ControlFlow<Self::Residual, Self::Output> {2780         match self {2781             Some(v) => ControlFlow::Continue(v),2782             None => ControlFlow::Break(None),

Aeneas declaration

Aeneas generated this declaration for a Rust library operation. Any authored model recorded for this operation is shown below.

@[rust_fun
  "core::option::{core::ops::try_trait::Try<core::option::Option<@T>>}::branch"]
axiom core.option.Option.Insts.CoreOpsTry_traitTry.branch
  {T : Type} :
  Option T → Result (core.ops.control_flow.ControlFlow (Option
    core.convert.Infallible) T)

Authored Lean model

Trellis authored this Lean model for an operation outside the mechanical extraction. Modeling choices explains its behavior and review.

Why this model is faithful

import Aeneas
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: ModelOptionBranch]
def ModelOptionBranch {T : Type} (x : Option T) :
    Result (core.ops.control_flow.ControlFlow
      (Option core.convert.Infallible) T) :=
-- BODY
  match x with
  | some v => ok (.Continue v)
  | none => ok (.Break none)
end dec2flt_model
Source details
Declarationcore.option.Option.Insts.CoreOpsTry_traitTry.branch
File/rustc/library/core/src/option.rs
Lines2779:4–2779:64
Program versionOriginal program