Closed
Description
According to the manual, "an expression statement is one that evaluates an expression and ignores its result. The type of an expression statement e; is always ()"
However assignments of the form,
let x = {e;};
cause the compiler to crash. Likewise with struct field assignments,
S {x: {e;}};
Self-contained example program:
struct S {x:()}
fn main(){
// crashes the compiler
let s : S = S{x: {println!("a");} }; //
// crashes the compiler
let x : () = {println!("a");};
// note the following works
let y : int = {0};
// as does
let z : () = { {println!("a");} ; ()};
}
Metadata
Metadata
Assignees
Labels
No labels