Skip to content

ICE when instance method calls static method #3707

Closed
@burg

Description

@burg

This should not compile (AFAIK, but static methods aren't documented), but it shouldn't ICE either.

output

error: internal compiler error: calling transform_self_type_for_method on static method
rust: task failed at 'explicit failure', /Users/burg/repos/rust/src/libsyntax/diagnostic.rs:78
rust: task failed at 'explicit failure', /Users/burg/repos/rust/src/rustc/driver/rustc.rs:275
rust: domain main @0x7f8c0a800010 root task failed

testcase

struct Obj {
    member: uint
}

impl Obj {
    static pure fn boom() -> bool {
        return 1+1 == 2
    }
    pure fn chirp() {
        self.boom();
    }
}

fn main() {
    let o = Obj { member: 0 };
    o.chirp();
    1 + 1;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-trait-systemArea: Trait systemI-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