Skip to content
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

tokio::test and ntest::timeout combination results in macro_error #11326

Closed
badochov opened this issue Jan 20, 2022 · 2 comments
Closed

tokio::test and ntest::timeout combination results in macro_error #11326

badochov opened this issue Jan 20, 2022 · 2 comments
Labels
A-macro macro expansion C-bug Category: bug

Comments

@badochov
Copy link

badochov commented Jan 20, 2022

When given this code:

#[tokio::test]
#[ntest::timeout(1000)]
async fn simple_test() {
  println!("Hi");
}

rust-analyzer results in Expected identifier!rust-analyzer(macro-error), when this code works well and compiles.

rust-analyzer version: 0add6e95e 2021-12-20 stable

rustc version: rustc 1.56.0 (09c42c458 2021-10-18)

@bjorn3 bjorn3 added A-macro macro expansion C-bug Category: bug labels Jan 20, 2022
@jyn514
Copy link
Member

jyn514 commented Jan 25, 2022

Another possibly related error: Rust-analyzer errors on this bit of code, even though it compiles fine: https://github.com/cloudflare/boring/blob/5f327aba86aab67af58f0db44e61d5b71b6eb84e/boring/src/x509/mod.rs#L44-L50

foreign_type_and_impl_send_sync! {
    type CType = ffi::X509_STORE_CTX;
    fn drop = ffi::X509_STORE_CTX_free;

    /// An `X509` certificate store context.
    pub struct X509StoreContext;
}

foreign_type_and_impl_send_sync is defined as https://github.com/cloudflare/boring/blob/5f327aba86aab67af58f0db44e61d5b71b6eb84e/boring/src/macros.rs#L133-L154:

macro_rules! foreign_type_and_impl_send_sync {
    (
        $(#[$impl_attr:meta])*
        type CType = $ctype:ty;
        fn drop = $drop:expr;
        $(fn clone = $clone:expr;)*

        $(#[$owned_attr:meta])*
        pub struct $owned:ident;
    )
        => {
            foreign_type! {
                $(#[$impl_attr])*
                $(#[$owned_attr])*
                pub unsafe type $owned: Send + Sync {
                    type CType = $ctype;
                    fn drop = $drop;
                    $(fn clone = $clone;)*
                }
            }
        };
}

and foreign_type! is https://docs.rs/foreign-types/0.5.0/foreign_types/macro.foreign_type.html.

@mati865
Copy link
Contributor

mati865 commented Jul 18, 2023

I think this is an upstream ntest issue that should be fixed by becheran/ntest#23

Also this bug is a duplicate of #11109

@flodiebold flodiebold closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macro macro expansion C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

5 participants