Skip to content

thread 'main' has overflowed its stack #63550

@Smicry

Description

@Smicry

There're something wrong with my code , but I don't know why ?
Please help me , thx very much!

use std::collections::HashMap;

enum SyntaxKind {
    Unknown,
}

impl std::fmt::Display for SyntaxKind {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f, "{}", self)
    }
}

fn main() {
    let mut m = HashMap::new();
    m.insert("any", SyntaxKind::Unknown);

    match m.get("any"){
        Some(sk)=>println!("{}", sk),
        None=>println!("None")
    }

}

Output :

thread 'main' has overflowed its stack
fatal runtime error: stack overflow

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