Skip to content

Commit cfe8b82

Browse files
committed
Fix test outputs and warnings.
1 parent 3ca0166 commit cfe8b82

8 files changed

Lines changed: 22 additions & 10 deletions

‎CHANGELOG.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ Bug fixes
1919
* Rhai and Rhai Grain now properly enforce object map size limits in all mutation scenarios ([`#1214`](https://github.com/rhaiscript/rhai/issues/1214)).
2020
* (Fuzzing) Fixed panic when assigning to a property of a constant object.
2121
* Fixed undefined behavior (an aliasing violation detected by Miri) when a variable is passed to a function that does not take its first argument by `&mut`, e.g. `x.contains("a")` or `f(x)` for a script function. This was a regression in 1.27.0.
22-
* `sort` and `sort_desc` no longer panic on an array of floating-point numbers that contains NaN. NaN now sorts after every other number (before them for `sort_desc`) (thanks [`@Rockyrok77`](https://github.com/Rockyrok77)).
23-
* `pad` on an array now enforces `max_array_size` when the padding length is large enough to overflow the size calculation. Previously it could pass the check and then panic or abort the process while allocating (thanks [`@Rockyrok77`](https://github.com/Rockyrok77)).
24-
* `eval` is no longer allowed in `Engine::eval_expression` and `Engine::compile_expression`. Previously it could run statements, loops and assignments inside an expression, including assignments to variables in the `Scope` passed in (thanks [`@Rockyrok77`](https://github.com/Rockyrok77)).
22+
* `sort` and `sort_desc` no longer panic on an array of floating-point numbers that contains NaN. NaN now sorts after every other number (before them for `sort_desc`) (thanks [`@Rockyrok77`](https://github.com/Rockyrok77) ([`#1216`](https://github.com/rhaiscript/rhai/pull/1216)).
23+
* `pad` on an array now enforces `max_array_size` when the padding length is large enough to overflow the size calculation (thanks [`@Rockyrok77`](https://github.com/Rockyrok77) ([`#1218`](https://github.com/rhaiscript/rhai/pull/1218)).
24+
* `eval` is no longer allowed in `Engine::eval_expression` and `Engine::compile_expression` (thanks [`@Rockyrok77`](https://github.com/Rockyrok77) ([`#1223`](https://github.com/rhaiscript/rhai/pull/1223)).
2525

2626
Enhancements
2727
------------

‎codegen/ui_tests/non_clonable.stderr‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
1010
note: required by a bound in `Dynamic::cast`
1111
--> $WORKSPACE/src/types/dynamic.rs
1212
|
13+
| impl Dynamic {
14+
...
1315
| pub fn cast<T: Any + Clone>(self) -> T {
1416
| ^^^^^ required by this bound in `Dynamic::cast`
1517
help: consider annotating `NonClonable` with `#[derive(Clone)]`

‎codegen/ui_tests/non_clonable_second.stderr‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
1010
note: required by a bound in `Dynamic::cast`
1111
--> $WORKSPACE/src/types/dynamic.rs
1212
|
13+
| impl Dynamic {
14+
...
1315
| pub fn cast<T: Any + Clone>(self) -> T {
1416
| ^^^^^ required by this bound in `Dynamic::cast`
1517
help: consider annotating `NonClonable` with `#[derive(Clone)]`

‎codegen/ui_tests/rhai_fn_non_clonable_return.stderr‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
1515
note: required by a bound in `Dynamic::from`
1616
--> $WORKSPACE/src/types/dynamic.rs
1717
|
18+
| impl Dynamic {
19+
...
1820
| pub fn from<T: Variant + Clone>(value: T) -> Self {
1921
| ^^^^^ required by this bound in `Dynamic::from`
2022
= note: this error originates in the attribute macro `export_fn` (in Nightly builds, run with -Z macro-backtrace for more info)

‎codegen/ui_tests/rhai_mod_non_clonable_return.stderr‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
1616
note: required by a bound in `Dynamic::from`
1717
--> $WORKSPACE/src/types/dynamic.rs
1818
|
19+
| impl Dynamic {
20+
...
1921
| pub fn from<T: Variant + Clone>(value: T) -> Self {
2022
| ^^^^^ required by this bound in `Dynamic::from`
2123
= note: this error originates in the attribute macro `export_module` (in Nightly builds, run with -Z macro-backtrace for more info)

‎codegen/ui_tests/rhai_mod_unknown_type.stderr‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
error[E0425]: cannot find type `Pointer` in this scope
22
--> ui_tests/rhai_mod_unknown_type.rs:12:27
33
|
4-
4 | pub struct Point {
5-
| ---------------- similarly named struct `Point` defined here
6-
...
74
12 | pub fn test_fn(input: Pointer) -> bool {
8-
| ^^^^^^^
5+
| ^^^^^^^ not found in this scope
6+
|
7+
note: similarly named struct `Point` defined here
8+
--> ui_tests/rhai_mod_unknown_type.rs:4:1
99
|
10+
4 | pub struct Point {
11+
| ^^^^^^^^^^^^^^^^
1012
help: a struct with a similar name exists
1113
|
1214
12 - pub fn test_fn(input: Pointer) -> bool {

‎codegen/ui_tests/rhai_mod_unknown_type_return.stderr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0425]: cannot find type `boool` in this scope
22
--> ui_tests/rhai_mod_unknown_type_return.rs:12:37
33
|
44
12 | pub fn test_fn(input: Point) -> boool {
5-
| ^^^^^
5+
| ^^^^^ not found in this scope
66
|
77
help: a builtin type with a similar name exists
88
|

‎src/func/func_call.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,8 @@ impl Engine {
618618
.as_ref()
619619
.map_or(0, |dbg| dbg.call_stack().len());
620620

621-
let value_copy = &mut Dynamic::UNIT;
621+
let mut unit = Dynamic::UNIT;
622+
let value_copy = &mut unit;
622623
let backup = &mut ArgBackup::new();
623624

624625
// Calling non-method function but the first argument is a reference?
@@ -924,7 +925,8 @@ impl Engine {
924925
)
925926
} else {
926927
// Normal call of script function
927-
let value_copy = &mut Dynamic::UNIT;
928+
let mut unit = Dynamic::UNIT;
929+
let value_copy = &mut unit;
928930
let backup = &mut ArgBackup::new();
929931

930932
// The first argument is a reference?

0 commit comments

Comments
 (0)