Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ Bug fixes
---------

* `Engine::compact_script` now properly compacts scripts with custom syntax that uses `$raw$` (thanks [`@yuvalrakavy`](https://github.com/yuvalrakavy) [`#1079`](https://github.com/rhaiscript/rhai/pull/1079)).
* The string methods `split`, `split_rev` and their variants are now marked pure so they can be called on `const` strings ([`#1081`](https://github.com/rhaiscript/rhai/issues/1081)).
* The string methods `split`, `split_rev` and their variants are now marked `pure` so they can be called on constant strings (thanks [`@theJC`](https://github.com/theJC) [`#1082`](https://github.com/rhaiscript/rhai/pull/1082)).

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

* A new advanced callback, `Engine::on_missing_function`, is added (gated under the `internals` feature) to override default handling when a called function or method is not found (thanks [`@yuvalrakavy`](https://github.com/yuvalrakavy) [`#1067`](https://github.com/rhaiscript/rhai/pull/1067)).
* A new method, `EvalContext::new_frame`, is added to created an isolated frame guard that automatically restores field values upon `Drop` (thanks [`@yuvalrakavy`](https://github.com/yuvalrakavy) for the idea [`#1085`](https://github.com/rhaiscript/rhai/pull/1085)).

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

* Procedural macros such as `#[export_module]` and `#[derive(CustomType)]` no longer require importing standard Rhai types (thanks [`@timokoesters`](https://github.com/timokoesters) [`#1071`](https://github.com/rhaiscript/rhai/pull/1071)).
* `FnPtr::call_fn_as_method` and `FnPtr::call_as_method_within_context` are added (when not under `no_object`) to accept a `this` pointer for calling the function pointer as a method call.
* `NativeCallContext::call_method` and `NativeCallContext::call_native_method` are added (when not under `no_object`) to accept a `this` pointer for method calls.
* `FnPtr::call_fn_as_method` and `FnPtr::call_as_method_within_context` are added (when not under `no_object`) to accept a `this` pointer for calling the function pointer as a method call ([`#1080`](https://github.com/rhaiscript/rhai/pull/1080)).
* `NativeCallContext::call_method` and `NativeCallContext::call_native_method` are added (when not under `no_object`) to accept a `this` pointer for method calls ([`#1080`](https://github.com/rhaiscript/rhai/pull/1080)).


Version 1.24.0
Expand Down
6 changes: 0 additions & 6 deletions codegen/ui_tests/export_fn_bad_attr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: unknown attribute 'unknown'
|
10 | #[export_fn(unknown = "thing")]
| ^^^^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_bad_attr.rs:17:8
|
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 0 additions & 6 deletions codegen/ui_tests/export_fn_bad_value.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: expecting string literal
|
10 | #[export_fn(name = true)]
| ^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_bad_value.rs:17:8
|
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 0 additions & 6 deletions codegen/ui_tests/export_fn_extra_value.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: extraneous value
|
10 | #[export_fn(return_raw = "yes")]
| ^^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_extra_value.rs:17:8
|
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 0 additions & 6 deletions codegen/ui_tests/export_fn_junk_arg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: expecting identifier
|
10 | #[export_fn("wheeeee")]
| ^^^^^^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_junk_arg.rs:17:8
|
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 0 additions & 6 deletions codegen/ui_tests/export_fn_missing_value.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: requires value
|
10 | #[export_fn(name)]
| ^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_missing_value.rs:17:8
|
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 0 additions & 6 deletions codegen/ui_tests/export_fn_path_attr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: expecting attribute name
|
10 | #[export_fn(rhai::name = "thing")]
| ^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_path_attr.rs:17:8
|
17 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 0 additions & 6 deletions codegen/ui_tests/export_fn_raw_noreturn.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: functions marked with 'return_raw' must return Result<T, Box<EvalAltResul
|
10 | #[export_fn(return_raw)]
| ^^^^^^^^^^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/export_fn_raw_noreturn.rs:17:5
|
17 | test_fn(&mut n);
| ^^^^^^^ not found in this scope
8 changes: 0 additions & 8 deletions codegen/ui_tests/export_mod_bad_attr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: unknown attribute 'unknown'
|
11 | #[rhai_fn(unknown = "thing")]
| ^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_mod`
--> ui_tests/export_mod_bad_attr.rs:22:8
|
22 | if test_mod::test_fn(n) {
| ^^^^^^^^ use of unresolved module or unlinked crate `test_mod`
|
= help: if you wanted to use a crate named `test_mod`, use `cargo add test_mod` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/export_mod_bad_value.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: expecting string literal
|
11 | #[rhai_fn(name = true)]
| ^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_mod`
--> ui_tests/export_mod_bad_value.rs:22:8
|
22 | if test_mod::test_fn(n) {
| ^^^^^^^^ use of unresolved module or unlinked crate `test_mod`
|
= help: if you wanted to use a crate named `test_mod`, use `cargo add test_mod` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/export_mod_cfg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: expected attribute arguments in parentheses: #[rhai_fn(...)]
|
12 | #[rhai_fn]
| ^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_mod`
--> ui_tests/export_mod_cfg.rs:23:8
|
23 | if test_mod::test_fn(n) {
| ^^^^^^^^ use of unresolved module or unlinked crate `test_mod`
|
= help: if you wanted to use a crate named `test_mod`, use `cargo add test_mod` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/export_mod_extra_value.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: extraneous value
|
11 | #[rhai_fn(return_raw = "yes")]
| ^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_mod`
--> ui_tests/export_mod_extra_value.rs:22:8
|
22 | if test_mod::test_fn(n) {
| ^^^^^^^^ use of unresolved module or unlinked crate `test_mod`
|
= help: if you wanted to use a crate named `test_mod`, use `cargo add test_mod` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/export_mod_junk_arg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: expecting identifier
|
11 | #[rhai_fn("wheeeee")]
| ^^^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_mod`
--> ui_tests/export_mod_junk_arg.rs:22:8
|
22 | if test_mod::test_fn(n) {
| ^^^^^^^^ use of unresolved module or unlinked crate `test_mod`
|
= help: if you wanted to use a crate named `test_mod`, use `cargo add test_mod` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/export_mod_missing_value.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: requires value
|
11 | #[rhai_fn(name)]
| ^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_mod`
--> ui_tests/export_mod_missing_value.rs:22:8
|
22 | if test_mod::test_fn(n) {
| ^^^^^^^^ use of unresolved module or unlinked crate `test_mod`
|
= help: if you wanted to use a crate named `test_mod`, use `cargo add test_mod` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/export_mod_path_attr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: expecting attribute name
|
11 | #[rhai_fn(rhai::name = "thing")]
| ^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_mod`
--> ui_tests/export_mod_path_attr.rs:22:8
|
22 | if test_mod::test_fn(n) {
| ^^^^^^^^ use of unresolved module or unlinked crate `test_mod`
|
= help: if you wanted to use a crate named `test_mod`, use `cargo add test_mod` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/export_mod_raw_noreturn.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: functions marked with 'return_raw' must return Result<T, Box<EvalAltResul
|
11 | #[rhai_fn(return_raw)]
| ^^^^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_mod`
--> ui_tests/export_mod_raw_noreturn.rs:22:5
|
22 | test_mod::test_fn(&mut n);
| ^^^^^^^^ use of unresolved module or unlinked crate `test_mod`
|
= help: if you wanted to use a crate named `test_mod`, use `cargo add test_mod` to add it to your `Cargo.toml`
6 changes: 0 additions & 6 deletions codegen/ui_tests/first_shared_ref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: references from Rhai in this position must be mutable
|
12 | pub fn test_fn(input: &NonClonable) -> bool {
| ^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/first_shared_ref.rs:23:8
|
23 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 0 additions & 6 deletions codegen/ui_tests/return_mut_ref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: Rhai functions cannot return references
|
14 | pub fn test_fn(input: &mut Clonable) -> &mut bool {
| ^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/return_mut_ref.rs:25:8
|
25 | if test_fn(n) {
| ^^^^^^^ not found in this scope
6 changes: 0 additions & 6 deletions codegen/ui_tests/return_pointer.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: Rhai functions cannot return pointers
|
13 | pub fn test_fn(input: Clonable) -> *const str {
| ^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/return_pointer.rs:25:19
|
25 | let ptr = test_fn(n);
| ^^^^^^^ not found in this scope
6 changes: 0 additions & 6 deletions codegen/ui_tests/return_shared_ref.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,3 @@ error: Rhai functions cannot return references
|
13 | pub fn test_fn(input: Clonable) -> &'static str {
| ^

error[E0425]: cannot find function `test_fn` in this scope
--> ui_tests/return_shared_ref.rs:24:20
|
24 | println!("{}", test_fn(n));
| ^^^^^^^ not found in this scope
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_bad_attr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: unknown attribute 'unknown'
|
11 | #[rhai_fn(unknown = "thing")]
| ^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_bad_attr.rs:22:8
|
22 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_bad_value.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: expecting string literal
|
11 | #[rhai_fn(name = true)]
| ^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_bad_value.rs:22:8
|
22 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
14 changes: 0 additions & 14 deletions codegen/ui_tests/rhai_fn_duplicate_attr.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,3 @@ error: duplicated attribute 'rhai_fn'
|
6 | #[rhai_fn(pure)]
| ^

error[E0425]: cannot find value `n` in this scope
--> ui_tests/rhai_fn_duplicate_attr.rs:13:29
|
13 | if test_module::test_fn(n) {
| ^ not found in this scope

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_duplicate_attr.rs:13:8
|
13 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_extra_value.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: extraneous value
|
11 | #[rhai_fn(return_raw = "yes")]
| ^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_extra_value.rs:22:8
|
22 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_getter_conflict.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: conflicting setter
|
12 | #[rhai_fn(name = "foo", get = "foo", set = "bar")]
| ^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_getter_conflict.rs:23:8
|
23 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_getter_multiple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: conflicting getter
|
12 | #[rhai_fn(name = "foo", get = "foo", get = "bar")]
| ^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_getter_multiple.rs:23:8
|
23 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_getter_return.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: property getter must return a value
|
13 | pub fn test_fn(input: &mut Point) {
| ^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_getter_return.rs:23:5
|
23 | test_module::test_fn(&mut n);
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_getter_signature.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: property getter requires exactly 1 parameter
|
13 | pub fn test_fn(input: Point, value: bool) -> bool {
| ^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_getter_signature.rs:23:8
|
23 | if test_module::test_fn(n, true) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_global_multiple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: namespace is already set to 'global'
|
12 | #[rhai_fn(global, internal)]
| ^^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_global_multiple.rs:23:8
|
23 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_index_getter_multiple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: conflicting index_get
|
12 | #[rhai_fn(name = "foo", index_get, index_get)]
| ^^^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_index_getter_multiple.rs:23:8
|
23 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_index_getter_return.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: index getter must return a value
|
13 | pub fn test_fn(input: &mut Point, i: f32) {
| ^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_index_getter_return.rs:23:8
|
23 | if test_module::test_fn(&mut n, 5.0) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_index_getter_signature.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: index getter requires exactly 2 parameters
|
13 | pub fn test_fn(input: Point) -> bool {
| ^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_index_getter_signature.rs:23:8
|
23 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
8 changes: 0 additions & 8 deletions codegen/ui_tests/rhai_fn_index_setter_multiple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,3 @@ error: conflicting index_set
|
12 | #[rhai_fn(name = "foo", index_set, index_set)]
| ^^^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `test_module`
--> ui_tests/rhai_fn_index_setter_multiple.rs:23:8
|
23 | if test_module::test_fn(n) {
| ^^^^^^^^^^^ use of unresolved module or unlinked crate `test_module`
|
= help: if you wanted to use a crate named `test_module`, use `cargo add test_module` to add it to your `Cargo.toml`
Loading
Loading