Skip to content

ICE if generic destructor has several type parameters #14695

Closed
@bluss

Description

@bluss

A generic destructor with more than one type parameter (one more than the struct in this case), causes an ICE. A bound like <T: Iterator<T>> (for example) compiles, while <A, T: Iterator<A>> does not.

#![feature(unsafe_destructor)]
struct Test<T>(T);

#[unsafe_destructor]
impl <A, T: Iterator<A>> Drop for Test<T> {
    fn drop(&mut self) {  }
}

fn main() {
    let x = Test(2i);
    let _ = x;
}

ICE:

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 1 but the index is 1', /build/rust-git/src/rust/src/librustc/middle/subst.rs:420

See also previous issue #4252 and its fix #12403

31 aug 2014: updated test code to compile with current rust, and updated to new different ICE msg.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-destructorsArea: Destructors (`Drop`, …)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions