Skip to content

Commit

Permalink
Merge pull request #921 from schungx/master
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
schungx authored Oct 9, 2024
2 parents f2bfa7d + e4e87a6 commit 801c2ad
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ Bug fixes

* (Fuzzing) An integer-overflow bug from an inclusive range in the bits iterator is fixed.
* (Fuzzing) An integer-underflow bug from an inclusive range is fixed.
* Copy strings if the strings interner is busy instead of panicing.
* Copy strings if the strings interner is busy instead of panicing (thanks [`@irevoire`](https://github.com/irevoire) [917](https://github.com/rhaiscript/rhai/pull/917)).
* Deserialization of `Scope` now works correctly (thanks [`@AngelicosPhosphoros`](https://github.com/AngelicosPhosphoros) [918](https://github.com/rhaiscript/rhai/pull/918)).
* Support for `thumbv6m` target is fixed (thanks [`chxry`](https://github.com/chxry) [919](https://github.com/rhaiscript/rhai/pull/919))

New features
------------

* Added support for _raw strings_ with the syntax `##..#" ... "#..##`.
* Added support for _raw strings_ with the syntax `##..#" ... "#..##` (thanks [`@cellomath`](https://github.com/cellomath) [908](https://github.com/rhaiscript/rhai/pull/908) [910](https://github.com/rhaiscript/rhai/pull/910)).

Enhancements
------------

* New `as_immutable_string_ref`, `as_array_ref`, `as_blob_ref`, `as_map_ref` plus their `_mut` variants for `Dynamic`.
* New `as_immutable_string_ref`, `as_array_ref`, `as_blob_ref`, `as_map_ref` plus their `_mut` variants for `Dynamic` (thanks [`@madonuko`](https://github.com/madonuko) [904](https://github.com/rhaiscript/rhai/pull/904)).
* The `break`, `return` and `throw` statements can now be simply used as `switch` case statement expressions. Previously it is required that the statement be wrapped in a block.


Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ rhai_codegen = { version = "2.1.0", path = "codegen" }

no-std-compat = { git = "https://gitlab.com/jD91mZM2/no-std-compat", version = "0.4.1", default-features = false, features = ["alloc"], optional = true }
libm = { version = "0.2.0", default-features = false, optional = true }
hashbrown = { version = "0.14.0", optional = true }
hashbrown = { version = "0.15.0", optional = true }
core-error = { version = "0.0.0", default-features = false, features = ["alloc"], optional = true }
serde = { version = "1.0.96", default-features = false, features = ["derive", "alloc"], optional = true }
serde_json = { version = "1.0.45", default-features = false, features = ["alloc"], optional = true }
Expand Down
4 changes: 0 additions & 4 deletions codegen/src/test/custom_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ mod custom_type_tests {
#[derive(Clone, CustomType)]
pub struct Bar(
#[rhai_type(skip)]
#[cfg(not(feature = "no_float"))]
rhai::FLOAT,
INT,
#[rhai_type(name = "boo", readonly)]
Expand Down Expand Up @@ -49,7 +48,6 @@ mod custom_type_tests {
#[derive(CustomType)]
#[rhai_type(skip, name = "MyFoo", extra = Self::build_extra)]
pub struct Foo {
#[cfg(not(feature = "no_float"))]
#[rhai_type(skip)]
_dummy: rhai::FLOAT,
#[rhai_type(get = get_bar)]
Expand Down Expand Up @@ -100,7 +98,6 @@ mod custom_type_tests {
#[derive(Clone, CustomType)]
pub struct Bar(
#[rhai_type(skip)]
#[cfg(not(feature = "no_float"))]
rhai::FLOAT,
INT,
/// boo comments.
Expand Down Expand Up @@ -143,7 +140,6 @@ mod custom_type_tests {
#[derive(CustomType)]
#[rhai_type(skip, name = "MyFoo", extra = Self::build_extra)]
pub struct Foo {
#[cfg(not(feature = "no_float"))]
#[rhai_type(skip)]
_dummy: rhai::FLOAT,
#[rhai_type(get = get_bar)]
Expand Down
4 changes: 0 additions & 4 deletions codegen/src/test/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,6 @@ mod generate_tests {
fn one_fn_with_cfg_module() {
let input_tokens: TokenStream = quote! {
pub mod one_fn {
#[cfg(not(feature = "no_float"))]
pub mod it_is {
pub fn increment(x: &mut FLOAT) {
*x += 1.0 as FLOAT;
Expand All @@ -1482,7 +1481,6 @@ mod generate_tests {
let expected_tokens = quote! {
#[allow(clippy::needless_pass_by_value, clippy::needless_pass_by_ref_mut)]
pub mod one_fn {
#[cfg(not(feature = "no_float"))]
#[allow(clippy::needless_pass_by_value, clippy::needless_pass_by_ref_mut)]
pub mod it_is {
pub fn increment(x: &mut FLOAT) {
Expand Down Expand Up @@ -1541,10 +1539,8 @@ mod generate_tests {
#[inline(always)]
pub fn rhai_generate_into_module(_m: &mut Module, _flatten: bool) {
if _flatten {
#[cfg(not(feature = "no_float"))]
self::it_is::rhai_generate_into_module(_m, _flatten);
} else {
#[cfg(not(feature = "no_float"))]
_m.set_sub_module("it_is", self::it_is::rhai_module_generate());
}
}
Expand Down
5 changes: 1 addition & 4 deletions codegen/tests/test_custom_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ use rhai::{CustomType, Engine, TypeBuilder, INT};

#[derive(Clone, CustomType)]
pub struct Bar(
#[rhai_type(skip)]
#[cfg(not(feature = "no_float"))] // check other attributes
rhai::FLOAT,
#[rhai_type(skip)] rhai::FLOAT,

Check warning on line 7 in codegen/tests/test_custom_type.rs

View workflow job for this annotation

GitHub Actions / Codegen Build (stable, ubuntu-latest, false, --features metadata)

field `0` is never read

Check warning on line 7 in codegen/tests/test_custom_type.rs

View workflow job for this annotation

GitHub Actions / Codegen Build (stable, windows-latest, false, --features metadata)

field `0` is never read
INT,
#[rhai_type(name = "boo", readonly)] String,
Vec<INT>,
Expand All @@ -15,7 +13,6 @@ pub struct Bar(
#[derive(Clone, Default, CustomType)]
#[rhai_type(name = "MyFoo", extra = Self::build_extra)]
pub struct Foo {
#[cfg(not(feature = "no_float"))] // check other attributes
#[rhai_type(skip)]
_dummy: rhai::FLOAT,
#[rhai_type(get = get_bar)]
Expand Down
6 changes: 5 additions & 1 deletion codegen/ui_tests/rhai_mod_inner_cfg_false.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ note: found an item that was configured out
|
12 | pub mod test_mod {
| ^^^^^^^^
= note: the item is gated behind the `unset_feature` feature
note: the item is gated behind the `unset_feature` feature
--> ui_tests/rhai_mod_inner_cfg_false.rs:11:11
|
11 | #[cfg(feature = "unset_feature")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unexpected `cfg` condition value: `unset_feature`
--> ui_tests/rhai_mod_inner_cfg_false.rs:11:11
Expand Down
4 changes: 1 addition & 3 deletions codegen/ui_tests/rhai_mod_unknown_type.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ help: a struct with a similar name exists
|
12 | pub fn test_fn(input: Point) -> bool {
| ~~~~~
help: consider importing one of these items
|
11 + use core::fmt::Pointer;
help: consider importing this trait
|
11 + use std::fmt::Pointer;
|

0 comments on commit 801c2ad

Please sign in to comment.