Skip to content

ICE: Drop does not check trait bounds #22965

Closed
@mahkoh

Description

@mahkoh
#![feature(optin_builtin_traits, unsafe_destructor)]

trait Print {
    fn print(&self);
}

struct X<T> {
    x: T,
}

#[unsafe_destructor]
impl<T: Print> Drop for X<T> {
    fn drop(&mut self) {
        self.x.print();
    }
}

fn main() {
    X { x: 1 };
}
test4.rs:14:9: 14:23 error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(Print)` during trans
test4.rs:14         self.x.print();
                    ^~~~~~~~~~~~~~

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-destructorsArea: Destructors (`Drop`, …)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