Skip to content

ICE: Cannot relate bound region #11446

@Kimundi

Description

@Kimundi

Code:

trait Matchable<'a> {
    fn new_matcher(s: Self, st: &'a str) -> Matcher<'a, Self>;
}

struct Matcher<'a, T>(T, &'a str);

struct A;
impl<'a> Matchable<'a> for A {
    fn new_matcher(s: A, st: &'a str) -> Matcher<'a, A> {
        Matcher(s, st)
    }
}

fn main() {
    fn generic<'a, T: Matchable<'a>>(t: T, s: &'a str) {

    }
    let s = "abc";
    generic(A, s);
}
generic_str_matching.rs:19:5: 19:12 error: internal compiler error: Cannot relate bound region: ReInfer(1) <= ReLateBound(69, BrNamed(syntax::ast::DefId{crate: 0u32, node: 84u32}, a))
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
generic_str_matching.rs:19     generic(A, s);
                               ^~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions