pub struct EvalFuncstackFrame { /* private fields */ }Expand description
!!! WARNING: RUST-ONLY HELPER !!!
C keeps struct funcstack fstack; as an automatic in eval()
(Src/builtin.c:6148) and unwinds it with a plain
funcstack = funcstack->prev; on the single return path
(Src/builtin.c:6210). zshrs’s FUNCSTACK is a Mutex<Vec<funcstack>>
and its eval entry points have MANY early-return paths (errflag
containment, recursion backstop, ? from execute_script), so the pop
is carried by Drop instead. There is no C counterpart for this type;
the pushed frame itself is a line-by-line port of Src/builtin.c:6155-6193.
Every caller that stands in for C’s eval() — the BUILTIN_EVAL
handler and eval_string below — must hold one of these for the
duration of the eval’d body, or $funcstack / $functrace /
$funcfiletrace lose a frame relative to zsh.
Implementations§
Source§impl EvalFuncstackFrame
impl EvalFuncstackFrame
Sourcepub fn push() -> Self
pub fn push() -> Self
Port of the funcstack prologue of eval(char **argv) from
Src/builtin.c:6155-6193.
ineval = !isset(EVALLINENO);
if (!ineval) {
scriptname = "(eval)";
fstack.prev = funcstack;
fstack.name = scriptname;
fstack.caller = funcstack ? funcstack->name : dupstring(argzero);
fstack.lineno = lineno;
fstack.tp = FS_EVAL;
if (!funcstack || funcstack->tp == FS_SOURCE) {
fstack.flineno = fstack.lineno;
fstack.filename = fstack.caller;
} else {
fstack.flineno = funcstack->flineno + lineno;
if (funcstack->tp == FS_EVAL)
fstack.flineno--;
fstack.filename = funcstack->filename;
if (!fstack.filename)
fstack.filename = "";
}
funcstack = &fstack;
fpushed = 1;
} else
fpushed = 0;scriptname (c:6157) is left to the caller: the BUILTIN_EVAL
handler saves/restores it around the whole builtin, which is where
C’s oscriptname (c:6146) / restore (c:6222) live.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EvalFuncstackFrame
impl RefUnwindSafe for EvalFuncstackFrame
impl Send for EvalFuncstackFrame
impl Sync for EvalFuncstackFrame
impl Unpin for EvalFuncstackFrame
impl UnsafeUnpin for EvalFuncstackFrame
impl UnwindSafe for EvalFuncstackFrame
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more