Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE with a simple bintree, compiler panicked #22757

Closed
0mbi opened this issue Feb 24, 2015 · 2 comments · Fixed by #23930
Closed

ICE with a simple bintree, compiler panicked #22757

0mbi opened this issue Feb 24, 2015 · 2 comments · Fixed by #23930
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@0mbi
Copy link

0mbi commented Feb 24, 2015

#[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

@rprichard
Copy link
Contributor

What's your compiler's --version output? I'm using rustc 1.0.0-nightly (2b01a37ec 2015-02-21) (built 2015-02-22), and I instead see this error when I compile the test case:

rprichard@ryan:~/mess$ rustc test3.rs
test3.rs:14:23: 14:27 error: expected one of `!`, `:`, or `@`, found `left`
test3.rs:14 fn setLeft(&self, Box left) -> &BtNode {
                                  ^~~~

(It should be left: Box rather than Box left. Of course, the compiler shouldn't ICE, in any case.)

@sanxiyn sanxiyn added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Feb 24, 2015
@0mbi
Copy link
Author

0mbi commented Feb 24, 2015

I know that there was some error in the code. Compiler version was
rustc 1.0.0-dev (dfc5c0f 2015-02-18) (built 2015-02-18)

bors added a commit that referenced this issue Apr 3, 2015
Fixes #22757
Fixes #22972
Fixes #23044
Fixes #23151
Fixes #23597
Fixes #23656
Fixes #23929
It also fixes some other corner cases in range patterns, like incorrect spans or not accepting global paths after `...`.

It passes `make check` but needs some additional tests (then it will fix #22546 as well), I'll write them today or tomorrow.
Manishearth added a commit to Manishearth/rust that referenced this issue Apr 3, 2015
Fixes rust-lang#22757
Fixes rust-lang#22972
Fixes rust-lang#23044
Fixes rust-lang#23151
Fixes rust-lang#23597
Fixes rust-lang#23656
Fixes rust-lang#23929
It also fixes some other corner cases in range patterns, like incorrect spans or not accepting global paths after `...`.

It passes `make check` but needs some additional tests (then it will fix rust-lang#22546 as well), I'll write them today or tomorrow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants