Improve proc macro hygiene

This commit is contained in:
J Henry Waugh
2020-08-02 19:27:19 -05:00
parent 5eed5fe6a3
commit 3136188801
19 changed files with 258 additions and 163 deletions

View File

@@ -1,4 +1,4 @@
use rhai::export_fn;
use rhai::plugin::*;
struct NonClonable {
a: f32,

View File

@@ -5,7 +5,7 @@ error: references from Rhai in this position must be mutable
| ^^^^^^^^^^^^
error[E0425]: cannot find function `test_fn` in this scope
--> $DIR/first_shared_ref.rs:17:8
--> $DIR/first_shared_ref.rs:22:8
|
17 | if test_fn(n) {
22 | if test_fn(n) {
| ^^^^^^^ not found in this scope

View File

@@ -1,4 +1,4 @@
use rhai::export_fn;
use rhai::plugin::*;
struct NonClonable {
a: f32,

View File

@@ -1,4 +1,4 @@
use rhai::export_fn;
use rhai::plugin::*;
struct NonClonable {
a: f32,

View File

@@ -1,4 +1,4 @@
use rhai::export_fn;
use rhai::plugin::*;
#[derive(Clone)]
struct Clonable {

View File

@@ -5,7 +5,7 @@ error: cannot return a reference to Rhai
| ^^^^^^^^^^^^
error[E0425]: cannot find function `test_fn` in this scope
--> $DIR/return_mut_ref.rs:18:8
--> $DIR/return_mut_ref.rs:23:8
|
18 | if test_fn(n) {
23 | if test_fn(n) {
| ^^^^^^^ not found in this scope

View File

@@ -1,4 +1,4 @@
use rhai::export_fn;
use rhai::plugin::*;
#[derive(Clone)]
struct Clonable {

View File

@@ -5,7 +5,7 @@ error: cannot return a pointer to Rhai
| ^^^^^^^^^^^^^
error[E0425]: cannot find function `test_fn` in this scope
--> $DIR/return_pointer.rs:18:39
--> $DIR/return_pointer.rs:24:19
|
18 | println!("{}", unsafe { let ptr = test_fn(n); *ptr });
| ^^^^^^^ not found in this scope
24 | let ptr = test_fn(n);
| ^^^^^^^ not found in this scope

View File

@@ -1,4 +1,4 @@
use rhai::export_fn;
use rhai::plugin::*;
#[derive(Clone)]
struct Clonable {

View File

@@ -1,11 +1,11 @@
error: cannot return a reference to Rhai
--> $DIR/return_shared_ref.rs:12:33
|
12 | pub fn test_fn(input: Clonable) -> & 'static str {
| ^^^^^^^^^^^^^^^^
12 | pub fn test_fn(input: Clonable) -> &'static str {
| ^^^^^^^^^^^^^^^
error[E0425]: cannot find function `test_fn` in this scope
--> $DIR/return_shared_ref.rs:18:20
--> $DIR/return_shared_ref.rs:23:20
|
18 | println!("{}", test_fn(n));
23 | println!("{}", test_fn(n));
| ^^^^^^^ not found in this scope

View File

@@ -1,4 +1,4 @@
use rhai::export_fn;
use rhai::plugin::*;
#[derive(Clone)]
pub struct Clonable {

View File

@@ -5,7 +5,7 @@ error: this type in this position passes from Rhai by value
| ^^^^^
error[E0425]: cannot find function `test_fn` in this scope
--> $DIR/second_shared_ref.rs:18:8
--> $DIR/second_shared_ref.rs:23:8
|
18 | if test_fn(n, &true) {
23 | if test_fn(n, &true) {
| ^^^^^^^ not found in this scope