Skip to content

Type inferrence failure with methods and closures #2332

Closed
@brson

Description

@brson
fn main() {
    chan_from_global_ptr() {|po|
        // The type of po looks inferrable but isn't
        po.send(true);
    };
}

type chan<T> = T;

impl chan<T: send> for chan<T> {

    fn send(+v: T) { fail }
}

fn chan_from_global_ptr<T: send>(
    f: fn~(chan<T>)
) {
}

/home/banderson/Dev/rust2/src/test/run-pass/test.rs:15:8: 15:15 error: the type of this value must be known in this context
/home/banderson/Dev/rust2/src/test/run-pass/test.rs:15         po.send(true);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions