Skip to content

GAT : internal compiler error #66734

@ZiCog

Description

@ZiCog

This code:

#![feature(generic_associated_types)]

trait Foo {
    type Bar<'a>;
    fn baz<'a>(&self, val: Self::Bar) -> Self::Bar;
}

struct Qux {
    x: i32,
    y: i32,
}

impl Foo for Qux {
    type Bar<'a> = &'a [u8];
    fn baz<'a>(&self, val: Self::Bar) -> Self::Bar {
        val
    }
}

fn main () {
}

Produces this compiler crash:

$ rustc junk.rs
warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
 --> junk.rs:1:12
  |
1 | #![feature(generic_associated_types)]
  |            ^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default

error: internal compiler error: src/librustc_mir/borrow_check/nll/universal_regions.rs:741: cannot convert `ReEarlyBound(0, 'a)` to a region vid

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:643:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: aborting due to previous error


note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.39.0-nightly (760226733 2019-08-22) running on x86_64-unknown-linux-gnu

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-GATsArea: Generic associated types (GATs)A-NLLArea: Non-lexical lifetimes (NLL)C-bugCategory: This is a bug.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsI-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