Skip to content

ICE with a simple bintree, compiler panicked #22757

Closed
@0mbi

Description

@0mbi
#[derive(Debug)]
enum BtNode {
    Node(u32,Box<BtNode>,Box<BtNode>),
    Leaf(u32),
}

impl BtNode {
    fn stringify(&self) -> String {
        match *self {
            BtNode::Leaf(val) => { format!("Leaf: {}",val) }
            BtNode::Node(val,ref l,ref r) => {format!("Node: {} {:?} {:?}", val,l,r) }
        }
    }
    fn setLeft(&self, Box<BtNode> left) -> &BtNode {
        match *self {
            BtNode::Leaf(val) => { }
            BtNode::Node(val,ref l,ref r) => { l = left }
        }
        return self;
    }
}

fn main() {
    let node =  Box::new( BtNode::Node( 1, Box::new(BtNode::Leaf(0)), Box::new(BtNode::Leaf(0)) )) ;
    let node2 = Box::new( BtNode::Node( 2, Box::new(BtNode::Leaf(0)), Box::new(BtNode::Leaf(0)) )) ;
    let root = Box::new( BtNode::Node( 0, node, node2 ) );
}

14:26 error: internal compiler error: ident only path should have been covered already

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions