Skip to content

a missing semicolon can mess up the whole diagnostics #5924

Closed
@0x8f701

Description

@0x8f701

The following example has a missing semicolon, this semicolon has broken the whole diagnostic, The Butterfly Effect makes it hard to understand what's exactly happening and give a really bad develop experience.

Code:

use std::sync::{Arc, RwLock};

async fn test(data: Arc<RwLock<usize>>) -> usize {
    *data.write().unwrap() += 2;
    *data.write().unwrap()
}

#[async_std::main]
async fn main() -> Result<(), ()> {
    let data = Arc::new(RwLock::new(1)) // missing semicolon :)
    println!("{}", test(data).await);
    println!("Hello, world!");
    Ok(())
}

What's showing as diagnostics:

image

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions