Skip to content

ICE on by-value self method should be converted into proper error at type-check time #4776

Closed
@pnkfelix

Description

@pnkfelix
% rustc -v
rustc 0.6 (77ee858 2013-02-02 11:54:29 +0100)
host: x86_64-apple-darwin

% cat bug3.rs
pub trait Op<T> { fn call(self, T,T) -> T; }

impl<T> fn(T,T) -> T : Op<T> {
fn call(self, a:T, b:T) -> T { self(a,b) }
}

fn square<T : Copy>(x:T, op:Op<T>) -> T { op.call(x, x) }

fn main() {
let r = square(3, (|x:int,y:int|x*y) as Op::<int>); io::println(fmt!("%d", r))
}

% rustc bug3.rs
error: internal compiler error: methods with by-value self should not be called on objects

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type 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