From 88b01d6abad44fddf12bc62ba8bda4beaa609d52 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Tue, 9 Feb 2021 14:22:55 +0800 Subject: [PATCH] Refine docs. --- RELEASES.md | 6 ++++++ src/module/mod.rs | 8 ++++---- src/scope.rs | 10 +++++----- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 2d23c944..c647dcd0 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -4,6 +4,12 @@ Rhai Release Notes Version 0.19.12 =============== +Bug fixes +--------- + +* Empty statements (i.e. statements with only one `;`) now parse correctly and no longer hang. +* `continue`, `break` and `return` statements no longer panic inside a `try .. catch` block. + Breaking changes ---------------- diff --git a/src/module/mod.rs b/src/module/mod.rs index 35e12393..181d4f3b 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -374,7 +374,7 @@ impl Module { /// Generate signatures for all the functions in the [`Module`]. #[inline(always)] - pub fn gen_fn_signatures<'a>(&'a self) -> impl Iterator + 'a { + pub fn gen_fn_signatures(&self) -> impl Iterator + '_ { self.functions .values() .filter(|FuncInfo { access, .. }| !access.is_private()) @@ -1691,9 +1691,9 @@ impl Module { /// 5) Shared reference to function definition [`ScriptFnDef`][crate::ast::ScriptFnDef]. #[cfg(not(feature = "no_function"))] #[inline(always)] - pub(crate) fn iter_script_fn<'a>( - &'a self, - ) -> impl Iterator + 'a { + pub(crate) fn iter_script_fn( + &self, + ) -> impl Iterator + '_ { self.functions.values().filter(|f| f.func.is_script()).map( |FuncInfo { namespace, diff --git a/src/scope.rs b/src/scope.rs index d60aab40..77c74e9e 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -449,14 +449,14 @@ impl<'a> Scope<'a> { /// /// let mut iter = my_scope.iter(); /// - /// let (name, constant, value) = iter.next().unwrap(); + /// let (name, is_constant, value) = iter.next().unwrap(); /// assert_eq!(name, "x"); - /// assert!(!constant); + /// assert!(!is_constant); /// assert_eq!(value.cast::(), 42); /// - /// let (name, constant, value) = iter.next().unwrap(); + /// let (name, is_constant, value) = iter.next().unwrap(); /// assert_eq!(name, "foo"); - /// assert!(constant); + /// assert!(is_constant); /// assert_eq!(value.cast::(), "hello"); /// ``` #[inline(always)] @@ -467,7 +467,7 @@ impl<'a> Scope<'a> { /// Get an iterator to entries in the [`Scope`]. /// Shared values are not expanded. #[inline(always)] - pub fn iter_raw<'x: 'a>(&'x self) -> impl Iterator + 'x { + pub fn iter_raw(&self) -> impl Iterator { self.names .iter() .zip(self.values.iter())