Skip to content

RA cannot defer the type from a macro #19537

@Indra-db

Description

@Indra-db

rust-analyzer version: rust-analyzer version: 0.4.2369-standalone (588948f 2025-04-06)

rustc version: rustc 1.86.0 (05f9846f8 2025-03-31)

editor or extension: pre-release (release same problem): Version
0.4.2369
Last Updated
2025-04-07,

code snippet to reproduce:
cargo.toml

crabtime = "1.1.3"
fn main() {
    let x = {
        #[crabtime::eval_function()]
        fn boo2() {
            crabtime::output! {
                5u32
            }
        }
    };
}

RA reports x: () while with the expanded code from RA, it reports correctly u32
expanded:

let x = { 
#[doc = " # Compilation Stats"]
#[doc = " Start: 01:23:04 (771)"]
#[doc = " Duration: 0.50 s"]
#[doc = " Cached: false"]
#[doc = " Output Dir: /Users/indra/Code/git/flecs_rust/target/rust-analyzer/debug/build/crabtime/project_f940e44a8c006acd/pid_59609"]
#[doc = " Macro Options: MacroOptions {"]
#[doc = "     cache: true,"]
#[doc = "     content_base_name: false,"]
#[doc = " }"]
#[cfg(any())]
const _:() = ();
5u32
};
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macromacro expansionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions