diff --git a/tests/macro/compile_error.rs b/tests/macro/compile_error.rs index 15260078..af1fc165 100644 --- a/tests/macro/compile_error.rs +++ b/tests/macro/compile_error.rs @@ -1,6 +1,6 @@ //! This file is run with the `trybuild` crate to assert compilation errors in the Specta macros. -use specta::Type; +use specta::{specta, Type}; // Invalid inflection #[derive(Type)] @@ -103,7 +103,9 @@ pub struct InvalidSpectaAttribute1; #[specta = "todo"] pub struct InvalidSpectaAttribute2; -#[wasm_bindgen::prelude::wasm_bindgen] +use wasm_bindgen::prelude::wasm_bindgen; + +#[wasm_bindgen] #[specta] pub fn testing() {} diff --git a/tests/macro/compile_error.stderr b/tests/macro/compile_error.stderr index c84438a3..9ab1a09e 100644 --- a/tests/macro/compile_error.stderr +++ b/tests/macro/compile_error.stderr @@ -52,11 +52,19 @@ error: specta: invalid formatted attribute 103 | #[specta = "todo"] | ^^^^^^ +error: specta: You must apply the #[specta] macro before the #[wasm_bindgen] macro + --> tests/macro/compile_error.rs:108:1 + | +108 | #[wasm_bindgen] + | ^^^^^^^^^^^^^^^ + | + = note: this error originates in the attribute macro `wasm_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0601]: `main` function not found in crate `$CRATE` - --> tests/macro/compile_error.rs:104:36 + --> tests/macro/compile_error.rs:110:20 | -104 | pub struct InvalidSpectaAttribute2; - | ^ consider adding a `main` function to `$DIR/tests/macro/compile_error.rs` +110 | pub fn testing() {} + | ^ consider adding a `main` function to `$DIR/tests/macro/compile_error.rs` error[E0277]: the trait bound `UnitExternal: specta::Flatten` is not satisfied --> tests/macro/compile_error.rs:32:11