Skip to content

Generic type can't be inferred through lambda block #1471

Closed
@brson

Description

@brson
type actor<T> = {                                                                                                                                              
    unused: bool                                                                                                                                               
};                                                                                                                                                             

type self<T> = {                                                                                                                                               
    unused: bool                                                                                                                                               
};                                                                                                                                                             

fn act<T:send>(+behavior: sendfn(self<T>)) -> actor<T> {                                                                                                       
    {unused: true}                                                                                                                                             
}                                                                                                                                                              

tag in {                                                                                                                                                       
    preprocess([u8]);                                                                                                                                          
    exit;                                                                                                                                                      
}                                                                                                                                                              

fn mk() -> actor<in> {                                                                                                                                         
    act {|self|                                                                                                                                                
    }                                                                                                                                                          
}                                                                                                                                                              

fn main() {                                                                                                                                                    
}
../src/test/run-pass/block-infer.rs:19:4: 19:7 error: cannot determine a type for this expression
../src/test/run-pass/block-infer.rs:19     act {|self|

Writing act::<in> allows it to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions