Rust library
from_residual
This is Rust standard-library source from the compiler version used in the run.
2790 // https://github.com/rust-lang/rust/issues/999402791 const impl<T> ops::FromResidual<Option<convert::Infallible>> for Option<T> {2792 #[inline]2793 fn from_residual(residual: Option<convert::Infallible>) -> Self {2794 match residual {2795 None => None,2796 }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::FromResidual<core::option::Option<@T>, core::option::Option<core::convert::Infallible>>}::from_residual"]
axiom
core.option.Option.Insts.CoreOpsTry_traitFromResidualOptionInfallible.from_residual
(T : Type) : Option core.convert.Infallible → Result (Option T)Authored Lean model
Trellis authored this Lean model for an operation outside the mechanical extraction. Modeling choices explains its behavior and review.
import Aeneas
open Aeneas Aeneas.Std Result ControlFlow Error
set_option autoImplicit false
namespace dec2flt_model
-- [TABLET NODE: ModelOptionFromResidual]
def ModelOptionFromResidual (T : Type)
(x : Option core.convert.Infallible) : Result (Option T) :=
-- BODY
match x with
| none => ok none
| some v => nomatch v
end dec2flt_model
Source details
| Declaration | core.option.Option.Insts.CoreOpsTry_traitFromResidualOptionInfallible.from_residual |
|---|---|
| File | /rustc/library/core/src/option.rs |
| Lines | 2793:4–2793:67 |
| Program version | Original program |