Proc macro not expanding (tokio::main, I guess?)

I've a project (for debugging purposes only) that, as part of a workspace, works fine using tokio::main from another crate. For some reason, if I create a Cargo project out of that workspace I get:

proc macro main not expanded: Proc macros are disabled

This is the entry program:

#![feature(async_closure)]

mod app_ftl;

rialight::initialize!(async move |app| {
    let mut app_ftl = crate::app_ftl::create();
    if !app_ftl.mutable().load(None).await {
        return;
    }
    println!("{}", app_ftl.get_message_string("hello-world", None, &mut vec![]).unwrap());
});

(There's only one error.)

Here's the full debug project:

https://github.com/hydroper/rialight-debug-project

It uses github.com/rialight/api. In particular, rialight/src/lib.rs:

// ...

#[doc(hidden)]
pub use tokio as __tokio;

#[macro_export]
macro_rules! initialize {
    ($lambda_exp:expr) => {
        use rialight::__tokio as __rialight_tokio;

        #[__rialight_tokio::main(crate = "__rialight_tokio")]
        async fn main() {
            use std::sync::{Arc};
            use rialight::app::Application;
            include!(concat!(env!("OUT_DIR"), "/rialight_entry.rs"));
            let app = Arc::new(Application {});
            let user_ie: fn(Arc<Application>) -> _ = $lambda_exp;
            user_ie(app.clone()).await;
        }
    };
}

I also confirmed that relying directly on rialight via:

[dependencies]
#rialight = "1"
rialight = { path = "../api/rialight" }

Leads to the same error. Somehow it works with another crate that is shipped with the workspace.

Strange! It happens in the IDE (rust-analyzer), but not when I run it through the command prompt. I tried cargo run and it works.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.