zed icon indicating copy to clipboard operation
zed copied to clipboard

rust-analyzer bug in modules

Open JohnKesko opened this issue 1 year ago • 1 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

I'm quite new to Rust so bare with me.

When using a lib.rs and declaring a public module inside lib.rs, I have a few macros. For example:

#[macro_export] macro_rules! info { ($($arg:tt)*) => {{ $crate::logger::log($crate::logger::LogLevel::Info, format!($($arg)*)); }}; }

The log function and macros lives inside the same module.

However, the macro info! is calling the log function but if the log function is not using the 'pub' keyword, the rust-analyzer complains about "dead code" so it wont compile. See screenshot. If I add the 'pub' keyword, it's fine.

Is this expected behaviour or just me being a newb?

Environment

M1 - Sonoma 14.2

If applicable, add mockups / screenshots to help explain present your vision of the feature

With 'pub' keyword: pub

No 'pub' keyword: no  pub

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

JohnKesko avatar Feb 27 '24 12:02 JohnKesko

Are you saying that this is a Zed issue or is it a rust-analyzer issue? If it's the latter, I think an issue opened in the rust-analyzer repository might make more sense :)

mrnugget avatar Feb 27 '24 13:02 mrnugget

This doesn't seem like a Zed issue.

maxdeviant avatar Mar 12 '24 16:03 maxdeviant