diff options
Diffstat (limited to 'src/eval/call.rs')
| -rw-r--r-- | src/eval/call.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/eval/call.rs b/src/eval/call.rs index f47ee847..8e75f17c 100644 --- a/src/eval/call.rs +++ b/src/eval/call.rs @@ -8,7 +8,7 @@ impl Eval for Spanned<&ExprCall> { let name = &self.v.name.v; let span = self.v.name.span; - if let Some(value) = ctx.state.scope.get(name) { + if let Some(value) = ctx.scopes.get(name) { if let Value::Func(func) = value { let func = func.clone(); ctx.deco(Deco::Resolved.with_span(span)); @@ -90,10 +90,10 @@ impl Args { } /// Filter out and remove all convertible positional arguments. - pub fn filter<'a, T>( + pub fn filter<'a, 'b: 'a, T>( &'a mut self, - ctx: &'a mut EvalContext, - ) -> impl Iterator<Item = T> + 'a + ctx: &'a mut EvalContext<'b>, + ) -> impl Iterator<Item = T> + Captures<'a> + Captures<'b> where T: Cast<Spanned<Value>>, { @@ -130,6 +130,13 @@ impl Args { } } +// This is a workaround because `-> impl Trait + 'a + 'b` does not work. +// +// See also: https://github.com/rust-lang/rust/issues/49431 +#[doc(hidden)] +pub trait Captures<'a> {} +impl<'a, T: ?Sized> Captures<'a> for T {} + /// Cast the value into `T`, generating an error if the conversion fails. fn cast<T>(ctx: &mut EvalContext, value: Spanned<Value>) -> Option<T> where |
