Skip to content

ICE in existential type with lifetime in trait implementation #54169

@petertodd

Description

@petertodd

Example:

#![feature(existential_type)]
use std::fmt::Debug;

pub trait Foo {
    type Assoc : Debug;
    fn func() -> Self::Assoc;
}

pub struct Bar;

impl Foo for Bar {
    existential type Assoc<'b> : Debug;

    fn func() -> Self::Assoc {
    }   
}

fn main() {
}

Backtrace:

$ rustc  existential-panic.rs 
error: internal compiler error: librustc/ty/subst.rs:445: Region parameter out of range when substituting in region 'b (root type=Some(Assoc::<'b>)) (index=0)

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:525: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.30.0-nightly (2f1547c0a 2018-09-11) running on x86_64-unknown-linux-gnu

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`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.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions