Skip to content

rustc paniked when I tried to use GAT #67424

Closed
@Cosmius

Description

@Cosmius

rustc paniked when I tried to use GAT, I didn't know rustc does not support it then.
Anyway I think it is not supposed to panic.

I have confirmed with

fn main() {
}

trait Trait1 {
  type A;
}

trait Trait2 {
  type Type1<B>: Trait1<A=B>;
}

It said,

error[E0658]: generic associated types are unstable
 --> src/main.rs:9:3
  |
9 |   type Type1<B>: Trait1<A=B>;
  |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: for more information, see https://github.com/rust-lang/rust/issues/44265

error: internal compiler error: src\librustc\ty\subst.rs:557: type parameter `B/#1` (B/1) out of range when substituting (root type=Some(B)) substs=[Self]

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:778:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

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 (4560ea788 2019-11-04) running on x86_64-pc-windows-msvc

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-GATsArea: Generic associated types (GATs)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.F-generic_associated_types`#![feature(generic_associated_types)]` a.k.a. GATsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions