Skip to content

Bug whith cfg blocks #8378

@JMS55

Description

@JMS55
#[cfg(feature = "profile")]
pub struct TaskRecord {
    start: Instant,
}

#[cfg(feature = "profile")]
pub type ProfilingReturnType = TaskRecord;
#[cfg(not(feature = "profile"))]
pub type ProfilingReturnType = ();


pub fn profile_task(name: &'static str) -> ProfilingReturnType {
    #[cfg(feature = "profile")]
    { // Error start
        TaskRecord {
            start: Instant::now(),
        }
    } // Error end
    #[cfg(not(feature = "profile"))]
    let _ = name;
}

rust-analyzer: "Remove this semicolon"
It says the error is at the marked region

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsdiagnostics / error reporting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions