-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#[sqlx::test]
imported with #[macro_use]
causes a stack overflow in rustc
#2017
Comments
This is happening because It looks like So the fix would be to just do the same thing here and here. In the meantime, I would recommend just using |
#[sqlx::test]
imported with #[macro_use]
causes a stack overflow in rustc
When the `#[sqlx::test]` macro is imported using `#[macro_use]` such as in the following example: ```rust extern crate sqlx; mod tests { #[test] fn something() {} } ``` then the `#[test]` generated by the macro will refer to itself instead of the standard Rust `#[test]` macro. This will cause `rustc` to recursively expand it and produce the following error message: ``` thread 'rustc' has overflowed its stack fatal runtime error: stack overflow ``` Instead, we can just refer to the standard macro by using its fully qualified path. This PR: * Swaps `#[test]` usages in `#[sqlx::test]` for their hygenic path to prevent recursive expansion alongside `#[macro_use]` Closes launchbadge#2017.
When the `#[sqlx::test]` macro is imported using `#[macro_use]` such as in the following example: ```rust extern crate sqlx; mod tests { #[test] fn something() {} } ``` then the `#[test]` generated by the macro will refer to itself instead of the standard Rust `#[test]` macro. This will cause `rustc` to recursively expand it and produce the following error message: ``` thread 'rustc' has overflowed its stack fatal runtime error: stack overflow ``` Instead, we can just refer to the standard macro by using its fully qualified path. This PR: * Swaps `#[test]` usages in `#[sqlx::test]` for their hygenic path to prevent recursive expansion alongside `#[macro_use]` Closes #2017.
My minimal setup:
Contents of src/lib.rs
Then
Ends with
This is Rust 1.62.1. It fails on both macOS and FreeBSD, so I guess it is not platform related.
The text was updated successfully, but these errors were encountered: