Fix macro hygene.
This commit is contained in:
parent
d01a6d428f
commit
6546eae95f
@ -651,7 +651,8 @@ impl ExportedFn {
|
|||||||
let return_span = self
|
let return_span = self
|
||||||
.return_type()
|
.return_type()
|
||||||
.map(|r| r.span())
|
.map(|r| r.span())
|
||||||
.unwrap_or_else(Span::call_site);
|
.unwrap_or_else(Span::call_site)
|
||||||
|
.resolved_at(Span::call_site());
|
||||||
if self.params.return_raw.is_some() {
|
if self.params.return_raw.is_some() {
|
||||||
quote_spanned! { return_span =>
|
quote_spanned! { return_span =>
|
||||||
pub #dynamic_signature {
|
pub #dynamic_signature {
|
||||||
@ -765,7 +766,7 @@ impl ExportedFn {
|
|||||||
syn::Type::Path(ref p) if p.path == str_type_path => {
|
syn::Type::Path(ref p) if p.path == str_type_path => {
|
||||||
is_string = true;
|
is_string = true;
|
||||||
is_ref = true;
|
is_ref = true;
|
||||||
quote_spanned!(arg_type.span() =>
|
quote_spanned!(arg_type.span().resolved_at(Span::call_site()) =>
|
||||||
mem::take(args[#i]).into_immutable_string().unwrap()
|
mem::take(args[#i]).into_immutable_string().unwrap()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -834,7 +835,8 @@ impl ExportedFn {
|
|||||||
let return_span = self
|
let return_span = self
|
||||||
.return_type()
|
.return_type()
|
||||||
.map(|r| r.span())
|
.map(|r| r.span())
|
||||||
.unwrap_or_else(Span::call_site);
|
.unwrap_or_else(Span::call_site)
|
||||||
|
.resolved_at(Span::call_site());
|
||||||
let return_expr = if self.params.return_raw.is_none() {
|
let return_expr = if self.params.return_raw.is_none() {
|
||||||
quote_spanned! { return_span =>
|
quote_spanned! { return_span =>
|
||||||
Ok(Dynamic::from(#sig_name(#(#unpack_exprs),*)))
|
Ok(Dynamic::from(#sig_name(#(#unpack_exprs),*)))
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
error[E0599]: `bool` is not an iterator
|
error[E0599]: `bool` is not an iterator
|
||||||
--> ui_tests/export_fn_raw_return.rs:10:33
|
--> ui_tests/export_fn_raw_return.rs:10:33
|
||||||
|
|
|
|
||||||
|
9 | #[export_fn(return_raw)]
|
||||||
|
| ------------------------ in this procedural macro expansion
|
||||||
10 | pub fn test_fn(input: Point) -> bool {
|
10 | pub fn test_fn(input: Point) -> bool {
|
||||||
| ^^^^ `bool` is not an iterator
|
| ^^^^ `bool` is not an iterator
|
||||||
|
|
|
|
||||||
= note: the following trait bounds were not satisfied:
|
= note: the following trait bounds were not satisfied:
|
||||||
`bool: std::iter::Iterator`
|
`bool: std::iter::Iterator`
|
||||||
which is required by `&mut bool: std::iter::Iterator`
|
which is required by `&mut bool: std::iter::Iterator`
|
||||||
|
= note: this error originates in the attribute macro `export_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
error[E0599]: `bool` is not an iterator
|
error[E0599]: `bool` is not an iterator
|
||||||
--> ui_tests/export_mod_raw_return.rs:12:33
|
--> ui_tests/export_mod_raw_return.rs:12:33
|
||||||
|
|
|
|
||||||
|
9 | #[export_module]
|
||||||
|
| ---------------- in this procedural macro expansion
|
||||||
|
...
|
||||||
12 | pub fn test_fn(input: Point) -> bool {
|
12 | pub fn test_fn(input: Point) -> bool {
|
||||||
| ^^^^ `bool` is not an iterator
|
| ^^^^ `bool` is not an iterator
|
||||||
|
|
|
|
||||||
= note: the following trait bounds were not satisfied:
|
= note: the following trait bounds were not satisfied:
|
||||||
`bool: std::iter::Iterator`
|
`bool: std::iter::Iterator`
|
||||||
which is required by `&mut bool: std::iter::Iterator`
|
which is required by `&mut bool: std::iter::Iterator`
|
||||||
|
= note: this error originates in the attribute macro `export_module` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
|
error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
|
||||||
--> ui_tests/rhai_fn_non_clonable_return.rs:11:8
|
--> ui_tests/rhai_fn_non_clonable_return.rs:11:31
|
||||||
|
|
|
|
||||||
|
10 | #[export_fn]
|
||||||
|
| ------------ in this procedural macro expansion
|
||||||
11 | pub fn test_fn(input: f32) -> NonClonable {
|
11 | pub fn test_fn(input: f32) -> NonClonable {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^-----------
|
| ^^^^^^^^^^^ the trait `Clone` is not implemented for `NonClonable`
|
||||||
| | |
|
|
||||||
| | required by a bound introduced by this call
|
|
||||||
| the trait `Clone` is not implemented for `NonClonable`
|
|
||||||
|
|
|
|
||||||
note: required by a bound in `rhai::Dynamic::from`
|
note: required by a bound in `rhai::Dynamic::from`
|
||||||
--> $WORKSPACE/src/types/dynamic.rs
|
--> $WORKSPACE/src/types/dynamic.rs
|
||||||
|
|
|
|
||||||
| pub fn from<T: Variant + Clone>(value: T) -> Self {
|
| pub fn from<T: Variant + Clone>(value: T) -> Self {
|
||||||
| ^^^^^ required by this bound in `rhai::Dynamic::from`
|
| ^^^^^ required by this bound in `rhai::Dynamic::from`
|
||||||
|
= note: this error originates in the attribute macro `export_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
|
error[E0277]: the trait bound `NonClonable: Clone` is not satisfied
|
||||||
--> ui_tests/rhai_mod_non_clonable_return.rs:12:12
|
--> ui_tests/rhai_mod_non_clonable_return.rs:12:35
|
||||||
|
|
|
|
||||||
|
10 | #[export_module]
|
||||||
|
| ---------------- in this procedural macro expansion
|
||||||
|
11 | pub mod test_mod {
|
||||||
12 | pub fn test_fn(input: f32) -> NonClonable {
|
12 | pub fn test_fn(input: f32) -> NonClonable {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^-----------
|
| ^^^^^^^^^^^ the trait `Clone` is not implemented for `NonClonable`
|
||||||
| | |
|
|
||||||
| | required by a bound introduced by this call
|
|
||||||
| the trait `Clone` is not implemented for `NonClonable`
|
|
||||||
|
|
|
|
||||||
note: required by a bound in `rhai::Dynamic::from`
|
note: required by a bound in `rhai::Dynamic::from`
|
||||||
--> $WORKSPACE/src/types/dynamic.rs
|
--> $WORKSPACE/src/types/dynamic.rs
|
||||||
|
|
|
|
||||||
| pub fn from<T: Variant + Clone>(value: T) -> Self {
|
| pub fn from<T: Variant + Clone>(value: T) -> Self {
|
||||||
| ^^^^^ required by this bound in `rhai::Dynamic::from`
|
| ^^^^^ required by this bound in `rhai::Dynamic::from`
|
||||||
|
= note: this error originates in the attribute macro `export_module` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
Loading…
Reference in New Issue
Block a user