Closed
Description
I'm trying to use generic_associated_types
feature but the compiler panics:
#![feature(generic_associated_types)]
use std::ops::Index;
use std::fmt::Display;
fn main() {
let w = Wrap(vec!['a', 'b']);
let mut v: Vec<&Index<usize, Output = Display>> = Vec::new();
v.push(&w as &Index<usize, Output = Display>);
}
struct Wrap<T>(Vec<T>);
impl<T> Index<usize> for Wrap<T>
where T: Display {
type Output<'a> = Display + 'a;
fn index<'a>(&'a self, index: usize) -> &'a Self::Output {
&self.0[index]
}
}
Output:
thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:499:9
note: Run with `RUST_BACKTRACE=1` for 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.27.0-nightly (9fae15374 2018-05-13) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
Metadata
Metadata
Assignees
Labels
Area: Generic associated types (GATs)Area: Associated items (types, constants & functions)Area: Type systemCategory: This is a bug.`#![feature(generic_associated_types)]` a.k.a. GATsIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.