Skip to content

ICE using struct MyStruct<'a, 'b> { x: &'a MyTrait<'b>,} #12851

Closed
@nielsle

Description

@nielsle

When I try to compile the following code with rustc --crate-type lib test_error.rs

trait MyTrait<'a> {
    fn yo(&'a self);
}

struct MyStruct<'a, 'b> {
    inner: &'a  MyTrait<'b>,
}

impl<'a,'b> MyStruct<'a, 'b> {

    fn foo_inner(&mut self) {
        self.inner.yo()
    }
}

.. then I get the following ICE:

test_error.rs:12:9: 12:19 error: internal compiler error: cannot relate bound region: ReEarlyBound(10, 0, a) <= ReInfer(0)
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
test_error.rs:12         self.inner.yo()

Possibly related to #5121

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