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

rust 0.6: Internal Compiler Error when compiling the following code #7563

Closed
qtigercom opened this issue Jul 3, 2013 · 1 comment
Closed
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@qtigercom
Copy link

trait IDummy {
    fn do_nothing(&self);
}

struct A { a: int }
struct B<'self> { b: int, pa: &'self A }

    impl IDummy for A {
        fn do_nothing(&self) {
            io::println("A::do_nothing() is called");
        }
    }

impl<'self> B<'self> {
    fn get_pa(&self) -> &'self IDummy { self.pa as &'self IDummy }
}


#[test]
fn test_borrowed_ptr() {
    let sa = A { a: 100 };
    let sb = B { b: 200, pa: &sa };

    io::println(fmt!("sa is %?", sa));
    io::println(fmt!("sb is %?", sb));

    io::println(fmt!("sb.pa is %?", sb.get_pa()));
}
@Blei
Copy link
Contributor

Blei commented Jul 3, 2013

Still relevant on master.

blorg.rs:15:40: 15:64 error: internal compiler error: Cannot relate bound region as subregion: br_self
blorg.rs:15     fn get_pa(&self) -> &'self IDummy { self.pa as &'self IDummy }
                                                    ^~~~~~~~~~~~~~~~~~~~~~~~

@brson brson closed this as completed in a02a759 Aug 22, 2013
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

No branches or pull requests

2 participants