From d01a6d428f0f770668848f86c83aa77047ba3875 Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Fri, 18 Mar 2022 17:11:52 +0800 Subject: [PATCH] Fix tests. --- codegen/src/module.rs | 2 +- codegen/ui_tests/non_clonable.stderr | 3 +++ codegen/ui_tests/non_clonable_second.stderr | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/codegen/src/module.rs b/codegen/src/module.rs index eaa43070..c25a102d 100644 --- a/codegen/src/module.rs +++ b/codegen/src/module.rs @@ -264,7 +264,7 @@ impl Module { // NB: sub-modules must have their new items for exporting generated in depth-first order // to avoid issues caused by re-parsing them let inner_modules = sub_modules - .drain(..) + .into_iter() .try_fold::<_, _, Result<_, syn::Error>>(Vec::new(), |mut acc, m| { acc.push(m.generate_inner()?); Ok(acc) diff --git a/codegen/ui_tests/non_clonable.stderr b/codegen/ui_tests/non_clonable.stderr index cb0e05d1..8a8fc1f1 100644 --- a/codegen/ui_tests/non_clonable.stderr +++ b/codegen/ui_tests/non_clonable.stderr @@ -1,6 +1,8 @@ error[E0277]: the trait bound `NonClonable: Clone` is not satisfied --> ui_tests/non_clonable.rs:11:23 | +10 | #[export_fn] + | ------------ in this procedural macro expansion 11 | pub fn test_fn(input: NonClonable) -> bool { | ^^^^^^^^^^^ the trait `Clone` is not implemented for `NonClonable` | @@ -9,3 +11,4 @@ note: required by a bound in `rhai::Dynamic::cast` | | pub fn cast(self) -> T { | ^^^^^ required by this bound in `rhai::Dynamic::cast` + = note: this error originates in the attribute macro `export_fn` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/codegen/ui_tests/non_clonable_second.stderr b/codegen/ui_tests/non_clonable_second.stderr index 359a145c..413c3a70 100644 --- a/codegen/ui_tests/non_clonable_second.stderr +++ b/codegen/ui_tests/non_clonable_second.stderr @@ -1,6 +1,8 @@ error[E0277]: the trait bound `NonClonable: Clone` is not satisfied --> ui_tests/non_clonable_second.rs:11:27 | +10 | #[export_fn] + | ------------ in this procedural macro expansion 11 | pub fn test_fn(a: u32, b: NonClonable) -> bool { | ^^^^^^^^^^^ the trait `Clone` is not implemented for `NonClonable` | @@ -9,3 +11,4 @@ note: required by a bound in `rhai::Dynamic::cast` | | pub fn cast(self) -> T { | ^^^^^ required by this bound in `rhai::Dynamic::cast` + = note: this error originates in the attribute macro `export_fn` (in Nightly builds, run with -Z macro-backtrace for more info)