Skip to content

ICE: cannot relate bound region: ReStatic <= ReLateBound #48276

Closed
@samnardoni

Description

@samnardoni

The following (incorrect) code produces an ICE on stable and nightly:

struct A;

impl From<A> for &'static str {
    fn from(&self) -> &'static str {
        ""
    }
}

fn main(){}
error: internal compiler error: /checkout/src/librustc/infer/region_constraints/mod.rs:685: cannot relate bound region: ReStatic <= ReLateBound(DebruijnIndex { depth: 1 }, BrAnon(0))

Playground link: https://play.rust-lang.org/?gist=b86bdb728a9bd24e747744c075fd87fc&version=stable

I appreciate this code shouldn't compile; the from method should take A not &self. But it's an ICE regardless.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions